unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64108: hippie-expand's try-expand-all-abbrevs nil has trouble expanding abbrevs given as list(aka. expand.el snipets)
@ 2023-06-16 14:24 Yilkal Argaw
  2023-06-16 16:25 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Yilkal Argaw @ 2023-06-16 14:24 UTC (permalink / raw)
  To: 64108

[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]

Hello,
When trying to use hippie-expand to expand a simple expand.el snippet
causes a bug about lists not being acceptable.


To recreate the bug use the following init.el and try to expand def using
hippie expand
;;init.el
(defconst elisp-expand-list
  '(("def" "(defun ()\n ) " (8 9 11 12)))
  "Expansions for elisp mode")
(add-hook 'emacs-lisp-mode-hook
 (lambda () (expand-add-abbrevs emacs-lisp-mode-abbrev-table
elisp-expand-list)))
(add-hook 'lisp-interaction-mode-hook
 (lambda () (expand-add-abbrevs emacs-lisp-mode-abbrev-table
elisp-expand-list)))
(global-set-key [remap dabbrev-expand] 'hippie-expand)

This error persists even when calling the (try-expand-all-abbrevs nil)
using eval expression the debug log is as follows.

Debugger entered--Lisp error: (wrong-type-argument stringp ["(defun ()\n )
" 6 (13 8 9 11 12)])
  he-transfer-case("def" ["(defun ()\n ) " 6 (13 8 9 11 12) nil])
  he-string-member(["(defun ()\n ) " 6 (13 8 9 11 12) nil] ("def") t)
  try-expand-all-abbrevs(nil)
  eval-expression((try-expand-all-abbrevs nil) nil nil 127)
  funcall-interactively(eval-expression (try-expand-all-abbrevs nil) nil
nil 127)
  command-execute(eval-expression)

With Regards
Yilkal Argaw

[-- Attachment #2: Type: text/html, Size: 1491 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#64108: hippie-expand's try-expand-all-abbrevs nil has trouble expanding abbrevs given as list(aka. expand.el snipets)
  2023-06-16 14:24 bug#64108: hippie-expand's try-expand-all-abbrevs nil has trouble expanding abbrevs given as list(aka. expand.el snipets) Yilkal Argaw
@ 2023-06-16 16:25 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-06-16 16:25 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 64108

> From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> Date: Fri, 16 Jun 2023 17:24:15 +0300
> 
> When trying to use hippie-expand to expand a simple expand.el snippet causes a bug about lists not
> being acceptable.
> 
> To recreate the bug use the following init.el and try to expand def using hippie expand
> ;;init.el
> (defconst elisp-expand-list
>   '(("def" "(defun ()\n ) " (8 9 11 12)))
>   "Expansions for elisp mode")
> (add-hook 'emacs-lisp-mode-hook
>  (lambda () (expand-add-abbrevs emacs-lisp-mode-abbrev-table elisp-expand-list)))
> (add-hook 'lisp-interaction-mode-hook
>  (lambda () (expand-add-abbrevs emacs-lisp-mode-abbrev-table elisp-expand-list)))
> (global-set-key [remap dabbrev-expand] 'hippie-expand)
> 
> This error persists even when calling the (try-expand-all-abbrevs nil) using eval expression the debug
> log is as follows.

It looks like hippie-expand doesn't support "special" abbrevs, those
whose expansion is obtained by running a hook function (as opposed to
just using the string that is the abbrev's expansion).  IOW,
hippie-expand expects that abbrev-expansion returns a string, which is
not what happens with "special" abbrevs.  And expand.el, where
expand-add-abbrevs is defined, defines such "special" abbrevs.

Patches to adapt hippie-expand to abbrevs created by expand.el are
welcome.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-16 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16 14:24 bug#64108: hippie-expand's try-expand-all-abbrevs nil has trouble expanding abbrevs given as list(aka. expand.el snipets) Yilkal Argaw
2023-06-16 16:25 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).