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


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
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: bug#45693: [two word expansion works, but write-abbrev-file destroys it]
Date: Mon, 11 Jan 2021 18:38:57 +0100
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.

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)




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.