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

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

[elpa] externals/eev f256747 14/20: Rewrote `find-man' completely to fix


From: Stefan Monnier
Subject: [elpa] externals/eev f256747 14/20: Rewrote `find-man' completely to fix a long-standing bug.
Date: Mon, 4 Jan 2021 01:01:51 -0500 (EST)

branch: externals/eev
commit f2567476045cca80147e90b67000c202ebb7b20c
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>

    Rewrote `find-man' completely to fix a long-standing bug.
---
 ChangeLog     | 12 ++++++++++
 VERSION       |  4 ++--
 eev-blinks.el | 73 +++++++++++++++++++++++++++++++++++++++++++----------------
 eev-code.el   |  4 ++--
 4 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a3aff24..a87260d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
+2020-12-29  Eduardo Ochs  <eduardoochs@gmail.com>
+
+       * eev-blinks.el (Man-translate-references): add autoload.
+       (Man-notify-when-ready): removed the defadvice.
+       (ee-find-man-buffer): new variable.
+       (ee-find-man-goto-pos-spec): new function.
+       (Man-bgproc-sentinel): new advice-add.
+       (find-man): rewrote completely.
+
 2020-12-28  Eduardo Ochs  <eduardoochs@gmail.com>
 
+       * eev-code.el (ee-code-c-d-:gz): commented out the
+       `(ee-use-{c}-tags)'.
+
        * eev-intro.el (find-anchors-intro): rewrote completely.
 
 2020-12-22  Eduardo Ochs  <eduardoochs@gmail.com>
