Feather: A Fast On-Disk Format for Data Frames for R and Python - <AUTHOR> http://blog.rstudio.org/2016/03/29/feather/ <comment><USER2> HDF5 is supported by many languages including C, C++, R, and Python. It has compression built in. It can read slices easily. It is battle-tested, stable, and used in production for many years by thousands of people. Pandas even has integrated support for DataFrames stored in HDF5.

What's the advantage of Feather over HDF5? Couldn't the Feather libraries be written with the same API but HDF5 as the storage format, if the Feather API is preferable?

<comment><USER3> Hi, Wes here.

HDF5 is a really great piece of software -- I wrote the first implementation of pandas's HDF5 integration (pandas.HDFStore) and Jeff Reback really went to town building out functionality and optimizing it for many different use cases.

But the HDF5 C libraries are very heavy dependency. Feather by comparison is an extremely small amount of code (< 2KLOC in the core library) and a correspondingly minimal API. It's a simple file format with excellent performance, and we wanted to make it as easy as possible for people to use Feather.

There is also the Apache Arrow factor -- integration between the Arrow memory representation and R and Python tools will have a lot of ecosystem benefits, so one of the goals of Feather is to reconcile Python's and R's metadata requirements with the "official" Arrow metadata so that we can move around data frames with very low overhead.

<comment><USER4> Is there a plan to add other language implementations (or C implementation wrappers)?

I'd love to see a nice format of this type that can easily be written/read from Javascript in a browser [e.g. to get the data into a D3 visualization] and from Matlab, in addition to Python.

I looked into trying to implement an HDF5 codec in Javascript, but that looked like a large task for one person unfamiliar with the format.

<comment><USER5> It's just a matter of someone implementing the protocol. It's not a huge amount of work for an experienced js/matlab programmer.

<comment><USER4> Is there a spec somewhere, or is the existing implementation the spec?

