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

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

[elpa] externals/hyperbole 5140f17 01/13: Fixed a few bugs


From: Stefan Monnier
Subject: [elpa] externals/hyperbole 5140f17 01/13: Fixed a few bugs
Date: Sun, 12 May 2019 11:11:45 -0400 (EDT)

branch: externals/hyperbole
commit 5140f178dcc6b2c06d7d183ece3724fa13e2a827
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>

    Fixed a few bugs
---
 Changes            | 33 +++++++++++++++++++++++++++++++++
 HY-NEWS            |  5 +++++
 hact.el            |  5 +++--
 hargs.el           | 17 +++++++++++++++--
 hibtypes.el        | 36 ++++++++----------------------------
 hmouse-tag.el      | 13 +++++++++++--
 hui-mouse.el       | 17 ++++++++++++-----
 hui-treemacs.el    |  7 ++++++-
 man/hkey-help.txt  |  3 ++-
 man/hyperbole.texi |  6 +++++-
 smart-clib-sym     |  0
 topwin.py          |  0
 12 files changed, 100 insertions(+), 42 deletions(-)

diff --git a/Changes b/Changes
index 8b13892..5e557de 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,36 @@
+2019-02-05  Bob Weiner  <address@hidden>
+
+* hmouse-tag.el (smart-lisp-mode-p): Removed change-log-mode.
+    (smart-lisp-at-change-log-tag-p): Added so can match
+      only to bound Elisp entities in change-log-mode with '-' in
+      the middle of their names to prevent false positives.
+  hui-mouse.el (hkey-alist): Added tightened change-log-mode handling.
+   man/hyperbole.texi (Smart Key - Lisp Source Code): Documented change.
+
+* hargs.el (hargs:delimited): Fixed that strings on lines with an odd number
+    of delimiters might fail to match.  Since strings can span lines but this
+    function matches only strings that start on the current line, when
+    start-delim and end-delim are the same and there are an odd number of
+    delimiters in the search range, assume point is within a
+    string and not between two other strings.
+    For example, with the following text and point within "DEMO", its path
+    previously was not found:
+      For each site, the links are properly maintained.  See "DEMO#Path
+      suffixes and Variables" and "DEMO#Path Prefixes".  "DEMO"
+
+* hui-treemacs.el: Deleted treemacs-mode from aw-ignored-buffers so can select
+    a Treemacs window via ace-window.
+
+2019-02-04  Bob Weiner  <address@hidden>
+
+* hui-mouse.el (smart-dired-assist): Prevented any region selection from
+    causing multiple files to be marked for deletion; we want to mark
+    only one.
+
+* hibtypes.el (annot-bib): Stopped this from activating when in org-mode to 
avert false positives.
+              (markdown-follow-inline-link-p, markdown-internal-link): Added 
ibut:label-set
+    to show a decent approximation of the button label when displaying help.
+
 2019-02-03  Bob Weiner  <address@hidden>
 
 * hversion.el: Pushed BW changes for 7.0.2b test update.
diff --git a/HY-NEWS b/HY-NEWS
index c1f8fbb..a80e1b2 100644
--- a/HY-NEWS
+++ b/HY-NEWS
@@ -73,6 +73,11 @@
 
     - ChangeLog Mode: Smart Keys now work on Emacs Lisp references in 
changelogs.
 
+    - Improved String Matching: For lines that begin with part of a string that
+      started on another line, Hyperbole now presumes that point is within a 
string
+      rather than between two strings, even though the delimiters on the line
+      make this ambiguous.  This provides more accurate string recognition.
+
   HYCONTROL
 
     - Help Buffer Quitting: If HyControl is active, normally {q} quits