diff --git a/VERSION b/VERSION
index 94bb1da..9d6bf5a 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Mon Dec 28 05:27:26 GMT 2020
-Mon Dec 28 02:27:26 -03 2020
+Tue Dec 29 09:44:53 GMT 2020
+Tue Dec 29 06:44:53 -03 2020
diff --git a/eev-blinks.el b/eev-blinks.el
index c10f89a..de336b9 100644
--- a/eev-blinks.el
+++ b/eev-blinks.el
@@ -21,7 +21,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    2020oct02
+;; Version:    2020dec29
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-blinks.el>
@@ -83,7 +83,8 @@
 ;;
 (autoload 'find-function-read "find-func")
 (autoload 'pp-to-string "pp")
-(autoload 'Man-fontify-manpage "man" nil t)
+(autoload 'Man-translate-references "man")
+(autoload 'Man-fontify-manpage      "man" nil t)
 (autoload 'word-at-point "thingatpt")
 (autoload 'list-iso-charset-chars     "mule-diag")
 (autoload 'list-non-iso-charset-chars "mule-diag")
@@ -118,6 +119,7 @@ An example: (eek \"C-x 4 C-h\")"
 ;; «ee-goto-position»  (to ".ee-goto-position")
 ;; Support for pos-spec-lists in hyperlinks.
 ;; See: (find-eval-intro "6. Refining hyperlinks")
+;;      (find-refining-intro "1. Pos-spec-lists")
 
 (defun ee-goto-position (&optional pos-spec &rest rest)
   "Process the \"absolute pos-spec-lists\" arguments in hyperlink functions.
@@ -637,29 +639,63 @@ This is like `find-sh' but sets the buffer's 
default-directory to DIR."
 ;; Hyperlinks to manpages.
 ;; Tests:
 ;;   (find-man "1 cat")
+;;   (find-man "bash(1)")
+;;   (find-man "bash(1)" "multi-character")
 
 (defvar ee-find-man-flag          nil "See `find-man'.")
+(defvar ee-find-man-buffer        nil "See `find-man'.")
 (defvar ee-find-man-pos-spec-list nil "See `find-man'.")
 
-;; See: (to "find-man-bug")
 (defun find-man (manpage &rest pos-spec-list)
   "Hyperlink to a manpage."
   (interactive (list (ee-manpagename-ask)))
-  (setq ee-find-man-flag t
-       ee-find-man-pos-spec-list pos-spec-list)
-    (man manpage))
-
-;; See: (find-elnode "Advising Functions")
-;;      (find-elnode "Porting old advice")
-;;      (find-efunctiondescr 'defadvice)
-(defadvice Man-notify-when-ready (around find-man (man-buffer) activate)
-  "After rendering a manpage jump to `ee-find-man-pos-spec-list'."
-  (if (not ee-find-man-flag)
-      ad-do-it
-    (switch-to-buffer man-buffer)
-    (apply 'ee-goto-position ee-find-man-pos-spec-list)
-    (setq ee-find-man-flag nil)))
-
+  (setq manpage (Man-translate-references manpage))
+  ;;
+  ;; Set the variables used by `ee-find-man-goto-pos-spec'.
+  (setq ee-find-man-flag t)
+  (setq ee-find-man-buffer (concat "*Man " manpage "*"))
+  (setq ee-find-man-pos-spec-list pos-spec-list)
+  ;;
+  ;; See: (find-evardescr 'Man-notify-method "pushy" "current window")
+  (let ((Man-notify-method 'pushy))
+    ;;
+    ;; This call to `man' will run `ee-find-man-goto-pos-spec' after
+    ;; the manpage is rendered - because of the `advice-add' below.
+    ;; This is a dirty trick!... see:
+    ;; https://lists.gnu.org/archive/html/help-gnu-emacs/2020-12/msg01100.html
+    ;; https://lists.gnu.org/archive/html/help-gnu-emacs/2020-12/msg01102.html
+    (man manpage)))
+
+(defun ee-find-man-goto-pos-spec (&rest rest)
+  "An internal function used by `find-man'."
+  (when ee-find-man-flag
+    (setq ee-find-man-flag nil)
+    (with-current-buffer ee-find-man-buffer
+      (apply 'ee-goto-position ee-find-man-pos-spec-list))))
+    
+(advice-add 'Man-bgproc-sentinel :after 'ee-find-man-goto-pos-spec)
+
+
+;; 2020dec29: all this block was commented out.
+;;
+;; (defun find-man (manpage &rest pos-spec-list)
+;;   "Hyperlink to a manpage."
+;;   (interactive (list (ee-manpagename-ask)))
+;;   (setq ee-find-man-flag t
+;;     ee-find-man-pos-spec-list pos-spec-list)
+;;     (man manpage))
+;;
+;; ;; See: (find-elnode "Advising Functions")
+;; ;;      (find-elnode "Porting old advice")
+;; ;;      (find-efunctiondescr 'defadvice)
+;; (defadvice Man-notify-when-ready (around find-man (man-buffer) activate)
+;;   "After rendering a manpage jump to `ee-find-man-pos-spec-list'."
+;;   (if (not ee-find-man-flag)
+;;       ad-do-it
+;;     (switch-to-buffer man-buffer)
+;;     (apply 'ee-goto-position ee-find-man-pos-spec-list)
+;;     (setq ee-find-man-flag nil)))
+;;
 ;; «find-man-bug»  (to ".find-man-bug")
 ;; Note: find-man has an open bug that I did not have time to fix yet...
 ;; an example:
@@ -682,7 +718,6 @@ This is like `find-sh' but sets the buffer's 
default-directory to DIR."
 ;; 
 ;;   (find-man "1 git-commit" "-m <msg>, --message=<msg>")
 
-
 ;; Missing: find-woman.
 ;; (find-node "(woman)Top")
 ;; (woman   "cat")
diff --git a/eev-code.el b/eev-code.el
index ff8e77e..d1e4e8d 100644
--- a/eev-code.el
+++ b/eev-code.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    2020dec20
+;; Version:    2020dec28
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-code.el>
@@ -239,7 +239,7 @@ Try this: (find-code-c-d \"CODE\" \"/DIR/\" :info \"INFO\")"
    ;; {(ee-S `(ee-code-c-d-:gz ,c ,d ,@rest))}
    (defun find-{c}file (str &rest pos-spec-list)
      (interactive (list \"\"))
-     (ee-use-{c}-tags)
+     ;; (ee-use-{c}-tags)
      (apply 'find-fline-gz (ee-{c}file str) pos-spec-list))
    ") (ee-code-c-d-rest c d rest)))
 



reply via email to

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