Live data from Hacker News

Emacs 24.4 RC 1

lists.gnu.org

51–60 of 71 posts

Re: Emacs 24.4 RC 1

#51

Earlier quoted context omitted.

Just curious. How did you manage to use both emacs and vim? I've seen that people accustomed to one editor are usually averse to using the other.

Personally, I started out using Emacs because I wasn't a big fan of the "modal" style of vi (insert/command mode). Later on, I started pair programming in shared GNU Screen sessions, in which we ran vim; a pile of "how did you make that change so quickly" questions later, and I ended up switching to vim for the speed of basic text editing tasks, which save more time than I lose by not having as many high-level mode-s…

' "how did you make that change so quickly" questions later, and I ended up switching to vim"'

Heh... what a perfectly beautiful little invitation to a flame-war. If it was about 5 years ago, I would have fallen for it in a minute ;-)

Re: Emacs 24.4 RC 1

#52
post #34

Earlier quoted context omitted.

If you are a Unix user, you almost need to know enough vi to edit a simple file. crontab -e is considered a minor sin in the Church of Emacs, but only a minor one. ESC:q!

export EDITOR=emacs Then crontab -e will start emacs instead of vi.

You are absolutely right. Especially if we are talking about BSD or Unix proper. But, there is a cognitive load to remembering what machine you are on, or if certain variables have been set and so on.

I have been on machines that fire up nano with crontab -e, in the name of user friendliness. These same machines will not respect EDITOR or VISUAL anyway, so I have no idea what to do about them. I usually just get up and creep away making sure not to turn my back on them.

Re: Emacs 24.4 RC 1

#53
Cool updates! is it bad that I still try my best to avoid emacs ? One of my professors loved it, and it just ruined my ideal text editing environment.

Re: Emacs 24.4 RC 1

#54

Earlier quoted context omitted.

Slime is really amazing. It provides tons of features of which here are a few (these work with Common Lisp, I have no clue if they work with Clojure). Inspector[0]: You can click on objects to "inspect" their values. This includes hash-tables, arrays, and closures. In addition you can execute arbitrary code on these objects at any time, even while a program is running. Trace Dialog[1]: Most Lisp implementations alrea…

Restarts are feature of Common Lisp, for which SLIME only draws a powerful interface. Your ability to return a value/retry a call from a given stack frame is just a bunch of default restarts of your CL implementation. What is really awesome is that you can add your own restarts to the interactive debugger . Or have them execute automatically. I recommend those who are not familiar with conditions/restarts to read up…

> Your ability to return a value/retry a call from a given stack frame is just a bunch of default restarts of your CL implementation.

Almost. Restarts and value/retry on a stack frame are mostly unrelated - Restarts are only the UI for implementation specific features. Common Lisp provides no feature to retry an arbitrary stack frame. This is all implementation specific functionality provided by SOME implementations.

Re: Emacs 24.4 RC 1

#55

