[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is Elisp a lisp-2?
From: |
Oleksandr Gavenko |
Subject: |
Re: Why is Elisp a lisp-2? |
Date: |
Mon, 10 Oct 2016 16:31:39 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
On 2016-10-07, Marcin Borkowski wrote:
> One conjecture is that Elisp being lisp-2 enables functions and variables
> with the same name (this is what lisp-2 means, right?), and RMS might have
> found it useful: there are quite a few such pairs in Emacs.
At least each major/minor mode function have corresponding variable:
--8<---------------cut here---------------start------------->8---
(defmacro define-minor-mode (mode doc &optional init-value lighter keymap &rest
body)
[...]
(make-variable-buffer-local ',mode)))
[...]
(modefun mode) ;The minor mode function name we're defining.
[...]
;; The actual function.
(defun ,modefun (&optional arg ,@extra-args)
[...]
(,@(if setter `(funcall #',setter)
(list (if (symbolp mode) 'setq 'setf) mode))
(if (eq arg 'toggle)
(not ,mode)
;; A nil argument also means ON now.
(> (prefix-numeric-value arg) 0)))
--8<---------------cut here---------------end--------------->8---
================================================================
I would like also mention plist attached to symbol. It is interesting idea to
carry named metadata with symbol:
--8<---------------cut here---------------start------------->8---
(eq 'byte-compile-no-warnings (get 'with-no-warnings 'byte-compile))
(eq 'byte-compile-no-warnings
(plist-get (symbol-plist 'with-no-warnings) 'byte-compile))
--8<---------------cut here---------------end--------------->8---
--
http://defun.work/