help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to quote a list of functions?


From: Emanuel Berg
Subject: Re: How to quote a list of functions?
Date: Wed, 19 Aug 2015 02:11:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

> some functions are actually closures

OK?

> and - some functions can escape the lexical
> environment where their name is bound.

Far out :)

This only strengthen my belief that this is something
that is of either very advanced or very scholastic,
depending on your approach to life.

It is better to keep it - well, not "real" perhaps,
but more practical.

Example one:

    (defun ada-mode-hook-f ()
      (enable-line-mode)
      (setq ada-auto-case nil)
      (disable-super-global-keys) )
    (add-hook 'ada-mode-hook 'ada-mode-hook-f)

>From the help:

    (add-hook HOOK FUNCTION &optional APPEND LOCAL)

    Add to the value of HOOK the function FUNCTION.

So that should be: #'ada-mode-hook-f)

Example two:

    (require 'scroll)
    (defun set-pane-scroll-keys (map)
      "Set MAP keys for vertical scrolling in panes."
      (define-key map "I" 'scroll-up-pane)
      (define-key map "K" 'scroll-down-pane) )

>From the help:

    (define-key KEYMAP KEY DEF) ...

    DEF is anything that can be a key's definition:
     ...
     a command (a Lisp function suitable for interactive calling),
     ...
     a symbol (when the key is looked up, the symbol will stand for its
        function definition, which should at that time be one of the above,
        or another symbol whose function definition is used, etc.),

So that can be either! Only #'scroll-up-pane (-down-)
is more natural.

Example three:

    (put 'upcase-region    'disabled   nil)
    (put 'downcase-region  'disabled   nil)
    (put 'erase-buffer     'disabled   nil)
    (put 'suspend-frame    'disabled   t  )

>From the help:

    (put SYMBOL PROPNAME VALUE)

    Store SYMBOL's PROPNAME property with value VALUE.

So that should be: 'upcase-region (downcase-, etc.)

Conclusion: You have to check every function where
functions are refered to, to learn if they should be
passed as functions or as the symbols denoting them.
On the other hand, probably there aren't that many
such functions in you code and it is interesting to
know. If you don't do it, nothing bad will happen, and
this might dismotivate you from doing it. Yet on the
other hand, doing it will increase your understanding
of the symbol/function intricacies which might elevate
your game in the future - or, just make your code
complicated/scholastic.

> And basically, you should learn Common Lisp.

I have given up programming as a profession and now
repair bikes. So I don't have that many hours anymore
for this stuff. Nonetheless, I did CL at the
university, but at a superficial level. The reason
I din a lot of Elisp isn't love for Lisp, tho I love
it by now of course, but because I wanted Emacs the
way I wanted it (and with the stuff I wanted), much
like I did almost as much zsh (the language) not for
the love of zsh, and I *don't* love zsh, but because
I spent so much time with zsh (the shell). So what I'm
saying is, there was a natural way for me to do Elisp.
If you know of a natural way to do CL I'd be very
happy to do that but I'm not one for those "Learn
Kung-Fu in 24 hours" - if it isn't real, I don't get
motivated. What real problems can I solve in CL that
I cannot with what I have?

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]