all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Uwe Brauer <oub@mat.ucm.es>
Cc: larsi@gnus.org, 45693@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	[thread overview]
Message-ID: <87mtxf4bm6.fsf@gmail.com> (raw)
In-Reply-To: <875z4379ri.fsf@mat.ucm.es> (Uwe Brauer's message of "Mon, 11 Jan 2021 16:50:41 +0100")

Uwe Brauer <oub@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)





  reply	other threads:[~2021-01-11 17:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 15:54 bug#45693: 28.0.50; abbrev does not expand two words any more Uwe Brauer
2021-01-10 14:35 ` Lars Ingebrigtsen
2021-01-10 15:51   ` Uwe Brauer
2021-01-10 15:52     ` Lars Ingebrigtsen
2021-01-10 17:22       ` Uwe Brauer
2021-01-10 21:21       ` bug#45693: [two word expansion works, but write-abbrev-file destroys it] (was: bug#45693: 28.0.50; abbrev does not expand two words any more) Uwe Brauer
2021-01-11 10:49         ` bug#45693: [two word expansion works, but write-abbrev-file destroys it] Robert Pluim
2021-01-11 15:26           ` Eli Zaretskii
2021-01-11 15:50             ` Uwe Brauer
2021-01-11 17:38               ` Robert Pluim [this message]
2021-01-11 20:17                 ` Uwe Brauer
2021-01-11 20:38                   ` Robert Pluim
2021-01-11 20:48                     ` Uwe Brauer
2021-01-11 21:03                       ` Robert Pluim
2021-01-12  8:01                         ` Uwe Brauer
2021-01-12 10:34                           ` Robert Pluim
2021-01-12 13:26                             ` Uwe Brauer
2021-01-12 16:45                             ` Uwe Brauer
2021-01-12 17:59                               ` Robert Pluim
2021-01-13  7:37                                 ` Uwe Brauer
2021-01-13  9:16                                   ` Robert Pluim
2021-01-13  9:28                                     ` Uwe Brauer
2021-01-13  9:39                                       ` Robert Pluim
2021-01-13  9:51                                         ` Uwe Brauer
2021-01-13 10:09                                           ` Robert Pluim
2021-01-13 13:18                                             ` Uwe Brauer
2021-01-13 14:03                                               ` Robert Pluim
2021-01-13 16:25                                                 ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtxf4bm6.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=45693@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.