diff --git a/hact.el b/hact.el
index 67e79da..e765732 100644
--- a/hact.el
+++ b/hact.el
@@ -259,9 +259,10 @@ Other paths are simply expanded.  Non-path arguments are 
returned unchanged."
 ;;; ========================================================================
 
 (defmacro hact (&rest args)
-  "Performs action formed from rest of ARGS.
+  "Performs action formed from rest of ARGS and returns the result or acts as 
a no-op when testing implicit button type contexts.
 First arg may be a symbol or symbol name for either an action type or a
-function.  Runs `action-act-hook' before performing action."
+function.  Runs `action-act-hook' before performing action.
+The value of `hrule:action' determines what effect this has."
   (eval `(cons 'funcall (cons 'hrule:action ',args))))
 
 (defun    actype:act (actype &rest args)
diff --git a/hargs.el b/hargs.el
index 822f967..f87628e 100644
--- a/hargs.el
+++ b/hargs.el
@@ -100,7 +100,7 @@ interactive form or takes no arguments."
 
 (defun hargs:delimited (start-delim end-delim
                        &optional start-regexp-flag end-regexp-flag 
list-positions-flag)
-  "Returns a normalized, single line, delimited string that point is within, 
or nil.
+  "Returns a normalized, single line, delimited string that point is within 
the first line of, or nil.
 START-DELIM and END-DELIM are strings that specify the argument
 delimiters.  With optional START-REGEXP-FLAG non-nil, START-DELIM is
 treated as a regular expression.  END-REGEXP-FLAG is similar.
@@ -112,17 +112,29 @@ With optional LIST-POSITIONS-FLAG, return list of 
(string-matched start-pos end-
                              'search-forward))
         (end-search-func (if end-regexp-flag 're-search-forward
                            'search-forward))
+        (count 0)
         start end)
     (save-excursion
       (beginning-of-line)
       (while (and (setq start (funcall start-search-func start-delim limit t))
+                 (setq count (1+ count))
                  (< (point) opoint)
                  ;; This is not to find the real end delimiter but to find
                  ;; end delimiters that precede the current argument and are
                  ;; therefore false matches, hence the search is limited to
                  ;; prior to the original point.
-                 (funcall end-search-func end-delim opoint t))
+                 (funcall end-search-func end-delim opoint t)
+                 (setq count (1+ count)))
        (setq start nil))
+      (when (and (not start) (> count 0) (evenp count) (string-equal 
start-delim end-delim))
+       ;; Since strings can span lines but this function matches only
+       ;; strings that start on the current line, when start-delim and
+       ;; end-delim are the same and there are an even number of
+       ;; delimiters in the search range, causing the end-delim
+       ;; search to match to what should probably be the start-delim,
+       ;; assume point is within a string and not between two other strings.
+       ;; RSW - 02/05/2019
+       (setq start (point)))
       (when start
        (forward-line 2)
        (setq limit (point))
@@ -142,6 +154,7 @@ With optional LIST-POSITIONS-FLAG, return list of 
(string-matched start-pos end-
                 (setq end (1- end))
               t)
             (< start end)
+            (>= end opoint)
             (let ((string (hargs:buffer-substring start end)))
               (setq string (hypb:replace-match-string "[\n\r\f]\\s-*" string " 
" t))
               (unless hyperb:microsoft-os-p
diff --git a/hibtypes.el b/hibtypes.el
index f682c6e..37a8107 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -250,29 +250,6 @@ current major mode is one handled by func-menu."
                (hact 'function-in-buffer function-name function-pos)))))))
 
 ;;; ========================================================================
-;;; Use the Emacs imenu library to jump to definition of an identifier
-;;; defined in the same file in which it is referenced.  Identifier
-;;; references across files are handled separately by clauses within
-;;; the `hkey-alist' variable.
-;;; ========================================================================
-
-;;; This implicit button type is not needed because hkey-alist handles imenu 
items.
-;; (defib imenu-item ()
-;;   "Displays the in-buffer definition of an identifier that point is within 
or after, else nil.
-;; This triggers only when imenu has already been used to generate an 
in-buffer item index."
-;;   (when (and (featurep 'imenu) imenu--index-alist)
-;;     (save-excursion
-;;       (skip-syntax-backward "w_")
-;;       (if (looking-at "\\(\\sw\\|\\s_\\)+")
-;;       (let* ((item-name (buffer-substring-no-properties (point) (match-end 
0)))
-;;              (start (point))
-;;              (end (match-end 0))
-;;              (item-pos (imenu-item-p item-name)))
-;;         (when item-pos
-;;           (ibut:label-set item-name start end)
-;;           (hact 'imenu-display-item-where item-name item-pos)))))))
-
-;;; ========================================================================
 ;;; Handles internal references within an annotated bibliography, delimiters=[]
 ;;; ========================================================================
 
@@ -287,7 +264,7 @@ must have an attached file."
        (let ((chr (aref (buffer-name) 0)))
         (not (or (eq chr ?\ ) (eq chr ?*))))
        (not (or (derived-mode-p 'prog-mode)
-               (memq major-mode '(c-mode objc-mode c++-mode java-mode 
markdown-mode))))
+               (apply #'derived-mode-p '(c-mode objc-mode c++-mode java-mode 
markdown-mode org-mode))))
        (let* ((ref-and-pos (hbut:label-p t "[" "]" t))
              (ref (car ref-and-pos)))
         (and ref (eq ?w (char-syntax (aref ref 0)))
@@ -342,10 +319,11 @@ Returns t if jumps and nil otherwise."
             ;; Leave point on the link even if not activated
             ;; here, so that code elsewhere activates it.
             (if (and (markdown-link-p)
-                     (not (or (hpath:www-at-p) (hpath:at-p))))
-                ;; In-file referents will be handled later by the
-                ;; pathname implicit type, not here.
-                (progn (hpath:display-buffer (current-buffer))
+                     (save-match-data (not (or (hpath:www-at-p) 
(hpath:at-p)))))
+                ;; In-file referents are handled by the 
'markdown-internal-link'
+                ;; implicit button type, not here.
+                (progn (ibut:label-set (match-string-no-properties 0) 
(match-beginning 0) (match-end 0))
+                       (hpath:display-buffer (current-buffer))
                        (hact 'markdown-follow-link-at-point))))
     (goto-char opoint)
     nil))
@@ -361,6 +339,7 @@ Returns t if jumps and nil otherwise."
                 ;; Follows a reference link or footnote to its referent.
                 (if (markdown-follow-link-p)
                     (when (/= opoint (point))
+                      (ibut:label-set (match-string-no-properties 0) 
(match-beginning 0) (match-end 0))
                       (setq npoint (point))
                       (goto-char opoint)
                       (hact 'link-to-file buffer-file-name npoint))
@@ -370,6 +349,7 @@ Returns t if jumps and nil otherwise."
               ;; link itself and follow that.
               (error (markdown-follow-inline-link-p opoint))))
            ((markdown-wiki-link-p)
+            (ibut:label-set (match-string-no-properties 0) (match-beginning 0) 
(match-end 0))
             (hpath:display-buffer (current-buffer))
             (hact 'markdown-follow-wiki-link-at-point))))))
             
diff --git a/hmouse-tag.el b/hmouse-tag.el
index 18e7c64..49e9046 100644
--- a/hmouse-tag.el
+++ b/hmouse-tag.el
@@ -636,6 +636,15 @@ buffer."
       (beginning-of-line)
       (looking-at "\\(;*[ \t]*\\)?(\\(autoload\\|load\\|require\\)")))
 
+(defun smart-lisp-at-change-log-tag-p ()
+  "When in a change-log mode, match to only bound Elisp identifiers and those 
with a '-' somewhere in the middle.
+These tight tests help eliminate undesired matches.
+Returns matching ELisp tag name that point is within, else nil."
+  (when (derived-mode-p 'change-log-mode)
+    (let ((identifier (smart-lisp-at-tag-p)))
+      (and identifier (intern-soft identifier)
+          (string-match "[^-]-[^-]" identifier)))))
+
 (defun smart-lisp-at-tag-p (&optional no-flash)
   "Returns Lisp tag name that point is within, else nil.
 Returns nil when point is on the first line of a non-alias Lisp definition."
@@ -645,7 +654,7 @@ Returns nil when point is on the first line of a non-alias 
Lisp definition."
       (save-excursion
        (skip-chars-backward identifier-chars)
        (if (and (looking-at identifier)
-                ;; Ignore any all punctuation matches.
+                ;; Ignore any punctuation matches.
                 (not (string-match "\\`[-<>*]+\\'" (match-string 0)))
                 ;; Needed to set match string.
                 (looking-at identifier))
@@ -665,7 +674,7 @@ Returns nil when point is on the first line of a non-alias 
Lisp definition."
 (defun smart-lisp-mode-p ()
   "Return t if in a mode which uses Lisp symbols."
   (or (smart-emacs-lisp-mode-p)
-      (memq major-mode '(lisp-mode scheme-mode change-log-mode))))
+      (memq major-mode '(lisp-mode scheme-mode))))
 
 ;;;###autoload
 (defun smart-objc (&optional identifier next)
diff --git a/hui-mouse.el b/hui-mouse.el
index 2d32025..7fc9759 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -272,8 +272,11 @@ Its default value is #'smart-scroll-down."
          buffer-file-name (smart-asm-at-tag-p)) .
          ((smart-asm) . (smart-asm nil 'next-tag)))
     ;;
-    ((and (smart-lisp-mode-p) (smart-lisp-at-tag-p)) .
-     ((smart-lisp) . (smart-lisp 'show-doc)))
+    ((or (and (smart-lisp-mode-p) (smart-lisp-at-tag-p))
+        ;; Tightly limit Lisp matches in change-log-mode.
+        (smart-lisp-at-change-log-tag-p)) .
+        ((smart-lisp) . (smart-lisp 'show-doc)))
+    ;;
     ;;
     ((and (eq major-mode 'java-mode) buffer-file-name
          (or (smart-java-at-tag-p)
@@ -736,9 +739,13 @@ If assist-key is pressed:
         (goto-char (point-max)))
        ((looking-at "~") (dired-flag-backup-files))
        ((looking-at "#") (dired-flag-auto-save-files))
-       (t (if (fboundp 'dired-flag-file-deletion)
-              (dired-flag-file-deletion 1)
-            (dired-flag-file-deleted 1)))))
+       (t 
+        ;; Prevent any region selection from causing multiple files
+        ;; to be marked for deletion; we want to mark only one.
+        (deactivate-mark t)
+        (if (fboundp 'dired-flag-file-deletion)
+            (dired-flag-file-deletion 1)
+          (dired-flag-file-deleted 1)))))
 
 ;;; ************************************************************************
 ;;; smart-gnus functions
diff --git a/hui-treemacs.el b/hui-treemacs.el
index d653645..4b750b4 100644
--- a/hui-treemacs.el
+++ b/hui-treemacs.el
@@ -18,13 +18,18 @@
 
 (eval-and-compile (require 'treemacs nil t))
 
-(unless (string-greaterp treemacs-version "v2")
+(unless (and (featurep 'treemacs) (string-greaterp treemacs-version "v2"))
   (error "(hui-treemacs): Hyperbole requires Treemacs package version 2.0 or 
greater"))
 
 ;;; ************************************************************************
 ;;; smart-treemacs functions
 ;;; ************************************************************************
 
+;; Want to be able to select Treemacs window with ace-window.
+;; This also averts window labeling problems with ace-window.
+(eval-after-load "ace-window"
+  '(setq aw-ignored-buffers (delq 'treemacs-mode aw-ignored-buffers)))
+
 (unless (fboundp 'treemacs-quit)
   (fset 'treemacs-quit #'bury-buffer))
 
diff --git a/man/hkey-help.txt b/man/hkey-help.txt
index 25dca92..2ba4cad 100644
--- a/man/hkey-help.txt
+++ b/man/hkey-help.txt
@@ -81,7 +81,8 @@ Hyperbole Key Press/Click in Special Modes
   Assembly Language Mode        Jumps to id/include def    Jumps to next def
   Java Cross-reference Tag      Jumps to identifier def    Jumps to next def
   JavaScript and Python Modes   Jumps to identifier def    Jumps to next def
-  Any Lisp or Fortran Mode      Jumps to identifier def    Jumps to next def
+  Any Known Lisp or ChangeLog   Jumps to identifier def    Referent Doc
+  Fortran Mode                  Jumps to identifier def    Jumps to next def
   Emacs Lisp Compiler Error     Jumps to def with error    <- same
   Other Compiler Error          Jumps to src error line    <- same
   Grep or Occur Match           Jumps to match source line <- same
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 7c20b66..480be1b 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -8401,8 +8401,12 @@ When pressed within an assembly source code file:
 
 @format
 @group
address@hidden change-log-mode
address@hidden lisp identifier
address@hidden elisp identifier
 When pressed on a Lisp symbol within any of these types of buffers
-(Lisp code, debugger, compilation, or help):
+(Lisp code, debugger, compilation, or help) or in change-log-mode
+on an Emacs Lisp bound identifier:
   ACTION KEY
      Jumps to the definition of any selected Lisp construct.  If on an
      Emacs Lisp require, load, or autoload clause and the (find-library)
diff --git a/smart-clib-sym b/smart-clib-sym
old mode 100755
new mode 100644
diff --git a/topwin.py b/topwin.py
old mode 100755
new mode 100644



reply via email to

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