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

    Prepare the package for GNU ELPA
    
    * .elpaignore: New file.
    * cus-abbrev.el: Assign Copyright to FSF.
    (custom-abbrev-commands): Make it a defconst.
    (custom-abbrev--tool-bar-setup): Prefer to use unless and dolist.
    (Custom-abbrev-revert-buffer): Use length>.
---
 .elpaignore   |  2 ++
 cus-abbrev.el | 24 ++++++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.elpaignore b/.elpaignore
new file mode 100644
index 0000000000..d90b9b96c0
--- /dev/null
+++ b/.elpaignore
@@ -0,0 +1,2 @@
+.elpaignore
+Makefile
diff --git a/cus-abbrev.el b/cus-abbrev.el
index a66be4726b..abe2e9c766 100644
--- a/cus-abbrev.el
+++ b/cus-abbrev.el
@@ -1,6 +1,6 @@
 ;;; cus-abbrev.el --- Easy Customization interface for Abbrevs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2025  Mauro Aranda
+;; Copyright (C) 2025  Free Software Foundation, Inc.
 
 ;; Author: Mauro Aranda <maurooara...@gmail.com>
 ;; Maintainer: Mauro Aranda <maurooara...@gmail.com>
@@ -11,6 +11,8 @@
 ;; URL: https://gitlab.com/mauroaranda/cus-abbrev
 ;; Keywords: convenience
 
+;; This file is NOT part of GNU Emacs.
+
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
@@ -74,7 +76,7 @@ If nil, this is the same as `abbrev-file-name'."
   "C-x C-s" #'Custom-abbrev-save
   "C-c C-c" #'Custom-abbrev-define)
 
-(defvar custom-abbrev-commands
+(defconst custom-abbrev-commands
   '((" Define Abbrevs" Custom-abbrev-define t
      "Define Abbrevs but don't save." "index" "Define" t)
     (" Save Abbrevs " Custom-abbrev-save t
@@ -109,15 +111,13 @@ See `custom-commands' for further explanation.")
 
 (defun custom-abbrev--tool-bar-setup ()
   "Set up tool-bar for buffers customizing abbrevs."
-  (or custom-abbrev-tool-bar-map ; Already set-up.
-      (let ((map (make-sparse-keymap)))
-        (mapc
-         (lambda (arg)
-           (tool-bar-local-item-from-menu
-            (nth 1 arg) (nth 4 arg) map custom-abbrev-map
-            :label (nth 5 arg)))
-         custom-abbrev-commands)
-        (setq custom-abbrev-tool-bar-map map))))
+  (unless custom-abbrev-tool-bar-map ; Already set-up.
+    (let ((map (make-sparse-keymap)))
+      (dolist (arg custom-abbrev-commands)
+        (tool-bar-local-item-from-menu
+         (nth 1 arg) (nth 4 arg) map custom-abbrev-map
+         :label (nth 5 arg)))
+      (setq custom-abbrev-tool-bar-map map))))
 
 ;; Widgets.
 (define-widget 'custom-abbrev 'editable-list
@@ -208,7 +208,7 @@ See `custom-commands' for further explanation.")
 (defun Custom-abbrev-revert-buffer (&rest _ignored)
   "Revert the buffer for customizing abbrevs."
   (interactive)
-  (if (>= (length custom-abbrev-widgets) 2)
+  (if (length> custom-abbrev-widgets 1)
       (customize-all-abbrevs)
     (customize-abbrevs (widget-get (car custom-abbrev-widgets)
                                    :custom-abbrev-table))))

Reply via email to