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

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

[elpa] externals/hyperbole 9f3f40c8ca 3/4: hbdata:to-entry-buf and ebut:


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 9f3f40c8ca 3/4: hbdata:to-entry-buf and ebut:delete - Fix button deletion issue
Date: Sun, 6 Nov 2022 18:57:45 -0500 (EST)

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

    hbdata:to-entry-buf and ebut:delete - Fix button deletion issue
---
 ChangeLog |  5 +++++
 hbdata.el | 32 ++++++++++++++++----------------
 hbut.el   |  4 ++--
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bbdaade5cf..e4ab489d57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+* hbdata.el (hbdata:to-entry-buf): Fix bug that set 'rtn' non-nil
+    at times when 'key-src' file was not found.  This could lead
+    to the wrong error, 'hui:ebut-delete', saying that you cannot
+    delete buttons in this buffer.
+
 2022-10-31  Bob Weiner  <rsw@gnu.org>
 
 * kotl/kimport.el (kimport:star-heading): Allow for indented headings.
diff --git a/hbdata.el b/hbdata.el
index 77c90bef4c..aa750aaaae 100644
--- a/hbdata.el
+++ b/hbdata.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     2-Apr-91
-;; Last-Mod:      7-Oct-22 at 23:17:52 by Mats Lidell
+;; Last-Mod:      5-Nov-22 at 14:24:56 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -409,13 +409,14 @@ beginning of the hbdata file (which is created if 
necessary).
 Return non-nil if KEY-SRC is found or created, else nil."
   (let ((rtn) (ln-dir))
     (if (and (get-buffer key-src)
-            (setq rtn (set-buffer key-src))
+            (set-buffer key-src)
             (not buffer-file-name))
        ;; Button buffer has no file attached
        (progn (setq buffer-read-only nil)
               (unless (hmail:hbdata-to-p)
                 (insert "\n" hmail:hbdata-sep "\n"))
-              (backward-char 1))
+              (backward-char 1)
+              (setq rtn t))
       (setq directory (or (file-name-directory key-src) directory))
       (let ((ln-file) (link-p key-src))
        (while (setq link-p (file-symlink-p link-p))
@@ -424,19 +425,18 @@ Return non-nil if KEY-SRC is found or created, else nil."
            (setq ln-dir (file-name-directory ln-file)
                  key-src (file-name-nondirectory ln-file))
          (setq key-src (file-name-nondirectory key-src))))
-      (if (or (hbdata:to-hbdata-buffer directory create)
-             (and ln-dir (hbdata:to-hbdata-buffer ln-dir nil)
-                  (setq create nil
-                        directory ln-dir)))
-         (progn
-           (goto-char 1)
-           (cond ((search-forward (concat "\^L\n\"" key-src "\"")
-                                  nil t)
-                  (setq rtn t))
-                 (create
-                  (setq rtn t)
-                  (insert "\^L\n\"" key-src "\"\n")
-                  (backward-char 1))))))
+      (when (or (hbdata:to-hbdata-buffer directory create)
+               (and ln-dir (hbdata:to-hbdata-buffer ln-dir nil)
+                    (setq create nil
+                          directory ln-dir)))
+       (goto-char 1)
+       (cond ((search-forward (concat "\^L\n\"" key-src "\"")
+                              nil t)
+              (setq rtn t))
+             (create
+              (setq rtn t)
+              (insert "\^L\n\"" key-src "\"\n")
+              (backward-char 1)))))
     rtn))
 
 (defun hbdata:write (&optional orig-lbl-key but-sym)
diff --git a/hbut.el b/hbut.el
index a4854dbac9..a34d81ab77 100644
--- a/hbut.el
+++ b/hbut.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     23-Oct-22 at 12:12:32 by Bob Weiner
+;; Last-Mod:      5-Nov-22 at 14:05:18 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -91,7 +91,7 @@ If successful, leave point in button data buffer, so caller 
should use
 Default is `hbut:current'.
 Return entry deleted (a list of attribute values) or nil."
   (unless but-sym
-    (setq but-sym 'hbut:current))
+    (setq but-sym (ebut:at-p)))
   (when (ebut:is-p but-sym)
     (let* ((but-key (hattr:get but-sym 'lbl-key))
           (loc     (hattr:get but-sym 'loc))



reply via email to

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