emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 8049fd96ed 2/3: hact.el, hsys-org.el, hywconf


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 8049fd96ed 2/3: hact.el, hsys-org.el, hywconfig.el - Improve doc and conditionals
Date: Mon, 6 Feb 2023 03:57:51 -0500 (EST)

branch: externals/hyperbole
commit 8049fd96ed7ae1581ecb9573f136be389e1f2354
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    hact.el, hsys-org.el, hywconfig.el - Improve doc and conditionals
---
 ChangeLog    |  6 ++++++
 hact.el      |  7 ++++---
 hsys-org.el  |  4 ++--
 hywconfig.el | 64 ++++++++++++++++++++++++++++++------------------------------
 4 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7aa6884bd4..b97bb1cd74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,12 @@
 
 2023-02-05  Bob Weiner  <rsw@gnu.org>
 
+* hsys-org.el (hsys-org-mode-function): Improve doc string.
+
+* set.el (set:replace): Fix doc to say always returns the set.
+         (set:replace-member): Add this new function to replace an existing set
+    member or add a new one if no matching existing member.
+
 * hyrolo.el (hyrolo-initialize-file-list): Fix to not overwrite any user 
customized
     value, if already initialized.
 
diff --git a/hact.el b/hact.el
index 9302e6ce8d..a2aa3c7ba9 100644
--- a/hact.el
+++ b/hact.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     27-Jan-23 at 17:40:04 by Bob Weiner
+;; Last-Mod:      6-Feb-23 at 00:05:26 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -160,12 +160,13 @@ If no SYMBOLS are given, set it to the empty set.  Return 
the symset.  Uses
 
 (defun    symset:add (elt symbol property)
   "Add ELT to SYMBOL's PROPERTY set.
-Return nil iff ELT is already in the set; otherwise, return PROPERTY's value.
+Return PROPERTY's value unless ELT is already in the set, then return nil.
 Use `eq' for comparison."
   (let* ((set (get symbol property))
         (set:equal-op 'eq)
         (new-set (set:add elt set)))
-    (and new-set (put symbol property new-set))))
+    (when new-set
+      (put symbol property new-set))))
 
 (defun    symset:clear (symbol)
   "Set SYMBOL's symset to nil."
diff --git a/hsys-org.el b/hsys-org.el
index ec28c6997b..c8d28ce6eb 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     2-Jul-16 at 14:54:14
-;; Last-Mod:      3-Dec-22 at 02:33:37 by Bob Weiner
+;; Last-Mod:      5-Feb-23 at 17:18:47 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -84,7 +84,7 @@ with different settings of this option.  For example, a nil 
value makes
 
 ;;;###autoload
 (defvar hsys-org-mode-function #'hsys-org-mode-p
-"*Zero arg bool func that returns non-nil if point is in an Org-related 
buffer.")
+  "*Boolean function that returns non-nil when point is in an Org-related 
buffer.")
 
 ;;; ************************************************************************
 ;;; Public Action Types
diff --git a/hywconfig.el b/hywconfig.el
index 0d0e2b5a06..891991ac54 100644
--- a/hywconfig.el
+++ b/hywconfig.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Mar-89
-;; Last-Mod:     20-Jan-23 at 22:20:55 by Mats Lidell
+;; Last-Mod:      5-Feb-23 at 16:51:16 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -77,20 +77,20 @@
 When called interactively and a window configuration already exists under
 NAME, confirms whether or not to replace it."
   (interactive "sName for current window configuration: ")
-  (or (stringp name)
-      (error "(hywconfig-add-by-name): `name' argument is not a string: %s" 
name))
+  (unless (stringp name)
+    (error "(hywconfig-add-by-name): `name' argument is not a string: %s" 
name))
   (let ((set:equal-op  (lambda (key elt) (equal key (car elt))))
        (wconfig-names (hywconfig-get-names)))
-    (if (or (not (called-interactively-p 'interactive))
-           (not (set:member name wconfig-names))
-           (y-or-n-p
-            (format "Replace existing `%s' window configuration? " name)))
-       (progn (hywconfig-set-names (set:replace name 
(current-window-configuration)
-                                                wconfig-names))
-              (if (called-interactively-p 'interactive)
-                  (message
-                   (substitute-command-keys
-                    (format "Window configuration `%s' saved.  Use 
{\\[hywconfig-restore-by-name]} to restore." name))))))))
+    (when (or (not (called-interactively-p 'interactive))
+             (not (set:member name wconfig-names))
+             (y-or-n-p
+              (format "Replace existing `%s' window configuration? " name)))
+      (hywconfig-set-names (set:replace name (current-window-configuration)
+                                       wconfig-names))
+      (when (called-interactively-p 'interactive)
+       (message
+        (substitute-command-keys
+         (format "Window configuration `%s' saved.  Use 
{\\[hywconfig-restore-by-name]} to restore." name)))))))
 
 ;;;###autoload
 (defun hywconfig-delete-by-name (name)
@@ -103,8 +103,8 @@ NAME, confirms whether or not to replace it."
         (error "(hywconfig-delete-by-name): `name' argument is not a string: 
%s" name))
        (t (let ((set:equal-op (lambda (key elt) (equal key (car elt)))))
             (hywconfig-set-names (set:remove name (hywconfig-get-names)))
-            (if (called-interactively-p 'interactive)
-                (message "Window configuration `%s' has been deleted." 
name))))))
+            (when (called-interactively-p 'interactive)
+              (message "Window configuration `%s' has been deleted." name))))))
 
 ;;;###autoload
 (defun hywconfig-restore-by-name (name)
@@ -118,8 +118,8 @@ NAME, confirms whether or not to replace it."
        (t (let ((wconfig (set:get name (hywconfig-get-names))))
             (if wconfig
                 (progn (hywconfig-set-window-configuration wconfig)
-                       (if (called-interactively-p 'interactive)
-                           (message "Window configuration `%s' is now active." 
name)))
+                       (when (called-interactively-p 'interactive)
+                         (message "Window configuration `%s' is now active." 
name)))
               (error "(hywconfig-restore-by-name): No window configuration for 
this frame named `%s'" name))))))
 
 ;;; Window configuration ring management (like text kill ring).
@@ -157,10 +157,10 @@ ring is not empty, then stay in the hywconfig menu."
 Use {\\[hywconfig-yank-pop]} to restore it at a later time."
   (interactive)
   (ring-insert (hywconfig-get-ring) (current-window-configuration))
-  (if (called-interactively-p 'interactive)
-      (message
-       (substitute-command-keys
-       "Window configuration saved.  Use {\\[hywconfig-yank-pop]} to 
restore."))))
+  (when (called-interactively-p 'interactive)
+    (message
+     (substitute-command-keys
+      "Window configuration saved.  Use {\\[hywconfig-yank-pop]} to 
restore."))))
 
 ;;;###autoload
 (defun hywconfig-yank-pop (n)
@@ -202,8 +202,8 @@ oldest one comes the newest one."
   "Return the current frame's list of named window configurations."
   (let* ((frame (selected-frame))
         (names (frame-parameter frame 'hywconfig-names)))
-    (if (not names)
-       (set-frame-parameter frame 'hywconfig-names (setq names (set:create))))
+    (unless names
+      (set-frame-parameter frame 'hywconfig-names (setq names (set:create))))
     names))
 
 (defun hywconfig-set-names (names)
@@ -214,18 +214,18 @@ oldest one comes the newest one."
   "Return the current frame's window configuration ring."
   (let* ((frame (selected-frame))
         (ring (frame-parameter frame 'hywconfig-ring)))
-    (if (not ring)
-       (set-frame-parameter frame 'hywconfig-ring (setq ring (make-ring 
hywconfig-ring-max))))
+    (unless ring
+      (set-frame-parameter frame 'hywconfig-ring (setq ring (make-ring 
hywconfig-ring-max))))
     ring))
 
 (defun hywconfig-set-window-configuration (wconfig)
-  (if (window-configuration-p wconfig)
-      (condition-case nil
-         (progn (set-window-configuration wconfig) t)
-       (error (message "(HyWconfig): Invalid window configuration, `%s'" 
wconfig)
-              (beep)
-              (sit-for 2)
-              nil))))
+  (when (window-configuration-p wconfig)
+    (condition-case nil
+       (progn (set-window-configuration wconfig) t)
+      (error (message "(HyWconfig): Invalid window configuration, `%s'" 
wconfig)
+            (beep)
+            (sit-for 2)
+            nil))))
 
 (run-hooks 'hywconfig-load-hook)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]