I recently discovered that elisp is dynamically scoped as opposed to lexically scoped. Out of curiosity (as I've never programmed in a dynamically scoped language) hows the experience of working in such language?

Having spent a lot of time with Haskell and Scheme, what irks me the most about working in Emacs Lisp is the fact that it usually involves too much rigamarole or just fails to work for me to use a function that takes a function as an argument or returns a function as a result. E.g., in Haskell, I am fond of using `flip` to reverse two actual arguments just because it makes a line or 3 of code look nicer, and I cannot do that in Emacs Lisp -- or I can, but it involves adding additional lambda forms or calls to funcall or symbol-function (i.e., it involves too much rigamorole).

Since I cannot say exactly how far lexical scoping would go in making Emacs Lisp more like Haskell in this regard, this is only a partial answer to your question, but certainly, the lack of lexical scope has something to do with it.

Aside from the deficiencies I just mentioned around higher-order functions, I was surprised by how little the lack of lexical scope got in my way. (My reading of the computer-science literature had given me the impression it would cause more trouble than it actually does.)

Re: Emacs 24.4 RC 1

#56

I recently discovered that elisp is dynamically scoped as opposed to lexically scoped. Out of curiosity (as I've never programmed in a dynamically scoped language) hows the experience of working in such language?

Fwiw, you can lexically scope it now if you want. The default is still dynamic scoping to avoid breaking backwards compatibility, but you can enable lexical scoping for your own code: https://www.gnu.org/software/emacs/manual/html_node/elisp/Le...

Re: Emacs 24.4 RC 1

#57

Earlier quoted context omitted.

Just curious. How did you manage to use both emacs and vim? I've seen that people accustomed to one editor are usually averse to using the other.

> I've seen that people accustomed to one editor are usually averse to using the other. I think this is more a meme than necessarily a reality - you'll tend to see a lot more comments online from people who think the old joke is funny or who want to validate their own choice than from people who don't care or have tried both without such strong feelings. In reality, there's really no barrier to 'manage' to use both e…

I'd sign that. I never use emacs, because I never trained it, but I sometimes use it at a friends machine.

It's nothing I find bad or not understandable. All errors stem directly from my lack of skill. (and the different key layout of most of my colleagues)

Re: Emacs 24.4 RC 1

#58

I recently discovered that elisp is dynamically scoped as opposed to lexically scoped. Out of curiosity (as I've never programmed in a dynamically scoped language) hows the experience of working in such language?

Having spent a lot of time with Haskell and Scheme, what irks me the most about working in Emacs Lisp is the fact that it usually involves too much rigamarole or just fails to work for me to use a function that takes a function as an argument or returns a function as a result. E.g., in Haskell, I am fond of using `flip` to reverse two actual arguments just because it makes a line or 3 of code look nicer, and I cannot…

Elisp is not Scheme and certainly is not Haskell. You shouldn't - and I'd say it a good general rule - judge Elisp based on what it's not instead of what it is.

Getting back to actual question: Elisp supports "real" lexical scoping since previous major Emacs version, and it has had "lexical-let" and other such forms since forever, but most of the code is still dynamically scoped. In practical terms it's similar to having every variable declared as global - it allows for "out of band" communication (outside of arguments passed/value returned) between routines. This is sometimes handy if you want to change some function behaviour in a way that it didn't think of (ie. it has no argument dedicated for this). As a very contrived example, if you have a routine which beeps furiously every time you invoke it and you find it unbearable (I did) you can instead call it like this:

    (letf
        (((symbol-function 'beep) (lambda ())))
      (beeping-function))
And it won't beep any more. A real life saver sometimes ;)

On the other hand, every out-of-band communication has a set of problems to it: you can forget to check it, or you can accidentally pass something to a called function you didn't want to. In practice this is worked around with using longer, prefixed identifiers and the semantics of `let`. As long as every variable your function uses is let-bound inside it it is essentially safe to call with any kind of environment, as it won't ever look at it. Most functions are like that.

In short, dynamic scoping has it's advantages and drawbacks, and it feels quite well suited to an extension/scripting language of an app. It makes certain patterns easy enough that they don't even need a name ("monkey patching"), and it makes others much harder (like the linked dash-functional library, which would be very hard to write without lexical-scoping: t).

Re: Emacs 24.4 RC 1

#59

Earlier quoted context omitted.

Having spent a lot of time with Haskell and Scheme, what irks me the most about working in Emacs Lisp is the fact that it usually involves too much rigamarole or just fails to work for me to use a function that takes a function as an argument or returns a function as a result. E.g., in Haskell, I am fond of using `flip` to reverse two actual arguments just because it makes a line or 3 of code look nicer, and I cannot…

Elisp is not Scheme and certainly is not Haskell. You shouldn't - and I'd say it a good general rule - judge Elisp based on what it's not instead of what it is. Getting back to actual question: Elisp supports "real" lexical scoping since previous major Emacs version, and it has had "lexical-let" and other such forms since forever, but most of the code is still dynamically scoped. In practical terms it's similar to ha…

Your code fails to suppress beeping behavior on my Mac for certain values of beeping-function. In particular, when I eval the following, I get a beep.

  (require 'cl)

  (setq lexical-binding nil)

  (defun beeping-function ()
      (save-excursion
          (set-buffer "*Messages*")
          (goto-char (point-max))
          (scroll-up)))

  (letf (((symbol-function 'beep) (lambda ())))
      (beeping-function))
I tried to repair it: I ran the code in a fresh Emacs session to which my usual customizations in .emacs had not been applied. I set lexical-binding to t. Since beep is an alias for ding, I replaced beep with ding. I rewrote the letf as a cl-flet.

I think that the fact that scroll-up is built-in is pertinent: there was another incident in the recent past in which the function whose binding I wanted to override ("shadow"?) is called from a built-in function and in which my attempt to use cl-flet to override the binding failed.

If you have Emacs running on a Windows or Linux machine, I would like to know whether the above code causes a beep on that machine. I would like to know because in the past, code that gets a little tricky about bindings that worked on my friend's Windows box failed to work on my Mac (even with an up-to-date Emacs).

ADDED: Actually, let me show you the code that "worked" (i.e., behaved like someone familiar with Scheme or Haskell would expect modulo the trivial "rigamarole" of needing to use funcall) on my friend's Windows box but not on my Mac. The error is "(void-variable a)".

  (funcall
      (funcall
          (lambda (a) (lambda (b) a))
          1)
      2)

Re: Emacs 24.4 RC 1

#60
post #4

As someone who uses emacs purely for clojure/lisp and vim for everything else, the biggest feature for me is the fact that this will be the first version of emacs to support menus in terminal mode . So for all the commands you don't remember, a menu is now a click or F10 away. To quote, "Emacs now supports menus on text-mode terminals. If the terminal supports a mouse, clicking on the menu bar, or on sensitive portio…

I hope this terminal mouse business is easy to disable. If I wanted mouse clicks to be registered by emacs, I wouldn't insist on installing emacs-nox versions in the first place.
Post reply on HN