branch: externals/cus-abbrev
commit 33c0f6e09e4411beb1651c3120521569fe952e53
Author: Mauro Aranda <maurooara...@gmail.com>
Commit: Mauro Aranda <maurooara...@gmail.com>

    Make cus-abbrev commands work in fields too
    
    * cus-abbrev.el (custom-abbrev-field-map): New keymap, used in every
    editable field we create.
    (customize-all-abbrevs, customize-abbrevs): Use it.
---
 cus-abbrev.el | 49 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 33 insertions(+), 16 deletions(-)

diff --git a/cus-abbrev.el b/cus-abbrev.el
index f27d5cbeb4..a66be4726b 100644
--- a/cus-abbrev.el
+++ b/cus-abbrev.el
@@ -67,6 +67,13 @@ If nil, this is the same as `abbrev-file-name'."
   "n"       #'widget-forward
   "p"       #'widget-backward)
 
+(defvar-keymap custom-abbrev-field-map
+  :doc "Keymap for the editable fields in the buffers for Customizing Abbrevs."
+  :full t
+  :parent custom-field-keymap
+  "C-x C-s" #'Custom-abbrev-save
+  "C-c C-c" #'Custom-abbrev-define)
+
 (defvar custom-abbrev-commands
   '((" Define Abbrevs" Custom-abbrev-define t
      "Define Abbrevs but don't save." "index" "Define" t)
@@ -265,14 +272,19 @@ this session."
                            :sample-face 'highlight
                            :custom-abbrev-table table-name
                            '(list :tag "Abbrev"
-                                  (string :tag "Abbreviation")
-                                  (string :tag "Expansion")
-                                  (choice :tag "Hook"
-                                          (const :tag "None" nil)
-                                          (function))
-                                  (choice :tag "Enable function"
-                                          (const :tag "None" nil)
-                                          (function :value always))
+                                  (string :tag "Abbreviation"
+                                          :keymap custom-abbrev-field-map)
+                                  (string :tag "Expansion"
+                                          :keymap custom-abbrev-field-map)
+                                  (choice
+                                   :tag "Hook"
+                                   (const :tag "None" nil)
+                                   (function :keymap custom-abbrev-field-map))
+                                  (choice
+                                   :tag "Enable function"
+                                   (const :tag "None" nil)
+                                   (function :value always
+                                             :keymap custom-abbrev-field-map))
                                   (boolean :tag "Case fixed"))))
       (push abbrev-widget custom-abbrev-widgets)
       (widget-put visibility :widget abbrev-widget)))
@@ -324,14 +336,19 @@ the abbrev table to customize.  If nil, it defaults to 
`global-abbrev-table'."
            (widget-create 'custom-abbrev :value abbrevs
                           :custom-abbrev-table table-name
                           '(list :tag "Abbrev"
-                                 (string :tag "Abbreviation")
-                                 (string :tag "Expansion")
-                                 (choice :tag "Hook"
-                                          (const :tag "None" nil)
-                                          (function))
-                                 (choice :tag "Enable function"
-                                         (const :tag "None" nil)
-                                         (function :value always))
+                                 (string :tag "Abbreviation"
+                                         :keymap custom-abbrev-field-map)
+                                 (string :tag "Expansion"
+                                         :keymap custom-abbrev-field-map)
+                                 (choice
+                                  :tag "Hook"
+                                  (const :tag "None" nil)
+                                  (function :keymap custom-abbrev-field-map))
+                                 (choice
+                                  :tag "Enable function"
+                                  (const :tag "None" nil)
+                                  (function :value always
+                                            :keymap custom-abbrev-field-map))
                                  (boolean :tag "Case fixed"))))))
   (custom-abbrev--prepare-buffer-2))
 

Reply via email to