"*package-registry* is a hash-table of registered packages. The
variable may go at some point. Or not.
-A file-local variable "package-prefixes" can be used to enable or
+A file-local variable "symbol-packages" can be used to enable or
disable reading or printing of symbols with package prefixes. If
-package-prefixes is nil, a symbol "a:b" will be read as a symbol with
-name "a:b" in the Emacs package. If package-prefixes is t, "a:b" will
+symbol-packages is nil, a symbol "a:b" will be read as a symbol with
+name "a:b" in the Emacs package. If symbol-packages is t, "a:b" will
be read as symbol "b" in package "a". Default is nil.
Note that there is a small incompatibility here: In "normal" Emacs,
of obarray-make to create obarrays.
*** Reader
-The variable 'package-prefixes' determines if the reader will
+The variable 'symbol-packages' determines if the reader will
interpret colons in a symbol name as part of a package name or not.
Default is nil.
*** Fake package qualification
Existing code contains symbols like GUI:xyz which look like GUI is a
package qualification. That's the reason for the variable
-package-prefixes which means to interpret the : as part of the symbol
+symbol-packages which means to interpret the : as part of the symbol
name.
** Ideas / Todo
with regexs. Or something.
- (import sym as another-sym)
-*** Package-prefixes in functions
+*** symbol-packages in functions
I'm wondering if it would be an idea to record the value of
-package-prefixes at the time and in the buffer where functions are
+symbol-packages at the time and in the buffer where functions are
compiled or eval'd.
We could then
-- Bind package-prefixes around the execution of the function to that
+- Bind symbol-packages around the execution of the function to that
value.
- Return a name with leading colon from symbol-value if
- package-prefixes is nil, which means the function was compiled or
+ symbol-packages is nil, which means the function was compiled or
eval'd in a "traditional" setting. It would return the keyword name
- without the leading colon if package-prefixes is t.
+ without the leading colon if symbol-packages is t.
- Make intern treat colons differently depending on the value of
- package-prefixes. There are some places like transient.el which
+ symbol-packages. There are some places like transient.el which
intern names with a leading colon which are a pain in the neck.
- Maybe calls to read could also behave differently.
try it out.
*** Modeline
-A mode-line indicator showing the current package and package-prefixes
+A mode-line indicator showing the current package and symbol-packages
would be helpful. Can be done with (:eval ...) in global-mode-string
now. Or maybe in a header-line.
;; Don't inherit lexical-binding from caller (bug#12938).
(unless (local-variable-p 'lexical-binding)
(setq-local lexical-binding nil))
- (unless (local-variable-p 'package-prefixes)
- (setq-local package-prefixes nil))
+ (unless (local-variable-p 'symbol-packages)
+ (setq-local symbol-packages nil))
;; Set the default directory, in case an eval-when-compile uses it.
(setq default-directory (file-name-directory filename)))
;; Check if the file's local variables explicitly specify not to
(inhibit-compacting-font-caches . booleanp) ;; C source code
(no-update-autoloads . booleanp)
(lexical-binding . booleanp) ;; C source code
- (package-prefixes . booleanp) ;; C source code
+ (symbol-packages . booleanp) ;; C source code
(tab-width . integerp) ;; C source code
(truncate-lines . booleanp) ;; C source code
(word-wrap . booleanp) ;; C source code
variable to set.")
(defvar permanently-enabled-local-variables
- '(lexical-binding package-prefixes)
+ '(lexical-binding symbol-packages)
"A list of file-local variables that are always enabled.
This overrides any `enable-local-variables' setting.")
i--;
val[i] = '\0';
- /* PKG-FIXME Do this more elegantly? */
- if (strcmp (var, "package-prefixes") == 0)
+ if (strcmp (var, "symbol-packages") == 0)
*prefixes = strcmp (val, "nil") == 0 ? false : true;
else if (strcmp (var, "lexical-binding") == 0)
rv = (strcmp (val, "nil") != 0);
if (lisp_file_lexically_bound_p (Qget_file_char, &prefixes))
Fset (Qlexical_binding, Qt);
if (prefixes)
- Fset (Qpackage_prefixes, Qt);
+ Fset (Qsymbol_packages, Qt);
if (! version || version >= 22)
readevalloop (Qget_file_char, &input, hist_file_name,
BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
bool prefixes;
specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf, &prefixes) ? Qt : Qnil);
- specbind (Qpackage_prefixes, prefixes ? Qt : Qnil);
+ specbind (Qsymbol_packages, prefixes ? Qt : Qnil);
BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
readevalloop (buf, 0, filename,
!NILP (printflag), unibyte, Qnil, Qnil, Qnil);
char *end = read_buffer + read_buffer_size;
EMACS_INT start_position = readchar_offset - 1;
- /* PKG-FIXME: This is too complicated. */
- /* PKG-FIXME: Check package-prefixes binding working. */
-
/* Remember where package prefixes end in COLON, which
will be set to the first colon we find. NCOLONS is the
number of colons found so far. */
should't, or it is escaped by a preceding '\\' or
inside a multi-escape. Note that we don't land here
for #:. */
- if (c == ':' && !last_was_backslash && !NILP (Vpackage_prefixes))
+ if (c == ':' && !last_was_backslash && !NILP (Vsymbol_packages))
{
/* Remember where the first : is. */
if (colon == NULL)
If we don't want to recognize ':' as a package indicator,
nevertheless handle keywords. */
- if (NILP (Vpackage_prefixes))
+ if (NILP (Vsymbol_packages))
{
if (*symbol_start == ':')
{
result = Fmake_symbol (symbol_name);
else if (NILP (package))
result = pkg_unqualified_symbol (symbol_name);
- else if (NILP (Vpackage_prefixes))
+ else if (NILP (Vsymbol_packages))
{
/* package should be nil unless we found a keyword. */
eassert (EQ (package, Vkeyword_package));
DEFSYM (Qkeyword, "keyword");
DEFSYM (Qkeyword_package, "keyword-package");
DEFSYM (Qpackage, "package");
- DEFSYM (Qpackage_prefixes, "package-prefixes");
+ DEFSYM (Qsymbol_packages, "symbol-packages");
DEFSYM (Qpackage_registry, "package-registry");
DEFSYM (Qpackagep, "packagep");
DEFSYM (Qsymbol_packages, "symbol-packages");
- DEFSYM (Qsymbol_packages, "symbol-packages");
DEFSYM (Qwatch_earmuffs_package, "watch-*package*");
staticpro (&Vpackage_registry);
Vearmuffs_package = Vemacs_package;
XSYMBOL (Qearmuffs_package)->u.s.declared_special = true;
- staticpro (&Vpackage_prefixes);
- Vpackage_prefixes = Qnil;
+ staticpro (&Vsymbol_packages);
+ Vsymbol_packages = Qnil;
pkg_define_builtin_symbols ();
}
doc: /* The current package. */);
Fmake_variable_buffer_local (Qearmuffs_package);
Fadd_variable_watcher (Qearmuffs_package, Fsymbol_function (Qwatch_earmuffs_package));
- DEFVAR_LISP_NOPRO ("package-prefixes", Vpackage_prefixes,
+ DEFVAR_LISP_NOPRO ("symbol-packages", Vsymbol_packages,
doc: /* */);
- Fmake_variable_buffer_local (Qpackage_prefixes);
+ Fmake_variable_buffer_local (Qsymbol_packages);
Fprovide (Qsymbol_packages, Qnil);
}
(ert-deftest pkg-tests-read ()
(with-packages ((x :register t))
- (let* ((package-prefixes nil)
+ (let* ((symbol-packages nil)
(sym (read "x::y")))
(should (symbolp sym))
(should (equal (symbol-name sym) "x::y"))
(should (eq (symbol-package sym) *keyword-package*))))
(with-packages ((x :register t))
- (let* ((package-prefixes t)
+ (let* ((symbol-packages t)
(sym (read "x::y")))
(should (symbolp sym))
(should (equal (symbol-name sym) "y"))