GNU bug report logs -
#77612
[PATCH] (eieio-backward-compatibility): Change default to new `warn` value
Previous Next
Full log
Message #11 received at 77612 <at> debbugs.gnu.org (full text, mbox):
Hi Stefan,
Stefan Monnier writes:
>> `eieio-backward-compatibility` controls compatibility with
>> features declared obsolete since Emacs-25. I'm not sure
>> we're ready to remove support for those features (i.e. to set
>> `eieio-backward-compatibility` to nil), so instead I suggest
>> to make uses of those features emit warnings not only at
>> compile-time but also at run-time.
>
> I forgot to add the same treatment for the (ab)use of initargs as slot
> names (also deprecated since Emacs-25), so I'd suggest adding the patch
> below to the previous one.
>
>
> Stefan
>
> diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
> index 7d0fd643056..d608517e671 100644
> --- a/lisp/emacs-lisp/eieio-core.el
> +++ b/lisp/emacs-lisp/eieio-core.el
> @@ -913,12 +913,15 @@
> (let* ((fsi (gethash slot (cl--class-index-table class))))
> (if (integerp fsi)
> fsi
> + (when eieio-backward-compatibility
> (let ((fn (eieio--initarg-to-attribute class slot)))
> - (if fn
> + (when fn
> + (when (eq eieio-backward-compatibility 'warn)
> + (message "Accessing slot `%S' via obsolete initarg name `%S'"
> + fn slot))
> ;; Accessing a slot via its :initarg is accepted by EIEIO
> ;; (but not CLOS) but is a bad idea (for one: it's slower).
> - (eieio--slot-name-index class fn)
> - nil)))))
> + (eieio--slot-name-index class fn)))))))
>
> (defun eieio--class-slot-name-index (class slot)
> "In CLASS find the index of the named SLOT.
With this change (in commit ae1d01328f2), auth-source-search started
producing warnings, since (IIUC) it relies on the obsolete calling
convention using :initarg. For example, I get the following messages
when evaluating the example form in the auth-source-search docstring:
--8<---------------cut here---------------start------------->8---
Accessing slot ‘host’ via obsolete initarg name ‘:host’
Accessing slot ‘type’ via obsolete initarg name ‘:type’
Accessing slot ‘host’ via obsolete initarg name ‘:host’
Accessing slot ‘type’ via obsolete initarg name ‘:type’
Accessing slot ‘host’ via obsolete initarg name ‘:host’
Accessing slot ‘type’ via obsolete initarg name ‘:type’
--8<---------------cut here---------------end--------------->8---
WDYT about adapting auth-source-search, along the following lines?
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 1d039d8b0d1..946debca95e 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -708,7 +708,11 @@ auth-source-search
(condition-case nil
(unless (auth-source-search-collection
(plist-get spec key)
- (slot-value backend key))
+ (slot-value
+ backend
+ (if (keywordp key)
+ (intern-soft (substring (symbol-name key) 1))
+ key)))
(setq filtered-backends (delq backend filtered-backends))
(cl-return))
(invalid-slot-name nil))))
Best,
Eshel
This bug report was last modified 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.