GNU bug report logs - #45693
28.0.50; abbrev does not expand two words any more

Previous Next

Package: emacs;

Reported by: Uwe Brauer <oub <at> mat.ucm.es>

Date: Wed, 6 Jan 2021 15:56:02 UTC

Severity: normal

Found in version 28.0.50

Full log


Message #35 received at 45693 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org, 45693 <at> debbugs.gnu.org
Subject: Re: bug#45693: [two word expansion works, but write-abbrev-file
 destroys it]
Date: Mon, 11 Jan 2021 21:17:06 +0100
[Message part 1 (text/plain, inline)]
>>> "RP" == Robert Pluim <rpluim <at> gmail.com> writes:

> Uwe Brauer <oub <at> mat.ucm.es> writes:
>>> So does it mean we had better avoid describing this "feature" in the
>>> docs, until and unless it gets fixed to be more user-friendly?
>> 
>> Well, I find it useful and found a real kludge by using two abbrev files
>> and associated minor modes. I think what is *really* missing is to 
>> improve/rewrite the write-abbrev-file function.

Thanks, 

    1. I pulled the last GNU Emacs master, 

    2. applied your patch, compiled, 

    3. started emacs -Q

    4. loaded the new abbrev file and

    5. then repeated the steps as described, 

but the write function behaved in the same way as before. Maybe I am too
tired and should retry it tomorrow.

Sorry.

> At the very least we need to support :regexp and
> :case-fixed. Something like this, maybe?

> diff --git i/lisp/abbrev.el w/lisp/abbrev.el
> index 65f7118385..21b4af095f 100644
> --- i/lisp/abbrev.el
> +++ w/lisp/abbrev.el
> @@ -1074,7 +1074,11 @@ insert-abbrev-table-description
>  a call to `define-abbrev-table' that when evaluated will define
>  the abbrev table NAME exactly as it is currently defined.
>  Abbrevs marked as \"system abbrevs\" are ignored."
> -  (let ((symbols (abbrev--table-symbols name readable)))
> +  (let* ((symbols (abbrev--table-symbols name readable))
> +        (docstring (or (documentation-property name 'variable-documentation)
> +                       "no documentation"))
> +        (sym (obarray-get (symbol-value name) ""))
> +        (props (symbol-plist sym)))
>      (setq symbols (sort symbols 'string-lessp))
>      (let ((standard-output (current-buffer)))
>        (if readable
> @@ -1090,7 +1094,13 @@ insert-abbrev-table-description
>              (insert " '())\n\n")
>            (insert "\n  '(\n")
>            (mapc 'abbrev--write symbols)
> -          (insert "   ))\n\n")))
> +          (insert "   )\n")
> +          (insert (format "%S\n" docstring))
> +          (when (plist-member props :case-fixed)
> +            (insert (format "%s %s\n" :case-fixed (plist-get props :case-fixed))))
> +          (when (plist-member props :regexp)
> +            (insert (format "%s %S\n" :regexp (plist-get props :regexp))))
> +          (insert ")\n\n")))
>        nil)))
 
>  (defun abbrev--table-symbols (name &optional system)
[smime.p7s (application/pkcs7-signature, attachment)]

This bug report was last modified 4 years and 156 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.