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

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

[elpa] externals/hyperbole c501027 2/2: Fix set-buffer byte-compiler war


From: ELPA Syncer
Subject: [elpa] externals/hyperbole c501027 2/2: Fix set-buffer byte-compiler warnings; remove outdated references
Date: Sun, 9 May 2021 23:57:09 -0400 (EDT)

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

    Fix set-buffer byte-compiler warnings; remove outdated references
---
 ChangeLog     | 19 +++++++++++-
 Makefile      |  4 +--
 hbut.el       | 40 ++++++++++++++-----------
 hui-window.el | 20 ++++++-------
 hui.el        | 96 +++++++++++++++++++++++++++++------------------------------
 hypb.el       |  3 +-
 hyperbole.el  | 24 +++++++--------
 7 files changed, 112 insertions(+), 94 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a8398c3..4ca5a1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,22 @@
     save-excursion around action-key call since somehow the
     ert test runner changes the current buffer to its stats
     buffer after this call, then the final should test fails.
+
+* hyperbole.el (action-key-url-function): Remove out-of-date
+    Netscape and w3 references.  Use eww by default.
+               (make-directory-autoloads): Add for Emacs 28
+    compatibility.
+               (hyperb:generate-autoloads): Use above func.
+
+* hypb.el (hypb:file-major-mode):
+  hui.el (hui:gbut-modify, hui:hbut-delete):
+  hbut.el (ibut:delete, gbut:ebut-program): Change set-buffer
+    to with-current-buffer to remove byte-compiler warning.
+          (www-url): Declare this.
+
+* hui-window.el (hmouse-read-only-toggle-key): Remove ref to
+    obsolete toggle-read-only and vc-toggle-read-only.
+
 * hsys-org.el (hsys-org-radio-target-at-p,
                hsys-org-radio-target-link-at-p): Fix to return
     def or target region.
@@ -22,7 +38,8 @@
 * hui.el (hui:buf-writable-err): Indicate that buffer is read-only
     in msg.
 
-* hbut.el (ebut:operate): Fix bug where ebut:operate has been called
+* hui-window.el (hmouse-prior-active-region):
+  hbut.el (ebut:operate): Fix bug where ebut:operate has been called
    once, so action key is considered depressed and then one of the
    hui button commands or gbut:program is invoked independently, in
    which case the original source location of the depress should be
diff --git a/Makefile b/Makefile
index 72e1462..48a8759 100644
--- a/Makefile
+++ b/Makefile
@@ -337,10 +337,10 @@ ftp: package $(pkg_dir)/hyperbole-$(HYPB_VERSION).tar.gz
 autoloads: hyperbole-autoloads.el kotl/kotl-autoloads.el
 
 hyperbole-autoloads.el: $(EL_COMPILE)
-       $(EMACS) $(BATCHFLAGS) -eval '(progn (setq generated-autoload-file 
(expand-file-name "hyperbole-autoloads.el") backup-inhibited t) 
(update-directory-autoloads "."))'
+       $(EMACS) $(BATCHFLAGS) --debug n-eval "(progn (setq 
generated-autoload-file (expand-file-name \"hyperbole-autoloads.el\") 
backup-inhibited t) (make-directory-autoloads \".\"))"
 
 kotl/kotl-autoloads.el: $(EL_KOTL)
-       $(EMACS) $(BATCHFLAGS) -eval '(progn (setq generated-autoload-file 
(expand-file-name "kotl/kotl-autoloads.el") backup-inhibited t) 
(update-directory-autoloads "kotl/"))'
+       $(EMACS) $(BATCHFLAGS) -eval "(progn (setq generated-autoload-file 
(expand-file-name \"kotl/kotl-autoloads.el\") backup-inhibited t) 
(update-directory-autoloads \"kotl/\"))"
 
 # Used for ftp.gnu.org tarball distributions.
 $(pkg_dir)/hyperbole-$(HYPB_VERSION).tar.gz:
diff --git a/hbut.el b/hbut.el
index 45a5f2b..1d40a15 100644
--- a/hbut.el
+++ b/hbut.el
@@ -20,6 +20,12 @@
                                    htz hbdata hact view)))
 
 ;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function www-url "hsys-www" (url))
+
+;;; ************************************************************************
 ;;; Public definitions
 ;;; ************************************************************************
 
