emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs Lisp's future


From: raman
Subject: Re: Emacs Lisp's future
Date: Mon, 10 Oct 2016 08:26:08 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Georges Ko <address@hidden> writes:


All this would buy would be less typing -- but emacs completion does
most of my typing for me anyway.

another win perhaps might be for shorter lines because of shorter
identifiers -- but for a large file, 
one might easily forget that the prefix has been set at the top --
e.g. when fixing a bug in the middle of a file.
> 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.

-- 



reply via email to

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