Edit: [https://github.com/wesm/feather/blob/master/doc/FORMAT.md](https://github.com/wesm/feather/blob/master/doc/FORMAT.md)

Seems a bit sparse/incomplete still (as would be expected for a brand new project).

</comment></comment></comment></comment></comment><comment><USER5> Both Wes and I (project authors) will be tracking this thread in case you have questions!

<comment><USER6> Great idea! Some questions:

\- Both R and Python support strings, factors, and complex objects in a dataframe. What is NOT supported by feather?

\- Feather is "not for long term data storage". Will it be standardize in a distant future?

\- Do you plan to integrate it into Pandas?

<comment><USER5> Feather currently doesn't support recursive/hierarchical data structures, like lists in R. That'll be added in the future though. We'll definitely standardise in the future so you can feel confident using it in the long term.

I have no plans to integrate it with pandas, but I'm sure Wes does ;)

<comment><USER7> Will you take a storage approach for nested data similar to Parquet?

</comment></comment></comment></comment><comment><USER8> My heart is palpitating. I love where this is going. Jake Vanderplas talked about the desire for a common data frame lib to unite the warring tribes in his PyCon keynote a year or so ago, and I couldn't have agreed more.

This appears to be "only" a serialization format ("oh, my unicorn _only_ lays _golden_ eggs"). I really hope this is the start of some common library infrastructure that can be used for all aspects of in- and out-of-memory data frames.

Great work, and I hope it is a harbinger of good things to come. Also, I'll treat this as tangible evidence that the "language wars" are stupid.

<comment><USER3> This is precisely the goal of the Apache Arrow project [http://arrow.apache.org/](http://arrow.apache.org/) \-- and I've been working very hard to bring together diverse groups of data system developers to work on this problem together. Exciting road ahead!

<comment><USER8> Ah jeez, I read the feather announce, but not the arrow docs. How did I not know about this!?

</comment></comment></comment><comment><USER9> If anyone wants to get this running on Windows, I've made a start. In cpp\thirdparty, you can run the .sh scripts with cygwin, but in build_thirdparty you'll need to add to the appropriate section:

        elif [[ "$OSTYPE" == "cygwin"* ]]; then
          PARALLEL=$NUMBER_OF_PROCESSORS

And you'll need to use msbuild rather than make, e.g.:

          if [[ "$OSTYPE" == "cygwin"* ]]; then
            msbuild gtest.sln /p:configuration=release

That got the 3rd party stuff working. But then I hit a snag, because building python 2.7 modules on Windows requires an old MSVC version that doesn't support stdint.h, which is used by feather in ext.cpp . Maybe a simple conditional compilation for the appropriate header will be enough to fix that, but I haven't got time to check today. So hopefully someone else can fix that...

</comment><comment><USER10> I can see that Wes is a reporter for Spark issue ([https://issues.apache.org/jira/browse/SPARK-13534](https://issues.apache.org/jira/browse/SPARK-13534)), what are the plans (if any) for tighter Spark/Python/R DataFrames integration?

<comment><USER3> I'd like to see SPARK-13534 completed so that we can bring Spark to Python/R data access performance reach a level we can deem "acceptable". I dug into this issue a bit here: [http://wesmckinney.com/blog/pandas-and-apache- arrow/](http://wesmckinney.com/blog/pandas-and-apache-arrow/)

</comment></comment><comment><USER11> Are there any plans to support larger than RAM datasets? Like hdf5 or bcolz does.

<comment><USER5> The format already supports larger than RAM data, but we don't yet have an API for creating those files or just extracting slices. That will come in the future.

<comment><USER12> Thanks for working on this. Really a great effort. Hope your guys can get good inspiration from projects like h5df, bcolz, pytables having the option of incrementally adding features and maintaining an open spec.

</comment></comment></comment><comment><USER13> what are some practical uses for this if living in a pure R world?

Is this like BigMemory but for data frames?

[https://cran.r-project.org/web/packages/bigmemory/index.html](https://cran.r-project.org/web/packages/bigmemory/index.html)

Thanks.

<comment><USER5> It's often much faster than rds. And in the long long term there will be tools for computing on feather files that don't require loading it into memory. (In the short term I'll add ways to pull in slices of the full dataset)

<comment><USER14> Faster because it isn't (currently) using compression (which rds uses by default) or faster period?

Either way, the idea of mixed Python/R pipelines with feather file intermediates input/outputs is pretty sweet. Learn in scikit, save to feather, plot in ggplot2... using Make to tie the pieces together?

<comment><USER5> It's usually faster than either compressed or uncompressed RDS - but if you have heavily duplicated data, compressed RDS can be faster than feather (depending on some tradeoff between compression speed and disk speed). Feather will probably gain compression support eventually.

</comment></comment></comment></comment><comment><USER15> Now if only there was a Julia package for this too

<comment><USER16> It shouldn't be hard, given that most of the work is being done by a shared C++ library.

(I'll probably take a stab at writing one this weekend, though)

</comment></comment><comment><USER17> This looks amazing!

Hadley, Wes, what are your thoughts on how to implement compression? I recall some open source columnar datastores (e.g. infobright) that achieved very VERY fast compression rates with just a few tricks: [https://news.ycombinator.com/item?id=8354416](https://news.ycombinator.com/item?id=8354416)

In particular, compression is extremely fast for columnar datastores (its the same type one after the other). Since a lot of times the data is sorted by some ID (date, individual, etc.), you should see large improvements in both speed and disk space.

<comment><USER5> Compression is on the long term to do list - Wes knows a lot more about it than me.

</comment></comment><comment><USER18> Any plans to support a pipe-aware POSIX command, or get this into PostgreSQL?

<comment><USER5> Not by us, but we expect that many other projects will add feather support now that it's used by both R and Python.

<comment><USER19> Is there any functional distinction between a data frame and a relational table? Could you implement a persistent frame just by wrapping sqlite?

</comment></comment></comment><comment><USER20> It seems like C++ (C?) is also supported. Why don't you advertise it? In my (limited) experience, exchanging data with C/C++ is even more painful than between Python and R.

</comment><comment><USER21> Quick request - could you hook into save.image in R and give the ability to save the entire workspace in R? That would be awesome.

Incidentally I had filed a bug request for a functionality to save the entire workspace in Pandas...but was rejected as being unpythonic. Oh and the devs claimed Apache Arrow was vaporware !

[https://github.com/pydata/pandas/issues/12381](https://github.com/pydata/pandas/issues/12381)

<comment><USER5> I think saving your entire workspace is a bad idea too, sorry!

<comment><USER21> Could you talk about why? Other than convenience factor (and R already does it), could you talk about why.

Is it stemming from a fundamental aspect of the data format - for example can you save two data frames to the same file?

Because if you can save two - why not save two hundred.

<comment><USER8> It thwarts reproducibility. By saving your workspace, it drags a lot of state from session to session that isn't accounted for. If you share code with someone else, their workspace space won't be the same, and thus the code may not function the same.

<comment><USER21> Point taken. But we are again delving dangerously close to thou-shall-not . from my perspective, it is a quick and convenient way to save all the data frames in my code. It's a boon for productivity.

If not this, then I pray for Feather to be able to save multiple data frames innone file.

<comment><USER8> I don't see it as a thou-shalt-not. As a file format, feather is is lightweight. If they turned it into a container format it would be expanding the scope. If they instrumented it to comb objects in the global namespace and serialize them to the new container format, it would be heavier still--all to support a feature that the authors view as an anti-pattern. That's less a thou shalt not than it is a prioritization of their own vision.

If you're looking for a container to store lots of tabular data in one file, I'd suggest SQLite. Using dplyr, you can save those dataframes very easily. Plus, you can join tables and perform efficient aggregations on datasets too large to keep in memory.

In a lot of ways, I don't understand what limitations prevent SQLite from becoming the defacto common data.frame format. There probably are some, I just don't understand the tradeoffs (especially given how much SQLite gives you for free)!

<comment><USER21> Actually this is interesting - whhy Feather vs sqlite. I would love to know the answer!

But coming back to the anti-pattern : well, obviously the authors have the power to not spend time on something. But I'm trying to figure out why it's an anti-pattern in general. Snapshotting execution state is probably the ideal goal, but saving intermediate data structures is a decent convenience feature.

Now if that's restricted by the limitations of the format itself (no multiple frames in a single file), then we are back to thinking that HDF5/sqlite may indeed be the better format.

<comment><USER5> Basically because you should be encoding state in code, not data. If you store data between sessions, it's easy to lose the code that you use to create it and then later on you can't recreate it.

It is convenient to save your complete workspace but I've seen too many cases where it's contributed to lack of reproducibility to spend my time working on it.

<comment><USER21> So there's a use case difference. I create models from remote data sources - this is incremental on a daily basis and takes quite a bit of time.

So I snapshot the workspace after I do a run and do some experiments. Now - for me, saving the workspace is a convenience feature, NOT a programming feature.

This is what I mean by thou-shall-not. My use case is very well defined and I'm not stupid. And I completely knows the pitfalls of what you talk about - but a philosophical opposition is what hurts me (and lots of devs like me)

<comment><USER5> I hope I didn't come across as "thou shalt not" \- it's just never going to be high in my priority list.

(And even for your use case I would think you'd be better off keeping the models in a list and saving that. Then other random stuff in your evn won't get carried along for the ride)

<comment><USER21> Oh no you did not! That was polite musing. Thank you for the reply - I still hope you change your mind. Because people do have genuine, but different needs ;)

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER22> Any luck in getting it to work with sas... Maybe in a 10.12 future release? My daily grind is SAS to csv to R, because not everyone else has seen the light.

<comment><USER5> If SAS wanted to support it, it would be super easy for them to implement it.

</comment></comment><comment><USER23> Ignorant question: What does this solve that a csv doesn't? Type information?

<comment><USER24> Type information is one. CSV is slow, since it has to parse everything on load. CSV has no random access, since rows can be arbitrary length. CSV takes up a lot of disk space, since a 8-byte double gets expanded into a 15+ digit string.

<comment><USER25> Also there's no single, official CSV standard.

<comment><USER26> There's RFC 4180. Problem is, there is no universal acceptance in actually following it.. :)</comment></comment></comment></comment>


Moore's Law Running Out of Room, Tech Looks for a Successor - <AUTHOR> http://www.nytimes.com/2016/05/05/technology/moores-law-running-out-of-room-tech-looks-for-a-successor.html <comment><USER2> The end of Moore's law is like commercial fusion power--always just around the corner but it never seems to get here.

It does seem like we should stop counting how many transistors fit in how much space. At this point, size isn't the limiting factor. Tracking either the cost of a unit of processing power or the total processing power of the planet would be more meaningful in benchmarking technological progress.

<comment><USER3> The end of exponential growth is inevitable. We've reached the end of Moore's law as it applies to silicon wafers. We may be able to get to 5nm but no one really has an idea on how to do it and make a profit. Alternate technologies are just theoretical ideas that have no timeline for commercialization.

The main point of the decline of Moore's law is that it is about economics as much as it is about the size of the features on a chip. Even if someone does figure out how to get to 5nm it may not be cost effective to mass produce chips at that size. Already we see that Intel can't afford to keep up with shrinking scale as they've moved away from their tick-tock cadence to tick- tock-tock. Intel has the most advanced materials research in the world and they can't make it work cost effectively. That indicates pretty clearly that the exponential scaling of transistors is over. Smaller transistors may still be possible or new materials may emerge but the future scaling isn't going to happen on Dr. Moore's timetable which is the basis for Moore's law.

<comment><USER4> > Even if someone does figure out how to get to 5nm it may not be cost > effective to mass produce chips at that size.

On top of that, it is not quite clear what would the hardware designers achieve with an increased transistor budget. CPU cores are becoming increasingly small in comparison to the surrounding circuitry (graphics, caches, control logic). We are bumped on clock speeds, too.

<comment><USER3> Mostly lower power from what I understand. Do phones, tablets, and small laptops really need more than 4 cores? Probably not. So the only thing you get is lower power and maybe smaller chips (which can help with the economics).

<comment><USER5> If you only run one NodeJS app at a time, probably not

</comment></comment></comment></comment></comment><comment><USER6> So there's two obvious ways for faster machines, one of which we can do today: 1) Move off of silicon. 2) Write better code.

<comment><USER7> I'm kind of skeptical we'll move off of silicon any time soon, but fortunately, I think there's still a lot we can do with silicon. We aren't nearly done optimizing hardware. Then there's the promise of 3D stacking, optical interconnects, more cores and more memory bandwidth.

<comment><USER8> From an article a while ago, I was convinced that the next generation of computers would be built on memristors... Allowing you to dynamically allocate memory and computation resources in a 3D framework. And photonics would be used to connect multiple computing units.

Is any of this feasible or realistic?

<comment><USER9> Sounds a bit like using FPGAs for everything. I actually think we'll start seeing a lot more of that sort of thing once tooling for FPGAs stops sucking.

</comment></comment></comment></comment><comment><USER10> The next step is specialization. Developing an ASIC makes more sense if there isn't going to be a general purpose x86 that eats your lunch in 5 years just by brute clock speed.

</comment><comment><USER11> The upside of the end of Moore's law is that hardware should stabilize as the focus goes from making things faster to making things easier to work with. I think there are already trends in this direction with projects like RISC-V.

<comment><USER12> I think the focus will go toward making hardware more power efficient instead of faster.

<comment><USER13> Power efficiency and size reduction go hand in hand. The gate capacitance is reduced at lower geometry, and you can also reduce the core voltage. Both of which directly contribute to power.

The only other way to reduce power is by clock gating, which pretty much happens these days on any decent SoC design targeted at mobile.

</comment></comment></comment><comment><USER14> Moore's law is as much about economics as it is about shrinking. For all you code types, switching to a new device is not just as simple as fabricating a new chip in a research lab. Thousands of experimental devices and chips have been made in many research labs. Moore's law is about being able to _consistently_ manufacture more and more millions (and now at billions) of very small transistors every generation (for silicon, this used to be about 1-1.5 years in the late 90's early 2000's).

</comment><comment><USER15> ''After the 28nm node, we can continue to make transistors smaller, but not cheaper.'' As computer vision and reinforcement learning improved dramatically in the last few years, robots will take over a lot of manufacturing jobs of humans, so as long as there's enough demand to finance robot developments and there's no serious material shortage, I don't see why the cost could not go down to the cost of the material itself + development cost + robot cost in the following years.

<comment><USER16> The fabrication plants are highly automated. The cost is mostly capital costs for equipment.

<comment><USER15> What is the biggest cost in the equipment? I'm sure a big part of it is engineering but there must be expensive hand craft part as well.

</comment></comment></comment><comment><USER17> What ever happened to processors made with synthetic diamond? If I recall correctly, diamond has incredible heat transmission capability, so diamond processors made at the same density as current silicon processors could run at higher (and hotter) clock rates.

<comment><USER18> Given that both diamond and graphene are both just carbon, what's the difference between the two approaches?

<comment><USER19> What does sharing a common element have to do with anything? They are allotropes ([https://en.wikipedia.org/wiki/Allotropes_of_carbon](https://en.wikipedia.org/wiki/Allotropes_of_carbon)) - diamond, graphite, fullerenes, SWNT, etc all have very different properties.

<comment><USER18> Well, I'm not a chemist or anything but I, maybe naively, thought that the properties would be similiar. More similar to each other than to silicon anyway.

I mean it's similiarity that makes you think of carbon as an alternative to silicon rather than some other element, no?

<comment><USER20> Diamond's electronic and optical properties are far more similar to those of silicon than they are to graphite, graphene, or other forms of carbon. Diamond and silicon are diamond cubic lattices with sp3 hybridization (tetrahedral), graphite and related planar allotropes have sp2 hybridization (triangular).

</comment></comment></comment></comment></comment><comment><USER21> Can we quit with the Moore's law bullshit? It's not a law! It's just an observation about the direction a graph seems to be moving.

Yeah, we hope processors keep getting more powerful. Calling this "Moore's law" is idiotic. And probably confuses poor journalists and undergrads.

<comment><USER13> In all fairness the article says:

"Despite its official sound, it is not actually a scientific rule like Newton's laws of motion. Instead, it describes the pace of change in a manufacturing process that has made computers exponentially more affordable."</comment></comment>


University of Phoenix to Shutter 115 Locations - <AUTHOR> http://www.nytimes.com/2012/10/18/education/university-of-phoenix-to-close-115-locations.html

<comment><USER2> For-profit universities and the "free" federal dollars they collect are the very reason why we have exorbitant inflation in the education sector that is incommensurate with general inflation.

Except for the Tier I elite universities, there is no reason for a college education to cost $40k-$50k a year.

What is worse, student loans are the one type of debt that cannot be cleared through bankruptcy, meaning that millions of young adults of our generation will suffer decades of reduced incomes as they try to dig themselves out of debt for degrees that did not result in high-paying jobs.

<comment><USER3> Your argument lacks sense. Care to elaborate on how greater supply leads to higher prices?

<comment><USER4> He should have left out the for profit universities as part of the problem (they're a symptom not the cause). It's all about the free federal dollars. The parallels to the housing bust are pretty clear. Cheap and widely available mortgages led to exorbitant housing prices and an eventual bust. Cheap, widely available, and undischargable loans for education are leading to exorbitant education costs. It'll be interesting to see how this bubble ends.

<comment><USER2> just addressed that in another comment. another side effect is increased revenues to these institutions caused a rampant increase in spending across the board - personnel, buildings, facilities, departments, etc. - that are now no longer sustainable.

</comment></comment></comment></comment><comment><USER5> This "university" is on the cusp of losing its accreditation in a number of places. They have a bad reputation for preying on under qualified students who otherwise couldn't get in to college, taking their money and dumping them.

It is particularly pervasive in gi bill students.

Their business model though profitable has dubious ethical traits to it.

Disclaimer both my parents work at public universities and I've been around academia my whole life

<comment><USER6> Dumping? Not. Those who do what it takes to learn the material pass; those who don't, don't. An unwillingness to pass those unwilling to learn is not "dumping". More than enough learning resources are provided & available; most of those I fail are just plain unwilling to learn.

<comment><USER5> They accept students who aren't READY for college level education. Kids who don't have the basis to be able to learn.

<comment><USER6> Unready is one thing. Unwilling is something else - and seriously underdiscussed.

</comment></comment></comment></comment><comment><USER7> There goes the student loan bubble ([http://www.zerohedge.com/news/inside- student-loan-debt-bubbl...](http://www.zerohedge.com/news/inside-student-loan- debt-bubble)). So is real estate the next bubble? Or will it be web 3.0?

</comment><comment><USER8> Hooray! For-profit universities are almost uniformly a scam.

<comment><USER9> What would you call Coursera and Udacity then? Because they're both for- profit...

<comment><USER10> They aren't accredited.

<comment><USER11> So in your opinion it's the accreditation that makes U of Phoenix bad?

<comment><USER10> No, U of Phoenix makes u of Phoenix bad. That they have been able to be accredited just makes it worse.

</comment></comment></comment></comment></comment><comment><USER12> It's made both the founder[1], John Sperling, and his son Peter billionaires[2][3].

[1] <http://en.wikipedia.org/wiki/John_Sperling>

[2] <http://www.forbes.com/profile/john-sperling/>

[3] <http://www.forbes.com/profile/peter-sperling/>

</comment><comment><USER13> There was actually an interesting npr story on UofP. I think it is [http://download.publicradio.org/podcast/americanradioworks/p...](http://download.publicradio.org/podcast/americanradioworks/podcast/arw_6_2_phoenix.mp3)

</comment><comment><USER14> They had locations?

<comment><USER15> American Radio Works just ran a program on UoP / The Apollo Group. Doesn't appear that there's a stream or transcript though.

University of Phoenix opened offices frequently in office buildings near freeways and other accessible areas to create physical points of presence. Most education remains online.

<http://www.ideastream.org/programs/entry/48203>

<comment><USER16> Is that so they can get free advertising on the highway signs that show nearby universities? I always thought that was a very clever trick.

<comment><USER15> Good question. I don't know if those signs are free, but I suspect that as branding and advertising, they're cheap and high-profile.

</comment></comment></comment></comment><comment><USER17> how can shuttering over half their physical locations affect only 4 percent of their students and just over 5 percent of their staff?

<comment><USER18> I'm pretty sure they're primarily an online university and the locations were for testing and some classes.

I only visited their campus in Phoenix once though.

Edit: The article actually confirms that most of the students are online, and it's closing "satellite learning centers".</comment></comment>


The Command Line Rosetta Stone – a comparison chart for modern operating systems - <AUTHOR> https://certsimple.com/rosetta-stone

<comment><AUTHOR> Some background on the design choices that went into creating this: [https://certsimple.com/blog/recreating-unix-rosetta- stone](https://certsimple.com/blog/recreating-unix-rosetta-stone)</comment>


Ask HN: HN for non-programmers? - <AUTHOR>

I recently got my girlfriend hooked on HN. She doesn't know how to program, though, so a good chunk of the content on HN is of no interest to her. The other half (non-technical articles+discussions) she thoroughly enjoys.<p>My question: is there a HN-like website for non-programmers? Something like HN without the clojure/node.js/etc. related articles. <comment><USER2> You/she might enjoy <http://www.metafilter.com>, which has a well-informed and largely thoughtful community. If you want to post, there's a one-time fee of $5.

<comment><USER3> Within 10 seconds of visiting metafilter for the first time, I ran into this and similar comments:

 _They pulled it because at 0:58 in the video, you can briefly see Elmo's clitoris. posted by Greg Nog to MetaFilter at Sep 23 at 6:35 AM_

So, like Reddit?

</comment></comment><comment><USER4> Well... reddit? <http://reddit.com>

<comment><AUTHOR> I should have been clearer when I said "something like HN": something with a good deal of intellectual curiosity, and something without dick/fart jokes.

Perhaps you can recommend a subreddit?

<comment><USER4> I almost added a disclaimer about choosing proper subreddits, but I wanted to make sure you hadn't ruled out reddit for another reason. At the risk of sounding all Eternal September-y, reddit quality has indeed suffered in all main subreddits.

What topics interest your girlfriend? I'd be happy to provide subreddit recommendations, or either of you are welcome to send me a PM at reddit - <http://www.reddit.com/user/thinkalone/></comment></comment></comment>


Ask HN Emacs Users: What's in your .emacs file? - <AUTHOR> Are there any key bindings or modes that have been especially useful for you? If so, what are they?<p>Cheers. <comment><USER2> Funny, about an hour ago I finally broke down and remapped Ctrl+w to backward- kill-word[1] after re-reading Yegge's Effective Emacs, and you've just reminded me to push the commit to my fork of emacs-starter-kit, which is a great way to get a core set of functionality. Works best if you're tyrannical about keeping it up to date, which I mostly am.

<http://github.com/daemianmack/emacs-starter-kit/>

Favorite two most recent additions: pyflakes/pylint for Python, and rainbow- mode for CSS.

[1] Having backward-kill-word a two-finger-stroke, instead of the two-handed alt+Backspace, is great! On the other hand, it turns out I kill-region a lot more than I thought I did, so that's a little weird.

<comment><USER3> I too made the switch after reading Yegge's good stuff, but missed kill-region so badly I had to come up with this:

        (defun backward-kill-word-or-kill-region (&optional arg)
          (interactive "p")
          (if (region-active-p)
        	  (kill-region (region-beginning) (region-end))
        	(backward-kill-word arg)))

        (global-set-key (kbd "C-w") 'backward-kill-word-or-kill-region)

This gets me kill-region for an active (transient-mark-mode) region but backward-kill-word otherwise.

<comment><USER2> Excellent idea; thanks!

</comment></comment></comment><comment><USER4> Here's some stuff I find useful when editing Python:

        (setq-default show-trailing-whitespace t)
        (setq longlines-show-hard-newlines t) ; displays "\" at the end of lines that wrap past the window's edge

        ; camel case word navigation
        (when (boundp 'subword-mode)
          (add-hook 'after-change-major-mode-hook '(lambda () (subword-mode 1))))

        ; Bindings
        (defun delete-backward-indent (&optional arg)
          "Erase a level of indentation, or 1 character"
          (interactive "*P")
          (if (= (current-column) 0)
              (delete-backward-char 1)
            (let ((n (mod (current-column) standard-indent)))
              (if (looking-back (concat "^\s*" (make-string n 32)))
                  (if (= n 0)
                      (delete-backward-char standard-indent)
                    (delete-backward-char n))
                (delete-backward-char 1)))))

        (defun newline-maybe-indent ()
          "Like newline-and-indent, but doesn't indent if the previous line is blank"
          (interactive "*")
          (if (= (line-beginning-position) (line-end-position))
              (newline)
            (newline-and-indent)))

        (add-hook 'python-mode-hook
                  '(lambda ()
                     (hs-minor-mode 1) ; code folding
                     (define-key python-mode-map (kbd "RET") 'newline-maybe-indent)
                     (define-key python-mode-map (kbd "DEL") 'delete-backward-indent)
                     (define-key python-mode-map (kbd "M-RET") 'hs-toggle-hiding)))

        ; On-the-fly spell checking
        (add-hook 'python-mode-hook '(lambda () (flyspell-prog-mode)))

        ; On-the-fly pyflakes checking
        (require 'flymake-point) ; shows errors in the minibuffer when highlighted (http://bitbucket.org/brodie/dotfiles/src/tip/.emacs.d/plugins/flymake-point.el)
        (setq python-check-command "pyflakes")
        (when (load "flymake" t)
          (defun flymake-pyflakes-init ()
            (let* ((temp-file (flymake-init-create-temp-buffer-copy
                               'flymake-create-temp-inplace))
                   (local-file (file-relative-name
                                temp-file
                                (file-name-directory buffer-file-name))))
              (list "pyflakes" (list local-file))))
          (add-to-list 'flymake-allowed-file-name-masks
                       '("\\.py\\'" flymake-pyflakes-init)))
        (add-hook 'python-mode-hook '(lambda () (flymake-mode 1)))

I have a feeling there's probably a better way to do that delete-backward- indent thing. Maybe I should just switch to hungry delete mode.

My entire .emacs is here: <http://bitbucket.org/brodie/dotfiles/src/tip/.emacs>

<comment><USER5> Oh boy, nethack_el does not play well with `longlines-show-hard-newlines`.

</comment></comment><comment><USER6> A few things I found useful:

      ;; fonts
      (if (eq window-system 'x)
          (set-default-font "Inconsolata-12"))

      ;; no tabs, spaces instead!
      (setq-default indent-tabs-mode nil)

      ;; Changes all yes/no questions to y/n type
      (fset 'yes-or-no-p 'y-or-n-p)

      ;; default modes
      (iswitchb-mode t)
      (icomplete-mo)
      (column-number-mode)
      (ido-mode)
      (tabbar-mode)
      (winner-mode)

      ;; ido-mode

      ;; do not confirm file creation
      (setq confirm-nonexistent-file-or-buffer nil)

      ;; integrate copy/paste with X
      (setq x-select-enable-clipboard t)
      (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

      ;; scroll
      (setq scroll-step 1)

      ;; save backup files in this directory
      (setq backup-directory-alist (quote ((".*" . "~/.emacs.d/backups/"))))

      ;; global bindings
      (global-set-key [C-tab] 'other-window)
      (global-set-key "\r" 'newline-and-indent)
      (global-set-key (kbd "C-;") 'comment-region)
      (global-set-key (kbd "<f8>") '(lambda ()
                                    (interactive)
                                    (split-window-vertically 25)
                                    (other-window 1)
                                    (slime)))

      ; switch buffer with last previous buffer
      (global-set-key (kbd "<C-return>") '(lambda ()
                                          (interactive)
                                          (switch-to-buffer nil)))
      (global-set-key (kbd "C-p") 'backward-char)
      (global-set-key (kbd "C-S-p") 'previous-line)
      (global-set-key (kbd "C-S-j") 'join-line)
      (global-set-key (kbd "C-<prior>") 'tabbar-forward)
      (global-set-key (kbd "C-<next>") 'tabbar-backward)

      ;; fullscreen on F11
      (defun toggle-fullscreen (&optional f)
        (interactive)
        (let ((current-value (frame-parameter nil 'fullscreen)))
          (set-frame-parameter nil 'fullscreen
                             (if (equal 'fullboth current-value)
                                 (if (boundp 'old-fullscreen) old-fullscreen nil)
                               (progn (setq old-fullscreen current-value)
                                      'fullboth)))))

      (global-set-key [f11] 'toggle-fullscreen)

<http://github.com/kototama/unixconf/blob/master/.emacs>

</comment><comment><USER7> My .emacs, which is commented, is located at <http://github.com/zck/emacs/blob/master/.emacs> . I need to update it and move it over to bitbucket, though.

Specifically, my favorite things are show-paren-mode, ido-mode, and rebinding C-, and C-. to move back and forward between windows.

</comment><comment><USER8> Mine's on github too: <http://github.com/markhepburn/dotemacs>

It's quite large, and includes a lot of third-party stuff, much of it as submodules.

It's relocatable (with additional platform and/or machine-specific loads) which might be semi-interesting: [http://everythingtastesbetterwithchilli.com/initialisation-f...](http://everythingtastesbetterwithchilli.com/initialisation- file-portability-tweaks)

Little things off the top of my head that I find useful: * wind-move -- use shift-arrow keys for window navigation * (fset 'yes-or-no-p 'y-or-n-p) * browse-kill-ring * mic-paren-mode * rename-file-and-buffer from Yegge * unscroll (undo inadvertent C-v) from Glickstein's book * lots of little tweaks like using C-,/. for smooth scrolling up/down * uniquify to keep buffer names unique * find-file-at-point

Lots of autloads for more efficient initialisation (although that's less of an issue now that I'm using --daemon at startup)

I do the usual UI tweaks like turning off the menu and tool bar, using ido mode (with smex -- ido for commands), etc. There's not a lot of keys that I rebind, but I do change backward-kill-word to C-w (consistent with shell usage), and kill-region to C-xC-k. Both those suggestions were from Yegge's effective emacs article which is worth a browse; I've ignored his advice to also change M-x to C-xC-m though.

</comment><comment><USER9> Check out: <http://github.com/technomancy/emacs-starter-kit>

I've modified it slightly, but overall it set emacs up better than I new was possible (and introduced me to some add ons I didn't know existed).

</comment><comment><USER10> Very little, my .emacs just loads a whole load of other .el files. There's quite a lot in them though :) Here's a very very useful few lines if you're on X Windows:

        ; Fix copy-paste between emacs and other x programs
        (setq x-select-enable-clipboard t)
        (if (functionp 'x-cut-buffer-or-selection-value)
            (setq interprogram-paste-function 'x-cut-buffer-or-selection-value))

All your problems with cut and paste between Emacs and other programs? Gone!

The if statement stops it failing when you use it on other platforms.

EDIT: I also really really like this bit which I've not seen in other peoples lists:

        (defun eshell-goto-current-dir (&optional arg)
          (interactive "P")
          (let ((dir default-directory))
            (eshell arg)
            (eshell/cd dir)))

        (global-set-key "\C-cs" 'eshell)
        (global-set-key "\C-cS" 'eshell-goto-current-dir)

That means I can switch to eshell with C-cs or a can switch to eshell _and_ change the current directory to be the same as the file I was viewing with C-cS. It also passes through the argument so I can have multiple shells open and use the numeric argument (M-1, M-2 etc) to select them.

</comment><comment><USER11> My .emacs is on GitHub: <http://github.com/avar/dotemacs/blob/master/.emacs> along with the elisp library I use <http://github.com/avar/elisp>

Some noteworthy things:

It's a ~1200 line file (and expanding) this is how I navigate it:

        (defun show-dot-emacs-structure ()
          "Show the outline-mode structure of ~/.emacs"
          (interactive)
          (occur "^;;;;+"))

Which shows the outline of the file, e.g.:

        74 matches for "^;;;;+" in buffer: .emacs
         57:;;;; Debugging
         67:;;;; Load paths
        112:;;;; Emacs' interface
        229:;;;; User info
        236:;;;; Encoding
        253:;;;; Indenting
        273:;;;;; Per-project indentation settings
        275:;;;;;; Git

A quiet startup:

        ;; Don't display the 'Welcome to GNU Emacs' buffer on startup
        (setq inhibit-startup-message t)

        ;; Display this instead of "For information about GNU Emacs and the
        ;; GNU system, type C-h C-a.". This has been made intentionally hard
        ;; to customize in GNU Emacs so I have to resort to hackery.
        (defun display-startup-echo-area-message ()
          "If it wasn't for this you'd be GNU/Spammed by now"
          (message ""))

        ;; Don't insert instructions in the *scratch* buffer
        (setq initial-scratch-message nil)

Core UI settings:

        ;; Display the line and column number in the modeline
        (setq line-number-mode t)
        (setq column-number-mode t)
        (line-number-mode t)
        (column-number-mode t)

        ;; syntax highlight everywhere
        (global-font-lock-mode t)

        ;; Show matching parens (mixed style)
        (show-paren-mode t)
        (setq show-paren-delay 0.0)

        ;; 'mixed highligts the whole sexp making it unreadable, maybe tweak
        ;; color display?
        (setq show-paren-style 'parenthesis)

        ;; Highlight selection
        (transient-mark-mode t)

        ;; make all "yes or no" prompts show "y or n" instead
        (fset 'yes-or-no-p 'y-or-n-p)

Changing the switching is worth it, but I really need to find something that allows me to <TAB> between different possibilities once completion is exhausted, e.g. if I say "foo.c" and have both "foo.c" and "foo.c.txt":

        ;; Switching
        (iswitchb-mode 1)
        (icomplete-mode 1)

I wish I could also turn off the annoying #-files, but they're hardcoded in Emacs's C code:

        ;; I use version control, don't annoy me with backup files everywhere
        (setq make-backup-files nil)
        (setq auto-save-default nil)

Better file selection:

        ;;; Electric minibuffer!
        ;;; When selecting a file to visit, // will mean / and
        ;;; ~ will mean $HOME regardless of preceding text.
        (setq file-name-shadow-tty-properties '(invisible t))
        (file-name-shadow-mode 1)

I didn't write this, but it's very useful. It emulates vim's sofftab feature. So indenting with spaces doesn't suck anymore.

        (defun backward-delete-whitespace-to-column ()
          "delete back to the previous column of whitespace, or just one
        char if that's not possible. This emulates vim's softtabs
        feature."
          (interactive)
          (if indent-tabs-mode
              (call-interactively 'backward-delete-char-untabify)
            ;; let's get to work
            (let ((movement (% (current-column) tab-width))
                  (p (point)))
              ;; brain freeze, should be easier to calculate goal
              (when (= movement 0) (setq movement tab-width))
              (if (save-excursion
                    (backward-char movement)
                    (string-match "^\\s-+$" (buffer-substring-no-properties (point) p)))
                  (delete-region (- p movement) p)
                (call-interactively 'backward-delete-char-untabify)))))

        (global-set-key (kbd "<DEL>") 'backward-delete-whitespace-to-column)

I _really_ wish I could find something for Emacs which _automatically_ detects the style of the code I'm editing and switches the coding style to that.

For libraries I use (eval-after-load) for everything and (autoload). It really speeds up startup.

ack is a much better M-x grep (needs ack.el):

        ;;;;; ack
        (defalias 'grep 'ack)

I have something to make swank work with clojure _and_ sbcl, but it's too large to include here. clojure-mode et al make it _really_ hard to do this, unfortunately (upstream isn't really interested in this use case):

        (defun run-clojure ()
          "Starts clojure in Slime"
          (interactive)
          (pre-slime)
          (slime 'clojure))

        (defun run-sbcl ()
          "Starts SBCL in Slime"
          (interactive)
          (pre-slime)
          (slime 'sbcl))

You should use nopaste.el (shameless plug): <http://github.com/avar/nopaste>

        ;;;;; nopaste.el
        (autoload 'nopaste "nopaste" nil t)

        (eval-after-load "nopaste"
          '(progn
             (setq nopaste-nickname "avar")
             (setq nopaste-channel  nil)
             (setq nopaste-description nil)))

        (global-set-key (kbd "C-c n p") 'nopaste)
        (global-set-key (kbd "C-c n y") 'nopaste-yank-url)

Here's how I still tolerate GMail and other web apps. I can click on any text field in Chrome and edit it in Emacs:

        ;;;;; Emacs Chrome edit server - http://wiki.github.com/stsquad/emacs_chrome/
        (when (getenv "DISPLAY")
          (require 'edit-server)
          (setq edit-server-new-frame nil)
          (add-hook 'edit-server-done-hook 'on-edit-server-done-do-backup)
          (edit-server-start))

And this has saved my many a time from losing web form content (I should really make this use Git):

        (defun on-edit-server-done-do-backup ()
          "Run when text is sent to Google Chrome. Do a backup of the
        stuff sent there in case something goes wrong, e.g. Chrome
        crashes."
          (let* ((backup-dir "~/._emacs_chrome-backup")
                (backup-file (format "%s.txt" (float-time)))
                (backup-path (concat backup-dir "/" backup-file)))
            (unless (file-directory-p backup-dir)
              (make-directory backup-dir))
            (write-region (point-min) (point-max) backup-path)))

Install browse-kill-ring.el _now_ :

        (global-set-key (kbd "C-c k") 'browse-kill-ring)

That's about it for the really interesting stuff. But there's a lot of other mundane stuff in there.

<comment><USER12> > I really wish I could find something for Emacs which automatically detects > the style of the code I'm editing and switches the coding style to that.

If it makes you feel any better, back when I was managing a team in Visual Studio, we called this the "When in Rome" feature. And yes, the versions of this we tried to put together worked as you'd expect... mostly. Determining peoples' whitespace decisions are not trivial. How many lines does the THEN clause of an IF need to have before you surround it with curlies? Do you only put a space before the parens around a function's arguments if there is more than one argument? And my personal favorite, how do you "funge" your indentation style if the nesting level gets high enough that you're at frequent risk of line wrap (soft or hard doesn't matter here)?

People have wacky rules, and as soon as you say you're going to auto-detect them, you're in for a world of pain. Of course, you might have a user base that isn't as persnickety, in which case it's really not that bad.

<comment><USER13> > How many lines does the THEN clause of an IF need to have before you > surround it with curlies?

If I'm your manager, 0.

</comment></comment></comment><comment><USER14> Custom key bindings

      ;; Makes editing without Paredit more convenient...
      ;; But if you're on linux, first prevent it from logging you out!
      (global-set-key [C-M-delete] 'backward-kill-sexp)
      (global-set-key [C-M-backspace] 'backward-kill-sexp)

      ;; Command key meta forever.
      (labels ((normal-mac-mods (&rest _) (setq ns-alternate-modifier 'none
                                                ns-command-modifier 'meta)))
        (add-hook 'after-make-frame-functions #'normal-mac-mods)
        (normal-mac-mods))

Aesthetics

      (setq-default ...

                    ;; Make the default buffer a little shinier... also, put
                    ;;   (message "Ready")
                    ;; at the end of the file

                    initial-major-mode 'text-mode
                    initial-scratch-message (concat "                  ···"
                                                    "--—=====   Welcome to Emacs"
                                                    "   =====—--···\n===---···"
                                                    "                 "
                                                    "···---</comment><comment></comment><comment>====---···"
                                                    "                ···---===\n\n")

</comment><comment><USER15> These are pretty minor, but I use them _constantly_ , and they're pretty self- contained.

        (global-set-key (kbd "C-=") 'switch-to-previous-buffer)
        (defun switch-to-previous-buffer ()
          (interactive)
          (switch-to-buffer (other-buffer)))

        (global-set-key (kbd "C-z") 'shell)

        (defun my-shell-mode-hook ()
          (local-set-key (kbd "C-z") 'bury-buffer))
        (add-hook 'shell-mode-hook 'my-shell-mode-hook)

</comment><comment><USER16> Between and during Emacs sessions, being able to view a list of my recently opened files via C-x C-r and then select and re-open them as needed.

        ;; recent files
        (require 'recentf)
        (recentf-mode 1)
        (setq recentf-max-menu-items 25)
        (global-set-key "\C-x\ \C-r" 'recentf-open-files)

<http://www.joegrossberg.com/archives/000182.html>

</comment><comment><USER17> Viper mode gives you the best of both worlds, although I'm probably considered a heretic in both religions.

      (setq viper-mode t)
      (require 'viper)

      (custom-set-variables
       '(column-number-mode t)
       '(inhibit-startup-screen t)
       '(show-paren-mode t)
       '(tool-bar-mode nil)
       '(menu-bar-mode nil))

I used to have slime config stuff in there, but now Ubuntu does it all for me. Thanks Ubuntu!

<comment><USER18> So _you're_ the other viper-mode user! We should have coffee sometime :)

<comment><USER19> He's not the only one. viper + vimpulse here.

<comment><USER20> Another Viper mode heretic here. 10 years of everyday vi (I started with elvis!) and then switching to emacs will do that. I use gtags and doxymacs pretty extensively too.

</comment></comment></comment></comment><comment><USER21> * Smex. This adds IDO completion to M-x. Can't live without it. <http://github.com/nonsequitur/smex/>

* Undo-tree. (<http://www.emacswiki.org/emacs/UndoTree>) Makes emacs undo useful.

This has been one of the most useful functions I've added to my .emacs:

       (defun xsteve-ido-choose-from-recentf ()
         "Use ido to select a recently opened file from the `recentf-list'"
         (interactive)
         (let ((home (expand-file-name (getenv "HOME"))))
           (find-file
            (ido-completing-read "Recentf open: "
                                 (mapcar (lambda (path)
                                           (replace-regexp-in-string home "~" path))
                                         recentf-list)
                                 nil t))))

       (global-set-key [(meta f11)] 'xsteve-ido-choose-from-recentf)

From: <http://www.xsteve.at/prg/emacs/power-user-tips.html>, which has a bunch of good tips/key bindings

</comment><comment><USER5> I went .emacs bankrupt this summer.

gist.el, powershell-mode, yaml-mode, org-mode are a few I've taken out for brevity.

Otherwise, a few of these are emacs23 specific:

      ;; syntax highlighting
      (global-font-lock-mode 1)

      ;; add .emacs.d to load path
      (setq load-path (cons "~/.emacs.d" load-path))

      ;; nethack
      (add-hook 'nethack-mode-hook (lambda () (linum-mode 'nil)))
      (setq load-path (cons "~/.emacs.d/nethack" load-path))
      (autoload 'nethack "nethack" "Play Nethack." t)
      (setq nethack-program "/opt/local/bin/nethack")

      ;; 4 spaces in objective-c
      (add-hook 'objc-mode-hook
                (lambda ()
                  (setq tab-width nil)
                  (setq c-basic-offset 4)))

      ;; straight to *scratch* buffer please
      (setq inhibit-splash-screen t)

      ;; use old navigation for line movement
      (setq line-move-visual nil)

      ;; linum mode
      (require 'linum)
      (global-linum-mode 1)
      (add-hook 'linum-before-numbering-hook
      	  (lambda () (setq linum-format "%d ")))

</comment><comment><USER22> I have my Emacs config here: <http://github.com/nileshk/emacs>

startup.el is the main starting point (I load that from my .emacs). Can't say it's the cleanest set of config files, but you might find something of use in it.

Some of the things I've configured:

\- Detect whether Emacs is running in OS X, Linux, Windows (native), or Cygwin; and I do platform-specific configuration when necessary

\- For OS X, I use fixpath.el to load my path by executing bash (I've tried various methods of doing this, and this was the most reliable)

\- For Windows, I have Powershell configured

\- I'm using guess-style ( <http://nschum.de/src/emacs/guess-style/> ): auto- detects indentation style.

\- I had a Clojure setup that was working nicely, but it's been a while since I used it and I need to update it for Clojure 1.2

\- ido-mode is great. I have some specific settings for that. For example, enabling ido-enable-flex-matching makes it easier to quickly match files

\- Backups go to ~/.emacs.d/backup instead of littering ~ files everywhere. The backup folder is created if necessary.

\- YASnippets. I've created some snippets of my own, such as for wikipedia- mode

\- I had problems using markdown-mode with YASnippets (both want to use the tab key), but was able to fix this. See my "eval-after-load 'markdown-mode" for this.

If you use YASnippet, I've taken Jeff Wheeler's Textmate-to-YASnippet conversion script and improved it here: <http://github.com/nileshk/snippet- copier> That also contains a Eclipse template to YASnippet convertor script I started on which kinda works, though not perfectly.

</comment><comment><USER23> From my customizations, these are the most I use:

Pressing Return starts a new line at column 0, pressing Control j starts a new indented line. I prefer them the other way round, so I rebind:

        (global-set-key "\r" 'newline-and-indent)
        (global-set-key "\C-j" 'newline)

Also, very often I need to start a new line above or below the current line. So instead of Control e, Return to start a new indented line below the current line I use Control Return.

        (defun next-newline-and-indent ()
          (interactive)
          (end-of-line)
          (newline-and-indent))
        (global-set-key [C-return] 'next-newline-and-indent)

And to start a new indented line above the current line, instead of Control a, Control o, Control i, I use Control Shift Return.

        (defun prev-newline-and-indent ()
          (interactive)
          (beginning-of-line)
          (open-line 1)
          (indent-according-to-mode))
        (global-set-key [C-S-return] 'prev-newline-and-indent)

</comment><comment><USER24> I have my own preferred color scheme, won't bore you. At bottom, it's GhostWhite on black.

I don't like tabs!

      ;; destroy all tabs
      (setq-default indent-tabs-mode nil)
      (defun untab-writable-non-makefiles-and-csv ()
       (if (and
            (not buffer-read-only)
            (not (loop for re in '("[Mm]akefile" "\\.mk" "\\.csv" "\\.txt")
                       if (string-match re buffer-file-name)
                       do (return t)
                       finally (return nil))))
           (untabify (point-min) (point-max))))
      (add-hook 'find-file-hook 'untab-writable-non-makefiles-and-csv)

Emacsclient is a real must.

      ;; use this to start server for emacsclient
      (if (not (boundp 'server-process))
         (server-start))

All my shells run inside of Emacs. So they're named, I get completions, and so on. That includes remote shells, using tramp and ssh-mode.

      ;; tramp mode...
      (setq load-path (cons "~/emacs/tramp" load-path))
      (require 'tramp)
      (setq tramp-default-method "ssh")

      ;; remote shell! Hooray!
      (require 'ssh)
      (add-hook 'ssh-mode-hook 'ssh-directory-tracking-mode)

Here's what I use for session.

      ;; back to emacswiki.org/emacs/DeskTop
      (setq *foo-desktop-dir* (expand-file-name "~/emacs/desktop"))
      (setq desktop-dir *foo-desktop-dir*)
      (setq desktop-path (list *foo-desktop-dir*))
      (desktop-save-mode 1) ;; Switch on desktop.el
      (setq *foo-desktop-file* (concatenate 'string desktop-dir
                                           "/" desktop-base-file-name))
      (setq *foo-desktop-lock* (concatenate 'string desktop-dir
                                           "/" desktop-base-lock-name))
      (defun desktop-in-use-p ()
       (and (file-exists-p *foo-desktop-file*) (file-exists-p *foo-desktop-lock*)))
      (defun autosave-desktop ()
       (if (desktop-in-use-p) (desktop-save-in-desktop-dir)))
      (add-hook 'auto-save-hook 'autosave-desktop)

</comment><comment><USER25> I use color-theme.el to manage, well, colour themes and use the twilight theme: [http://github.com/crafterm/twilight- emacs/blob/master/color-...](http://github.com/crafterm/twilight- emacs/blob/master/color-theme-twilight.el)

To mimic some of TextMate's functionality, I use:

1\. autopair.el: <http://www.emacswiki.org/emacs/AutoPairs>.

2\. yasnippet.el: <http://code.google.com/p/yasnippet/>

The latest version of Emacs for the MacOSX has an awesome fullscreen capability. I followed the instructions here: [http://www.sanityinc.com/full- screen-support-for-cocoa-emacs...](http://www.sanityinc.com/full-screen- support-for-cocoa-emacs-on-osx)

iswitchb-mode has awesome minibuffer completion capabilities. <http://www.emacswiki.org/emacs/IswitchBuffers>

</comment><comment><USER26> I try to keep it simple. I set my color theme, switch the font to Consolas, register some major modes (CMake, SLIME, haskell, org, etc), enable some of the disabled-by-default commands, and have some useful key bindings:

        ; I type this by mistake 80% of the time
        (global-unset-key (kbd "C-x C-c"))

        ; One of my favorite commands
        (global-set-key "\C-x\C-j" 'join-line)

        ; I haven't seen a keyboard with "copy" and "paste" buttons since 2008
        ; Honestly, Emacs' defaults, WTF
        (global-set-key (kbd "<f2>") 'clipboard-kill-ring-save)
        (global-set-key (kbd "<f3>") 'clipboard-yank)

</comment><comment><USER27> <http://github.com/ki/my-dot-emacs/raw/master/dot-emacs.txt>

plus

<http://lisp.pastebin.com/raw.php?i=MRbccMG4>

</comment><comment><USER28> <http://github.com/al3x/emacs>

</comment><comment><USER29> I actually did a huge re-organization of my .emacs file (including moving it to .emacs.d/init.el) a few months ago, dividing it into topic specific configuration files (general, files and buffers, programming, python-config, etc) and have support for loading different configurations depending on which machine I'm on.

<http://github.com/Nafai77/config/tree/master/HOME/_emacs.d/>

One of the next things I'm going to do is explore using el-get. It's always a pain moving to a new machine and having to download and checkout all of the third-party libraries I use.

</comment><comment><USER30> I use emacs mostly for LaTeX editing, so most of my .emacs sets up macros to make it easy to insert greek letters with a keystroke. (For some reason, I really hate using LaTeX macros to write shortcuts for these.)

<comment><USER31> You don't like LaTeX-math-mode (bound to C-c ~)?

</comment></comment><comment><USER32> Some tricks from my .emacs:

      (server-start)

      ;; no Tabs
      (setq-default indent-tabs-mode nil)
      (setq-default tabs-width 2)

      ;; List more buffers in the buffer menu
      (setq-default buffers-menu-max-size 30)

      ;; Prevent startup message and switch to empty *scratch*
      (setq inhibit-startup-message t)
      (setq initial-scratch-message nil)

      ;; Fix C&P
      (setq x-select-enable-clipboard t)

      ;; Make Caps Lock LED blink instead of audio bell
      (setq visible-bell 1)
      (setq ring-bell-function
            (lambda ()
              (when (getenv "DISPLAY")
                (call-process-shell-command "xset led named \"Scoll Lock\"; xset -led named \"Scroll Lock\"" nil 0 nil))))

      (show-paren-mode 1)
      (column-number-mode 1)

      ;; Keep the custom stuff separate
      (setq custom-file "~/.emacs.d/custom.el")
      (load custom-file)

      ;; I know what downcase-region does. Me no noob anymore ;). So undisable it.
      (put 'downcase-region 'disabled nil)

      ;; This can be a life saver!
      (push '("." . "~/.emacs.d/backups") backup-directory-alist)

      ;; Create better buffer names. foo.c++:src, foo.c++:extra instead of foo.c++ and foo.c++<2>
      ;; This should really be the default behaviour for Emacs!
      (require 'uniquify)
      (setq
        uniquify-buffer-name-style 'reverse
        uniquify-separator ":")

      ;; c-mode hook to set better default compile-command if no Makefile exists and activate flyspell-prog-mode
      ;; I have similar hooks for c-mode and fortran-mode
      (add-hook 'c++-mode-hook
              (lambda ()
                (flyspell-prog-mode)
                (unless (or (file-exists-p "Makefile")
                            (local-variable-p 'compile-command)
                            (not buffer-file-name))
                  (set (make-local-variable 'compile-command)
                       (format "%s %s %s"
                               (or (getenv "CXX") "g++")
                               (or (getenv "CXXFLAGS")
                                   "-pipe -std=c++0x -pedantic-errors -Wall -Wextra -Weffc++ -g3")
                               (file-name-nondirectory buffer-file-name))))))

      ;; Set f9 to compiler and f8 to make clean
      (global-set-key '[f9] 'compile)
      (global-set-key '[f8] '(lambda ()
                              (interactive)
                              (when (file-exists-p "Makefile") (compile "make clean"))))

The rest is just some specific mode setup and minor key bindings stuff.

</comment><comment><USER33> Paredit, slime, magit, org-mode, eshell, and erc.

The boring stuff is all in the Starter Kit: <http://github.com/technomancy/emacs-starter-kit>

<comment><USER34> Emacs Starter Kit allowed me to finally switch to Emacs last year. Thanks a lot technomancy!

I keep my customizations here: <http://github.com/dirceu/emacs-starter-kit>

</comment></comment><comment><USER35> several syntax highlighting stuff apart from standard ones, of course.

This is super useful to me:

        (global-set-key [f6] 'linum-mode)
        (global-set-key [f7] 'next-buffer)
        (global-set-key [f8] 'previous-buffer)

I also have yasnippet, but I don't really use it at all (I should). Also, recentf <http://www.emacswiki.org/cgi-bin/wiki/recentf-buffer.el> for a recently opened stuff (like dired, but for recent stuff).

And most importantly, I setup my font to monaco, tango color scheme and I prefer full screen emacs, so i have a bit of an involved process where I have basically this:

        (global-set-key [f11] 'ds-darkroom)
        (global-set-key [f12] 'menu-bar-mode)

where F11 puts me in and out of full screen mode and f12 toggles menu bar. F11 uses a small utility written in C# for windows to make this happen.

clean darkroom - <http://i.imgur.com/LloOY.png>

with menu - <http://i.imgur.com/yTeUz.png>

I'm trying for years to force myself not to move my right hand to arrows and instead use C-p C-n and C-b C-f, but I can't (well sometimes I do, but not all the time).

And various tweaks here and there, I might have forgotten something though.

</comment><comment><USER36> My .emacs: <http://edward.oconnor.cx/config/.emacs>

If you use Viper, this is the single nicest tip I have: <http://edward.oconnor.cx/2009/08/viper-tweaks>

Some tips on running a dedicated Emacs instance for Gnus: <http://edward.oconnor.cx/2010/08/standalone-gnus>

</comment><comment><USER19> my .emacs is on bitbucket: <https://bitbucket.org/zaphar/dotfiles/src/tip/.emacs.d/>

Some notable items:

        ;;; allow seperating out the config stuff to
        ;;; into different files
        (defvar jaw:config-dir (expand-file-name "~/.emacs.d/conf.d")
          "My config parts directory location.")

        (defun jaw:load-confs ()
         "Load Jeremy's config file parts"
         (let ((files (sort (directory-files jaw:config-dir) 'string<)))
           (while files
             (setq file (car files)
                   files (cdr files))
             (cond ((string-match ".*\.#[^/]+\.el$" file)
                    nil)
                   ((string-match ".*\.elc?$" file)
                    (load-file (concat jaw:config-dir "/" file)))))))

        (jaw:load-confs)

Automatically installing elpa packages to bootstrap a new emacs system: [https://bitbucket.org/zaphar/dotfiles/src/tip/.emacs.d/conf....](https://bitbucket.org/zaphar/dotfiles/src/tip/.emacs.d/conf.d/001-my- packages.el)

</comment><comment><USER37> My kit is on github: <http://github.com/apgwoz/emacs-config>

My favorite new thing is my thumb-through: <http://github.com/apgwoz/thumb- through>, which allows me to easily read articles from irc (i use rcirc) without leaving emacs, or loading up w3m-mode.

</comment><comment><USER38> Previously: <http://news.ycombinator.com/item?id=855963>

</comment><comment><USER39>
      ;; don't sleep emacs accidentally
      (global-set-key [(control z)] nil)

      ;; shortcut buffer navigation
      (global-set-key [f5] 'previous-buffer)
      (global-set-key [f8] 'next-buffer)

      ;; show columns by default
      (column-number-mode)

      ;; stop the blinking
      (blink-cursor-mode nil)

and reams of macros

</comment><comment><USER40> I have a lot of stuff in there. Most notably, I use tabbar and my own custom textpad-mode, which makes the cursor move around in the same way that textpad (A windows text editor) does it.

Linky: <http://github.com/troelskn/troelskn-emacs>

</comment><comment><USER41> I can't live without:

\- IDO

\- Smex

\- (Enhanced) project-root.el ( <http://piranha.org.ua/project-root/> ) and its project-root-find-file function.

(and my modular configuration is here: <http://github.com/lvillani/.emacs.d>)

</comment><comment><USER42> (setq make-backup-files nil)

(setq slime-lisp-implementations '((ccl ("/usr/local/ccl/dx86cl64")) (sbcl ("/usr/local/bin/sbcl")))) (add-to-list 'load-path "/usr/local/slime/") (require 'slime) (slime-setup '(slime-repl slime-banner))

</comment><comment><USER43> I used to have more, but I have since streamlined...

My entire .emacs file:

(defun sbcl ()

      (show-paren-mode)

      (setq inferior-lisp-program "sbcl")

      (add-to-list 'load-path "~/emacs/slime")

      (require 'slime)

      (slime-setup))

(sbcl)

</comment><comment><USER44> Handy if you're viewing a live log file and want to see what's been appended since the last time you've opened it:

(defun force-revert-buffer () (interactive) (revert-buffer t t))

(define-key global-map "\C-cr" 'force-revert-buffer)

</comment><comment><USER45> Thanks for this post and everyone's links. I'm just considering a return to Emacs after a run-in with RSI and several years wandering in the TextMate forest. This is very helpful.

</comment><comment><USER46> a lot of things, 1376 lines @ <http://github.com/cycojesus/emacs>

It uses org-babel to keep it organized and readable so really there's a short wrapper init.el that then calls babel-init.org

External packages are installed system-wide using my own .SlackBuild generated packages (@ <http://github.com/cycojesus/slackbuilds/tree/master/e/> )

Of course I run Slackware.

</comment><comment><USER47> org-mode.

</comment><comment><USER48> <http://gist.github.com/561519>

textmate.el is pretty awesome, as is ide-skel.

</comment><comment><USER13> can't go wrong with paredit or the emacs client/server (google them)

</comment><comment><USER49> for anyone who uses erc on emacs 23 and gets the weird "selecting deleted buffer" error, adding

      (setq Buffer-menu-use-frame-buffer-list nil)

makes it work.

</comment><comment><USER50> any .emacs for php/Mysql/html/css/js ?

<comment><USER51>
        (require 'zencoding-mode)
        (add-hook 'sgml-mode-hook 'zencoding-mode)

<http://www.emacswiki.org/emacs/ZenCoding>

</comment></comment><comment><USER52>
      ;; move along, nothing to see here :P
      ;; the beef is in ~/.vimrc and under ~/.vim/ ;)</comment>


Tech and ad giants sign up to Europe's first weak bite at 'fake news' - <AUTHOR> https://techcrunch.com/2018/09/26/tech-and-ad-giants-sign-up-to-europes-first-weak-bite-at-fake-news/ <comment><AUTHOR> The press release from the European Commission: [http://europa.eu/rapid/press- release_STATEMENT-18-5914_en.ht...](http://europa.eu/rapid/press- release_STATEMENT-18-5914_en.htm)</comment>


90% of Bitcoin's value could get wiped out, Wall Street veteran Peter Boockvar - <AUTHOR> https://www.cnbc.com/2018/01/19/bitcoin-could-lose-90-percent-of-its-value-wall-st-veteran-boockvar-warns.html <comment><USER2> He is not the first "Wall Street veteran" to predict a Bitcoin crash. This is all the same speech for 4 years. They will keep on saying the same, even when the bitcoin will be priced at 40K dollars...

<comment><AUTHOR> good luck with that...</comment></comment>


Write Your Own Virtual Machine - <AUTHOR> https://justinmeiners.github.io/lc3-vm/ <comment><USER2> One of my favorite techniques for implementing VMs is the "computed goto":

[https://eli.thegreenplace.net/2012/07/12/computed-goto- for-e...](https://eli.thegreenplace.net/2012/07/12/computed-goto-for- efficient-dispatch-tables)

Consider this example for dispatching instructions from the article:

        while (running)
        {
            uint16_t op = mem_read(reg[R_PC]++) >> 12;

            switch (op)
            {
                case OP_ADD:
                    {ADD, 6}
                    break;
                case OP_AND:
                    {AND, 7}
                    break;
                case OP_NOT:
                    {NOT, 7}
                    break;
                case OP_BR:
                    {BR, 7}
                    break;
                ...
            }
        }

That code has a lot of branching. The _switch_ statement has to jump to the corresponding _case_ , the _break_ statement branches to the bottom, and then there is third branch to get back to the top of the _while_ loop. Three branches just to hit one instruction.

Now imagine we had written the above as:

        static void* dispatch_table[] = { &&OP_ADD, &&OP_AND, &&OP_NOT, &&OP_BR,
                                          ... };
        #define DISPATCH() goto *dispatch_table[memory[reg[R_PC]++] >> 12]

        DISPATCH();

        OP_ADD:
            {ADD, 6}
            DISPATCH();
        OP_AND:
            {AND, 7}
            DISPATCH();
        OP_NOT:
            {NOT, 7}
            DISPATCH();
        OP_BR:
            {BR, 7}
            DISPATCH();
        ...

Now there is only one branch per instruction. The handler for each instruction directly jumps to the next location via the _goto_. There is no need to be in an explicit loop because the interpreter runs until it hits a halting instruction.

Many VMs now use this technique, including the canonical Ruby and Python interpreters.

<comment><USER3> For the longest time, I swore by computed goto as well. But it has its share of problems; it's not very portable; it forces the code into a rigid, non- extendable format; and it's not as efficient as commonly assumed. I'm far from the first person to notice [0], so don't bother shooting the messenger.

My latest project [1] simply calls into a struct via a function pointer for each instruction. With a twist. Since it returns the pointer to the next operation and uses longjmp to stop the program, which means I can get away without lookups and without a loop condition. And as an added bonus the code is much nicer to deal with and more extendable, since the set of operations isn't hardcoded any more.

Comparing language performance is tricky business, but it mostly runs faster than Python3 from my tests so far. My point is that computed goto is not the end of the story.

I'll just add that there are many different ways to write a VM; the one posted here is very low level, the one linked below reasonably high level. Using physical CPUs as inspiration is all good, but there's nothing gained from pretending in itself unless you're compiling to native code at some point.

[0] [http://www.emulators.com/docs/nx25_nostradamus.htm](http://www.emulators.com/docs/nx25_nostradamus.htm)

[1] [https://gitlab.com/sifoo/snigl](https://gitlab.com/sifoo/snigl)

<comment><USER4> > so don't bother shooting the messenger

OK, let's shoot the original source: It only found that a certain unnamed version of GCC ten years ago performed tail merging, which does indeed defeat the purpose of the optimization. Without the author bothering to turn off tail merging in this case (as Python does), this doesn't mean much.

> Comparing language performance is tricky business, but it mostly runs faster > than Python3 from my tests so far.

Presumably you not only have a different interpretation approach, but also a different object model, approach to boxing numbers, and garbage collector. "Tricky business" is a bit of an understatement ;-)

<comment><USER3> Better him than me. I wouldn't be so quick to dismiss relevant coding experience, it doesn't get old. Much of his reasoning about locality still holds, to an even greater degree today.

I've implemented more or less the same interpreter using computed goto and various variations on dispatch loops; and this is the fastest solution I've managed to come up with, and the nicest code to work with. Still too many parameters, my point is that I have plenty of experience pointing in that direction which is better than nothing. It's not a mystery to me. Using computed goto will involve some kind of lookup to get the relevant labels, I'm using pointers to actual instructions as jump targets. And since I'm longjmp'ing out, which means I don't need a loop condition; the loop is reduced to a single regular goto.

Like I said, better than nothing. There is no such thing as perfection in this world. I've spent quite some time [0] micro benchmarking different features to get a fair comparison.

[0] [https://gitlab.com/sifoo/snigl/tree/master/bench](https://gitlab.com/sifoo/snigl/tree/master/bench)

<comment><USER4> Oh, I wasn't dismissing experience in general, nor was I questioning your experiences. I would love to see your numbers on the different dispatch methods you tried.

I was only questioning that one blog post you linked that lazily said (paraphrasing) "computed-goto dispatch will be undone by the compiler, so don't bother". Others have posted numbers in this thread ([https://news.ycombinator.com/item?id=18679477](https://news.ycombinator.com/item?id=18679477)) showing that this information is at best outdated.

<comment><USER3> No harm done; I don't do pride any more, it kept getting in the way of truth. But there's a clear tendency, especially on HN if you ask me; to blindly trust research by whatever authority and beat people over the head with so called best practices; while completely disregarding personal experience.

Sometimes the reason no one finds a better solution for a long time is that no one believes it's possible. Let's say it's 50/50, believing it's possible is still the superior alternative.

I have no idea what Python uses for regular dispatch; the linked thread just says that their computed goto solution is faster, which comes as no surprise given that was the reason they switched.

I posted the link since I learnt a lot from it, and since it echoes my own experience.

</comment></comment></comment></comment></comment></comment><comment><USER5> I once implemented a VM in Ada and just used a large switch. I extensively benchmarked it and it was blazingly fast at -O3.

However, it was only fast when I used packages very sparingly. In contrast to the usual advice given in the Ada community, splitting up the implementation into several packages slowed down the main loop tremendously. I suspect this wouldn't happen with whole-program optimization in C, but believe that the version of gcc I was using didn't support that for Ada. Also, my Green Threads were slower than a single thread, no matter which tricks I tried.

It's an abandoned project now, since the accompanying assembler was hacked together in Racket and at some point I simply lost track of what was going on where :O

<comment><USER6> Object Pascal (Delphi) also optimizes case statements, depending upon the nature of the statement:

[https://stackoverflow.com/a/2548425](https://stackoverflow.com/a/2548425)

I tested this recently (Delphi XE6), and it definitely is as-described: you get straight jump instructions with enough case statement branches, and it is very fast.

Barry Kelly worked on the Delphi compiler, and I believe he comments here on Hacker News occasionally.

<comment><USER7> > you get straight jump instructions with enough case statement branches, and > it is very fast

That's what pretty much any half-decent compiler does nowadays. It'd be much more surprising if it didn't.

<comment><USER6> The interesting part to me was the variations in the emitted instructions, based upon the source. IOW, it would be easy to mistakenly think that you _weren 't_ going to get jumps if you only used a few case branches to test things out.

</comment></comment></comment></comment><comment><USER8> I love these kinds of tutorials, and really any tutorial that makes me think of stuff that was previously "magic" and makes me feel stupid for not previously understanding it after I read it (I honestly mean that in a positive way).

This will be a fun weekend project for me...I have had an idea of a lambda- calculus-based VM that I've wanted to build for a few months ago, and I think this will be a good start for me to understand it.

</comment><comment><USER9> I like this tutorial but it should be mentioned that before implementing a virtual machine one should understand that there are many computing models and many alternative mechanisms within each of them. Implementing VM for sequential program execution is relatively easy. What is more (conceptually) difficult is concurrency, asynchronous processes etc.

<comment><USER10> > What is more (conceptually) difficult is concurrency, asynchronous processes > etc.

Know any good resources for these?

<comment><USER3> My own baby, Snigl [0], does always-on cooperative concurrency and asynchronous IO.

Just ask if you need help finding your way around.

[https://gitlab.com/sifoo/snigl](https://gitlab.com/sifoo/snigl)

<comment><USER10> Thank you. I'll check it out over the holidays.

</comment></comment></comment></comment><comment><USER11> I agree it's a great exercise. Years ago I added a very simple stack-based VM to my raytracer to allow procedural textures & normal maps. The scene script would e.g. contain a material description like this:

      material {
          diffuse rgb = [0, 0, 1] * (1-(0.5+0.5*noise(x*0.000002, y*0.000002, z*0.000002, 0.66, 2))) + [1, 1, 1] * (0.5+0.5*noise(x*0.000002, y*0.000002, z*0.000002, 0.66, 2));
      }

i.e. an expression with 3-vectors and scalars and a few basic functions (noise, sin/cos, etc.). This can be easily "compiled" (during script parsing) for execution on the VM. Then the overhead during actual raytracing was quite small.

<comment><USER12> I don't suppose you have code or examples lying around? I'd love to see what you were trying to achieve, the results you had, and the code.

If you're comfortable sharing, that is.

<comment><USER11> I still have the code (old and ugly, so not on GitHub; but it still builds and works) and examples. Let me know where I should send it.

<comment><USER12> My email is in my profile.

<comment><USER11> Is it publicly visible? At the moment in your profile I can only see "about", submissions, comments, favorites.

<comment><USER12> Guess not. Huh. I added it to my 'about' block.

</comment></comment></comment></comment></comment></comment><comment><USER13> Off-topic.

Does anyone know how I can convert AST into stream of bytecodes? Are there any good example language implementations to learn?

<comment><USER14> A little tangential, but check out "Prolog as Description and Implementation Language in Computer Science Teaching"by Henning Christiansen

[http://www.ep.liu.se/ecp/012/004/ecp012004.pdf](http://www.ep.liu.se/ecp/012/004/ecp012004.pdf)

> ... Definitional interpreters, compilers, and other models of computation > are defined in a systematic way as Prolog programs, and as a result, formal > descriptions become running prototypes that can be tested and modified ... > These programs can be extended in straightforward ways into tools such as > analyzers, tracers and debuggers.

Also "Logic Programming and Compiler Writing" By David Warren (and the work that followed on.)

</comment></comment><comment><USER15> Ok,here is mine [https://github.com/wenerme/bbvm](https://github.com/wenerme/bbvm)

Writing a VM is very fun and addictive. Especially writing in different language can learn a lot!

</comment><comment><USER16> Great site

</comment><comment><USER17> This was a great piece, but I found it funny that there's a bug in the very first line of code mentioned:

        /* 65536 locations */
        uint16_t memory[UINT16_MAX];

Spot the leak.</comment>


The Art of Lisp and Writing (2003) - <AUTHOR> http://dreamsongs.com/ArtOfLisp.html

<comment><AUTHOR> Choice quotes:

"Lisp is a medium for working with a computation until it is in balance with its external and internal requirements. At that point it can be decorated with performance-enhancing declarations and perhaps additionally modularized. In this it is more like an artist's medium than what many think of as a programming language."

"Writing a beautiful text takes sitting before a medium that one can revise easily, and allowing a combination of flow and revision to take place as the outlines and then the details of the piece come into view. Changes are made as features of the writing emerge—first the noise, then the sense, the force, and then the meaning—and the work of the writer is to continually improve the work until it represents the best words in the best order. Great writing is never accomplished through planning followed by implementation in words, because the nature of the word choices, phrasings, sentence structures, paragraph structures, and narrative structures interact in ways that depend of each other, and the only possible plan that can be made with which a writer can "reason" about the piece is the piece itself."

"The difference between Lisp and Java, as Paul Graham has pointed out, is that Lisp is for working with computational ideas and expression, whereas Java is for expressing completed programs. As James [Gosling] says, Java requires you to pin down decisions early on. And once pinned down, the system which is the set of type declarations, the compiler, and the runtime system make it as hard as it can for you to change those assumptions, on the assumption that all such changes are mistakes you're inadvertently making. There are, of course, many situations when making change more difficult is the best thing to do: Once a program is perfected, for example, or when it is put into light-maintenance mode. But when we are exploring what to create given a trigger or other impetus—when we are in flow—we need to change things frequently, even while we want the system to be robust in the face of such changes."

<comment><USER3> As someone who writes academically and writes code in the form of research prototypes, I really have to disagree to some extent with RPG and PG. Code is code, it doesn't have to be elegant, it doesn't have to be read, and using a less elegant language (like say C#) can be liberating compared to one where more elegance is possible (say Scala). The architecture you are working on floats around in your head regardless, becoming more beautiful, and the language that it is expressed in is just a detail...it is easy enough to throw the code away and start again once it becomes too unwieldy and you need to take your design to the next level.

But then RPG also wrote "worse is better."

<comment><USER4> > As someone who writes academically [...] code [...] doesn't have to be read > [...] it is easy enough to throw the code away and start again

That pretty much sums up the difference between academia and the so called "real world".

<comment><USER5> Yet LISP has much less traction in the real world than it does in academia.

<comment><USER6> not really

</comment></comment></comment></comment></comment><comment><USER7> "Lisp is the language of loveliness. With it a great programmer can make a beautiful, operating thing, a thing organically created and formed through the interaction of a programmer/artist and a medium of expression that happens to execute on a computer."

It's this kind of statement that makes me suspect Lisp is not very practical. I'm not programming for the sake of programming to create something that "happens to execute on a computer." There are other artistic endeavors for my free time that are more interesting than a lovely computer language.

<comment><AUTHOR> That's like saying that a walker allows you to traverse a floor more "practically" than dancing.

<comment><USER7> So in your estimation all other computer languages are walkers compared to the beautiful dance of Lisp? I'm curious, maybe I really do need to learn Lisp.

<comment><AUTHOR> That is my estimation. If you don't need performance or macros, Python and Ruby may give you a similar development experience. However, neither of those languages AFAIK allows you to redefine (let alone recompile to native code) functions at runtime.

<comment><USER8> Ruby is an extremely dynamic language, where you can redefine almost anything at runtime:

      def f()
        puts "f1"
      end

      f()

      if true
        def f()
          puts "true"
        end
      else
        def f()
          puts "false"
        end
      end

      f()

This outputs:

      f1
      true

As for native code, apparently MacRuby [1] compiles to native code, although I've never used it, so I don't know the details of that claim.

Can you give an example where redefining a function at runtime is a useful feature to have? I don't mean this as a challenge, I'm just curious. I like the extreme flexibility that dynamic languages provide, but it seems like the most dynamic features are mainly useful for library writers.

[1] [http://stackoverflow.com/questions/1972388/is-it-possible- to...](http://stackoverflow.com/questions/1972388/is-it-possible-to-compile- ruby-to-byte-code-as-with-python)

<comment><USER9> I don't think this is what enduser means. Lisp is the only language i know of where you can run a function such as

      (defun foo ()
        (progn (format t "~a~%" (read-line))
               (foo)))

and then, while it is recursing, change the function to

      (defun foo ()
        (progn (format t "~a and john~%" (read-line))
               (foo)))

recompile it, and have the behavior of your program change, _while it is running_. This is part of what makes lisp excellent for rapid prototyping. I'd give more examples, but I'm lazy, and it's been properly described elsewhere.

<comment><USER10> Seems pretty simple to me in Ruby.

      $ irb
      >> def go
       >   puts "what"
       >   debugger
       >   go
       > end
      >> go
      "what"
      # stops on debugger line
      >> Object.module_eval "def go; puts 'wat'; end"
      >> continue
      "wat"

There are of course other ways to do that, I just picked a simple one. You can break at lines / statements in files, so you don't need to include that "debugger" line. You can do something other than Object.module_eval. You can use something like Pry that would make this simpler and give you in-line source code, even after editing (IIRC). You can use something like Hijack to modify any running Ruby process - when you disconnect, your modified code will still be running.

Lisp _is not special_ in what it is capable of. Period. It's special because a) it's very old, and b) it's _tuned_ for these features, in its own unique, minimalistic way.

Yes, not all languages can do this (though you can do crazy things with GDB / debuggers in general, including using it as a REPL for compiled languages (really! it's not hard!)). But Lisp / the Lisp family are _not even remotely_ the only ones which can.

<comment><USER9> That is indeed very handy, but I would argue that there's a difference between running a program in a debugger and running it normally.

With regards to the rest of your post: macros and data-as-code.

Have you read this [http://www.paulgraham.com/diff.html](http://www.paulgraham.com/diff.html) ?

<comment><USER10> "What _Made_ Lisp Different" \- all true. All intended as past tense. I never see claims that Lisp is unique because it has GC, for instance.

Looking at the 'setf' macro, since you have to use 'defsetf', I don't see the difference between that and something in Ruby where you could do (errors aside):

      class Object
        def defsetf(name)
          $setf[self.class] = name
        end
      end
      def setf(class, *args)
        class.send($setf[class], *args)
      end
      class Whatever
        defsetf :set_something
        def set_something; end
      end

      # elsewhere...
      setf Whatever, instance, value

Adding arbitrarily-complex ways to let you specify how to transform the arguments to a call is as easy as accepting a lambda instead of a symbol, recursive setf-ing[1] is just a lookup on the arguments and then nesting lambdas. I might be missing some deeper realization here though - <USER2> seems pretty simple. Certainly the _use_ could be complex, but I see nothing that implies that its _implementation_ is unachievable, even with nearly- identical syntax, so what remains is library support and community. Again - specialization, not unique attribute of the language.

As to "data-as-code", I think you mean the other way around? If not, eval. If yes, Ruby's reflection is I think insufficient without heavy modification like e.g. running a ruby interpreter in ruby to read its own source code and "reflect" with the AST that generates (though this is possible[2]). This is one spot where Lisp-likes certainly _excel_ to a degree few outsiders achieve, but I'm sure I've seen outsiders, they're just not as fluent or efficient at running it. But few outsiders have real interest in optimizing it, or people label them as yet another Lisp-like, making the point sort of moot since it's part of the definition of being Lisp-like (to many).

\--

Macros in particular come up often, but I don't see anything really interesting about them. If you have the full AST available (a rarity, I'll admit), then it seems like a strict subset of runtime modification - it's just a self-eliminating runtime modification, done ahead of time for speed purposes. Except for maybe C-style macros, which (via a horrible syntax) can generate _anything_ , not just valid code, which isn't always possible.

[1]: (setf (sqrt something) number) => (set-sqrt something number) => (setf something (* number number)) in here: [http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.h...](http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.html) found via here: [http://stackoverflow.com/questions/267862/what-makes-lisp- ma...](http://stackoverflow.com/questions/267862/what-makes-lisp-macros-so- special)

[2]: [https://www.ruby-forum.com/topic/1108988](https://www.ruby- forum.com/topic/1108988)

<comment><USER6> > Macros in particular come up often, but I don't see anything really > interesting about them.

Well, the experience of most advanced Lisp uses is totally different.

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER11> _Ignorance more frequently begets confidence than does knowledge._ such a good summary of Java (and now Javascript) madness.)</comment>