[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs Lisp's future
From: |
Georges Ko |
Subject: |
Re: Emacs Lisp's future |
Date: |
Mon, 10 Oct 2016 12:09:25 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (windows-nt) Hamster/2.0.0.1 |
Richard Stallman <address@hidden> writes:
> Namespace systems do not fit well into Lisp. Common Lisp's is a total
> mess. It is better to use name prefixes.
A first step could be to provide some simple prefix support for users,
not stuff that comes with Emacs.
Example:
Let's say I want to write some code in sqlited.el to edit SQLite
files. Instead of prefixing everything with sqlited- in sqlited.el, I
would add this to the top of the file:
(set-current-prefix 'sqlited-)
and "magically", everything that is defined (functions, variables,
...) in this file are prefixed with "sqlited-" from the Emacs Lisp
reader point of view:
(defun file-header (file) ...)
is read by the reader as:
(defun sqlited-file-header (file) ...)
When looking up for functions, variables, etc., in this file,
the reader would first search with the sqlited- prefix, then the
version without prefix.
"Global" elements (without prefix) can be defined and used through
some virtual prefix such as "emacs:":
(defvar emacs:sqlited-load-hook nil)
(defun emacs:sqlited-edit-file (...) (interactive) ...)
Or it could be defined that anything starting with the prefix means
global, like now:
(defvar sqlited-load-hook nil)
(defun sqlited-edit-file (...) (interactive) ...)
Or the user can set it explicitely:
(set-global-prefix 'g:)
...
(defvar g:sqlited-load-hook nil)
(defun g:sqlited-edit-file (...) (interactive) ...)
When accessing elements using other prefixes:
(require "sqlited-viewer")
(set-prefix-map 'v: 'sqlited-viewer-)
(v:view-file "...")
v:view-file would be read as sqlited-viewer-view-file.
--
Georges Ko address@hidden 2016-10-10
- Re: Emacs Lisp's future, (continued)
- Re: Emacs Lisp's future, Nicolas Petton, 2016/10/08
- Re: Emacs Lisp's future, Helmut Eller, 2016/10/08
- Re: Emacs Lisp's future, Richard Stallman, 2016/10/10
- Re: Emacs Lisp's future, Richard Stallman, 2016/10/10
- Re: Emacs Lisp's future, Helmut Eller, 2016/10/11
- Re: Emacs Lisp's future, Elias Mårtenson, 2016/10/11
- Re: Emacs Lisp's future, Tom Tromey, 2016/10/11
- Re: Emacs Lisp's future, Richard Stallman, 2016/10/13
- Re: Emacs Lisp's future, Tom Tromey, 2016/10/13
- Re: Emacs Lisp's future, Richard Stallman, 2016/10/16
- Re: Emacs Lisp's future,
Georges Ko <=
- Re: Emacs Lisp's future, Clément Pit--Claudel, 2016/10/10
- Re: Emacs Lisp's future, Georges Ko, 2016/10/10
- Re: Emacs Lisp's future, Marcin Borkowski, 2016/10/11
- Re: Emacs Lisp's future, Clément Pit--Claudel, 2016/10/11
- Re: Emacs Lisp's future, Marcin Borkowski, 2016/10/11
- Re: Emacs Lisp's future, Clément Pit--Claudel, 2016/10/11
- Re: Emacs Lisp's future, Elias Mårtenson, 2016/10/11
- Re: Emacs Lisp's future, Clément Pit--Claudel, 2016/10/11
- Re: Emacs Lisp's future, Elias Mårtenson, 2016/10/11
- Re: Emacs Lisp's future, Marcin Borkowski, 2016/10/11