@@ -693,10 +699,10 @@ Return the symbol for the button when found, else nil."
   "Return a list of implicit button label keys from the global button file."
   (when (file-readable-p gbut:file)
     (save-excursion
-      (set-buffer (find-file-noselect gbut:file))
-      (save-restriction
-       (widen)
-       (ibut:label-map #'(lambda (label start end) (ibut:label-to-key 
label)))))))
+      (with-current-buffer (find-file-noselect gbut:file)
+       (save-restriction
+         (widen)
+         (ibut:label-map #'(lambda (label start end) (ibut:label-to-key 
label))))))))
 
 ;;; ========================================================================
 ;;; hattr class
@@ -1471,19 +1477,19 @@ Return symbol for button deleted or nil."
          (end     (hattr:get but-sym 'lbl-end)))
       (when (and start end)
        (save-excursion
-         (set-buffer (if (bufferp loc) loc (find-file-noselect loc)))
-         (when (ibut:to (ibut:key but-sym))
-           (let (buffer-read-only)
-             (if (< (point) start)
-                 ;; Find beginning of button named label delimiter and delete
-                 ;; from there.
-                 (progn (goto-char (- (point) (length ibut:label-start)))
-                        (delete-region (point) end))
-               ;; No label, just delete delimited ibutton text.
-               (delete-region start end))
-             (when (looking-at "[ \t]*\r?\n")
-               (delete-region (point) (match-end 0)))
-             (run-hooks 'ibut-delete-hook))))
+         (with-current-buffer (if (bufferp loc) loc (find-file-noselect loc))
+           (when (ibut:to (ibut:key but-sym))
+             (let (buffer-read-only)
+               (if (< (point) start)
+                   ;; Find beginning of button named label delimiter and delete
+                   ;; from there.
+                   (progn (goto-char (- (point) (length ibut:label-start)))
+                          (delete-region (point) end))
+                 ;; No label, just delete delimited ibutton text.
+                 (delete-region start end))
+               (when (looking-at "[ \t]*\r?\n")
+                 (delete-region (point) (match-end 0)))
+               (run-hooks 'ibut-delete-hook)))))
        but-sym))))
 
 (defun    ibut:get (&optional lbl-key buffer key-src)
diff --git a/hui-window.el b/hui-window.el
index 654c035..796770e 100644
--- a/hui-window.el
+++ b/hui-window.el
@@ -311,12 +311,12 @@ part of InfoDock and not a part of Hyperbole)."
   "Return t iff there is a non-empty active region in buffer of the last Smart 
Mouse Key release."
   (when (setq hkey-value (if assist-flag assist-key-depress-prev-point 
action-key-depress-prev-point))
     (save-excursion
-      (set-buffer (marker-buffer hkey-value))
-      ;; Store and goto any prior value of point from the region
-      ;; prior to the Smart Key depress, so we can return to it later.
-      (and (goto-char hkey-value)
-          (hmouse-save-region)
-          t))))
+      (with-current-buffer (marker-buffer hkey-value)
+       ;; Store and goto any prior value of point from the region
+       ;; prior to the Smart Key depress, so we can return to it later.
+       (and (goto-char hkey-value)
+            (hmouse-save-region)
+            t)))))
 
 (defun hmouse-dired-readin-hook ()
   "Remove local `hpath:display-where' setting whenever re-read a dired 
directory.
@@ -657,10 +657,8 @@ If free variable `assist-flag' is non-nil, uses Assist 
Key."
                    hmouse-side-sensitivity))))))
 
 (defun hmouse-read-only-toggle-key ()
-  "Return the first key binding that toggle read-only mode, or nil if none."
-  (key-description (or (where-is-internal #'read-only-mode nil t)
-                      (where-is-internal #'vc-toggle-read-only nil t)
-                      (where-is-internal #'toggle-read-only nil t))))
+  "Return the first key binding that toggles read-only mode, or nil if none."
+  (key-description (where-is-internal #'read-only-mode nil t)))
 
 (defun hmouse-vertical-action-drag ()
   "Handle an Action Key vertical drag within a window: add a window to the 
right of this one.
@@ -924,7 +922,7 @@ If the Action Key is:
            ((hmouse-release-left-edge) (bury-buffer))
            ((hmouse-release-right-edge)
             (if (eq major-mode 'Info-mode)
-                (Info-exit)
+                (quit-window)
               (info)))
            (t (funcall action-key-modeline-function))))))
 
diff --git a/hui.el b/hui.el
index b818567..0a4a17d 100644
--- a/hui.el
+++ b/hui.el
@@ -425,34 +425,34 @@ modification   Signal an error when no such button is 
found."
               (save-buffer)))
        ;; Implicit buttons
        (save-excursion
-         (set-buffer but-buf)
-          (ibut:to lbl-key)
-         (if (and interactive-flag (ibut:at-p))
-              (progn
-                ;; lbl-start and lbl-end mark the text of the ibut, not
-                ;; its name.
-               (when (hattr:get 'hbut:current 'lbl-end)
-                  (let* ((start (hattr:get 'hbut:current 'lbl-start))
-                         (end (hattr:get 'hbut:current 'lbl-end))
-                         (old-text (buffer-substring start end))
-                         (new-text (read-string "Modify ibut text: " 
old-text)))
-                    (save-excursion
-                      (goto-char start)
-                      (delete-region start end)
-                      (insert new-text))
-                    (hattr:set 'hbut:current 'lbl-key (ibut:label-to-key 
new-lbl))))
-                ;; Have to do name change after lbl-start/lbl-end are
-                ;; used so buffer positions do not change.
-               (ibut:rename lbl new-lbl)
-                (save-buffer)
-               (hui:ibut-message t))
-            (when (and interactive-flag
-                      (ibut:rename lbl new-lbl))
-              (save-buffer)
-              (message "Button renamed to %s%s%s"
-                      ibut:label-start
-                       new-lbl
-                      ibut:label-end))))))))
+         (with-current-buffer but-buf
+            (ibut:to lbl-key)
+           (if (and interactive-flag (ibut:at-p))
+               (progn
+                  ;; lbl-start and lbl-end mark the text of the ibut, not
+                  ;; its name.
+                 (when (hattr:get 'hbut:current 'lbl-end)
+                    (let* ((start (hattr:get 'hbut:current 'lbl-start))
+                           (end (hattr:get 'hbut:current 'lbl-end))
+                           (old-text (buffer-substring start end))
+                           (new-text (read-string "Modify ibut text: " 
old-text)))
+                      (save-excursion
+                       (goto-char start)
+                       (delete-region start end)
+                       (insert new-text))
+                      (hattr:set 'hbut:current 'lbl-key (ibut:label-to-key 
new-lbl))))
+                  ;; Have to do name change after lbl-start/lbl-end are
+                  ;; used so buffer positions do not change.
+                 (ibut:rename lbl new-lbl)
+                  (save-buffer)
+                 (hui:ibut-message t))
+              (when (and interactive-flag
+                        (ibut:rename lbl new-lbl))
+               (save-buffer)
+               (message "Button renamed to %s%s%s"
+                        ibut:label-start
+                        new-lbl
+                        ibut:label-end)))))))))
 
 (defun hui:gbut-rename (label)
   "Interactively rename a Hyperbole global button with LABEL.
@@ -519,26 +519,26 @@ Signal an error if point is not within a button."
         (hypb:error
          "(hbut-delete): Invalid label key argument: '%s'" but-key)))
   (save-excursion
-    (set-buffer (if (bufferp key-src) key-src (find-file-noselect key-src)))
-    (let ((interactive (called-interactively-p 'interactive))
-         (label (hbut:key-to-label but-key)))
-      (cond ((ebut:to but-key)
-            (if (and hui:hbut-delete-confirm-flag interactive)
-                (if (y-or-n-p (format "Delete button %s%s%s? "
-                                      ebut:start label ebut:end))
-                    (hui:ebut-delete-op interactive but-key key-src)
-                  (message "")
-                  nil)
-              (hui:ebut-delete-op interactive but-key key-src)))
-           ((ibut:to but-key)
-            (if (and hui:hbut-delete-confirm-flag interactive)
-                (if (y-or-n-p (format "Delete button %s%s%s? "
-                                      ibut:label-start label ibut:label-end))
-                    (hui:ibut-delete-op interactive but-key key-src)
-                  (message "")
-                  nil)
-              (hui:ibut-delete-op interactive but-key key-src)))
-           (t (hypb:error "(hbut-delete): Invalid button '%s'" label))))))
+    (with-current-buffer (if (bufferp key-src) key-src (find-file-noselect 
key-src))
+      (let ((interactive (called-interactively-p 'interactive))
+           (label (hbut:key-to-label but-key)))
+       (cond ((ebut:to but-key)
+              (if (and hui:hbut-delete-confirm-flag interactive)
+                  (if (y-or-n-p (format "Delete button %s%s%s? "
+                                        ebut:start label ebut:end))
+                      (hui:ebut-delete-op interactive but-key key-src)
+                    (message "")
+                    nil)
+                (hui:ebut-delete-op interactive but-key key-src)))
+             ((ibut:to but-key)
+              (if (and hui:hbut-delete-confirm-flag interactive)
+                  (if (y-or-n-p (format "Delete button %s%s%s? "
+                                        ibut:label-start label ibut:label-end))
+                      (hui:ibut-delete-op interactive but-key key-src)
+                    (message "")
+                    nil)
+                (hui:ibut-delete-op interactive but-key key-src)))
+             (t (hypb:error "(hbut-delete): Invalid button '%s'" label)))))))
 
 (defun hui:hbut-help (&optional but)
   "Check for and explain an optional button given by symbol, BUT.
diff --git a/hypb.el b/hypb.el
index 50005ec..290b251 100644
--- a/hypb.el
+++ b/hypb.el
@@ -265,7 +265,8 @@ Turning on Fgrep-Git-Log mode runs the normal hook 
`compilation-mode-hook'."
 FILE is temporarily read into a buffer to determine the major mode if 
necessary."
   (let ((existing-flag (get-file-buffer file))
        (buf (find-file-noselect file)))
-    (prog1 (when buf (save-excursion (set-buffer buf) major-mode))
+    (prog1 (when buf (save-excursion (with-current-buffer buf
+                                      major-mode)))
       (unless (or existing-flag (null buf))
        (kill-buffer buf)))))
 
diff --git a/hyperbole.el b/hyperbole.el
index 323d992..e02102c 100644
--- a/hyperbole.el
+++ b/hyperbole.el
@@ -409,6 +409,10 @@ frame, those functions by default still return the prior 
frame."
 ;;; Autoloads
 ;;; ************************************************************************
 
+;; New autoload generation function defined only in Emacs 28
+(unless (fboundp #'make-directory-autoloads)
+  (defalias 'make-directory-autoloads 'update-directory-autoloads))
+
 ;; Koutliner autoloads in the kotl/ subdirectory are generated by 'make pkg'.
 ;; This next line ensures they are loaded by hyperbole-autoloads whenever
 ;; the Hyperbole package is activated in an Emacs session.
@@ -446,7 +450,7 @@ frame, those functions by default still return the prior 
frame."
 ;;          (backup-inhibited t)
 ;;          (version-control 'never))
 ;;     (package-autoload-ensure-default-file generated-autoload-file)
-;;     (apply #'update-directory-autoloads pkg-dir
+;;     (apply #'make-directory-autoloads pkg-dir
 ;;            (delq nil (mapcar (lambda (f) (and (file-directory-p f)
 ;;                                               (not (file-symlink-p f))
 ;;                                               f))
@@ -598,17 +602,9 @@ If FLAG is nil then text is shown, while if FLAG is t the 
text is hidden."
 
 ;; Use any obsolete URL setting from earlier Hyperbole releases to set the
 ;; new URL browsing variable.
-(if (and (boundp 'action-key-url-function) action-key-url-function)
-    (cond ((eq action-key-url-function #'w3-fetch)
-          (setq browse-url-browser-function #'browse-url-w3))
-         ((eq action-key-url-function
-              #'highlight-headers-follow-url-netscape)
-          (setq browse-url-browser-function #'browse-url-netscape
-                browse-url-new-window-flag nil))
-         ((eq action-key-url-function
-              #'highlight-headers-follow-url-netscape-new-window)
-          (setq browse-url-browser-function #'browse-url-netscape
-                browse-url-new-window-flag t))))
+(when (and (boundp 'action-key-url-function) action-key-url-function
+          (eq action-key-url-function #'eww))
+  (setq browse-url-browser-function #'browse-url-emacs))
 
 ;;; ************************************************************************
 ;;; Load Site-specific Configurations and Initialize Hyperbole Package
@@ -667,9 +663,9 @@ This is used only when running from git source and not a 
package release."
   (let* ((default-directory hyperb:dir)
         (generated-autoload-file (expand-file-name "hyperbole-autoloads.el"))
         (backup-inhibited t))
-    (update-directory-autoloads ".")
+    (make-directory-autoloads ".")
     (setq generated-autoload-file (expand-file-name "kotl/kotl-autoloads.el"))
-    (update-directory-autoloads "kotl/"))
+    (make-directory-autoloads "kotl/"))
   (unless (hyperb:autoloads-exist-p)
     (error (format "Hyperbole failed to generate autoload files; try running 
'make src' in a shell in %s" hyperb:dir))))
 



reply via email to

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