
Emacs 24.4 RC 1 - Xyzodiac
http://lists.gnu.org/archive/html/info-gnu-emacs/2014-10/msg00001.html
======
viksit
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 portions of the mode line or
header line, will drop down the menu defined at that position."

More at: [http://www.masteringemacs.org/article/whats-new-in-
emacs-24-...](http://www.masteringemacs.org/article/whats-new-in-emacs-24-4)

~~~
linuxfan
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.

~~~
viksit
Hehe because I don't subscribe to monotheism? ;) I prefer vim's modal editing
mode and have been using it as my primary for as long as I can remember. For
clojure/lisp, I found that the vim tooling was just not as elegant/efficient
as emacs (fireside et al arent as nice as cider/swank), and decided to learn
how to use it. It's not that much of an "antipattern" because the keymaps are
very different. I don't like using vim mode within emacs either - for some
reason I find myself thinking in emacs mode when editing lisps. I do think
that I could be more productive in emacs if I invested more time in the
tutorials, but so far it hasn't been an issue. To me, it's more like needing
to know how to use Eclipse or IntelliJ to program in Java since their tooling
is so great.

~~~
methehack
You might consider checking out evil mode. It's for real. Does not feel like
emulation at all.

~~~
viksit
Ah, will check. I'm not sure how it will coexist with all the cider key
bindings though?

~~~
catern
It coexists pretty near perfectly, since vim and emacs keybindings are usually
non-overlapping.

------
webkike
This release has so many incredible new features. Great job Emacs team!

------
truncate
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?

~~~
hollerith
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.)

~~~
klibertp
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).

~~~
hollerith
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)

~~~
klibertp
As you can easily check with M-x find-function a `scroll-up` function is
implemented in C. This is a known problem - I can't find it right now, but I
remember I once read a blog post where the author complained about this: in
general you're not going to get good results when trying to advise, override
or modify C-level functions from Elisp code.

IIRC cl-flet was recently (well, in the current decade I think :)) modified to
be lexically scoped, so that won't work (anymore). This is why I had to use
`letf` with `(symbol-function 'symbol)` instead of a neater `(flet ((beep ()))
...)`.

Personally I deal with beeping like this:

    
    
        (setq ring-bell-function (lambda ()))
    

but this disables any beeping, which may not be what you want. In short,
things you `setq` or more generally `setf` tend to be visible from C functions
(no guarantees though).

On the other hand my Emacs (on Linux) refuses to beep in any circumstances
even if I run it with `emacs -Q` and do M-: (beep) - I have no idea why, I
suspect it's either my sound configuration or has to do with the way I built
my emacs from source.

I'd say for this:

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

raising a (void-variable a) error is correct behaviour under dynamic scoping.
On my system (Emacs 25.0.50.2 x86_64-unknown-linux-gnu) it fails with void-
variable under normal circumstances, but returns 1 when used with lexical
scoping enabled. If your Emacs behaves differently (and remember to always
check with emacs -Q just to be sure it's not something in your config) that's
probably a bug.

~~~
hollerith
>If your Emacs behaves differently . . . that's probably a bug.

Yes, it behaves differently (with lexical-binding set to t and with the -Q
flag).

------
iamthebest
Very nice! I notice that some bugs have been fixed since I last tried the
latest development version(~4 months ago).

I really like the enhancement to C-x TAB to use the arrow keys to adjust the
indentation on the selected region.

------
timjstewart
I'm hoping that the Mac OS X build
([http://emacsformacosx.com](http://emacsformacosx.com)) will soon link with
libxml2 so I can use the eww browser. :)

~~~
clamberson
Is there a reason you don't use the Homebrew version of Cocoa Emacs?

~~~
timjstewart
I did not know about Homebrew's Cocoa Emacs. Thanks for the tip. I'm
installing it now and will see if I get 24.4 with eww or some previous version
(minus the eww). Thanks again!

~~~
ndrake
If you ran the install with --devel you should get 24.4-rc1

~~~
timjstewart
Thanks for the advice!

------
Crito
> _" As always, if you encounter problems building or using Emacs, please send
> a report to address@hidden with full details"_

What's up with "address@hidden"?

~~~
tjr
This is the web representation of a mailing list email, and the software that
prepares the message for viewing on the web conceals email addresses like
that, to help mitigate people receiving unwanted mail (e.g., and probably
especially, spam).

Had you been on the mailing list and received this content via mail, the
address would have ostensibly not been concealed.

------
benaiah
The current plan is to release on Monday.

------
Yadi
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.

