[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole c30a718 18/51: Fix out-of-date imenu index af
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hyperbole c30a718 18/51: Fix out-of-date imenu index after buffer changes |
Date: |
Sun, 12 Jul 2020 18:10:11 -0400 (EDT) |
branch: externals/hyperbole
commit c30a7182c61e914d34d67dffee9484447a4d84ea
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Fix out-of-date imenu index after buffer changes
---
Changes | 9 ++++++++-
hmouse-drv.el | 10 +++++-----
hui-mouse.el | 51 ++++++++++++++++++++++++++++++++-------------------
hui-window.el | 2 +-
4 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/Changes b/Changes
index 3ffbd56..8d18a8f 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,13 @@
+2020-02-01 Bob Weiner <rsw@gnu.org>
+
+* hui-mouse.el (smart-imenu-item-p): Fixed to handle invalid marker positions
after buffer changes
+ when imenu-auto-rescan is false.
+
+* hmouse-drv.el (hkey-execute, hkey-help): Simplified with cddr and cadr calls.
+
2020-01-31 Bob Weiner <rsw@gnu.org>
-* hui-em-but.el (hproperty:set-flash-color):
+* hui-em-but.el (hproperty:set-flash-color):
(hproperty:set-face-after-init): Resolved issue that explicit
buttons were not
being highlighted upon load and that explicit and named implicit buttons
were not flashing
properly when activated due to improper face settings.
diff --git a/hmouse-drv.el b/hmouse-drv.el
index 9daa51c..631d8f2 100644
--- a/hmouse-drv.el
+++ b/hmouse-drv.el
@@ -378,8 +378,8 @@ Optional prefix arg non-nil means emulate Assist Key rather
than the
Action Key.
Works only when running under a window system, not from a dumb terminal."
- ;; Note: Cannot add start-window as first parameter to this function
- ;; because it is called like many other functions herein with a
+ ;; Note: Cannot add free variable start-window as first parameter to this
+ ;; function because it is called like many other functions herein with a
;; single release-window argument by 'hmouse-choose-windows'.
;; Cancel any partial drag that may have been recorded.
@@ -753,12 +753,12 @@ Return non-nil iff a non-nil predicate is found."
(let ((hkey-forms hkey-alist)
(pred-value) (hkey-action) hkey-form pred)
(while (and (null pred-value) (setq hkey-form (car hkey-forms)))
- (if (setq hkey-action (if assist-flag (cdr (cdr hkey-form)) (car (cdr
hkey-form)))
+ (if (setq hkey-action (if assist-flag (cddr hkey-form) (cadr hkey-form))
pred (car hkey-form)
pred-value (eval pred))
;; Conditionally debug after Smart Key release and evaluation
;; of matching predicate but before hkey-action is executed.
- (progn (if hkey-debug (hkey-debug))
+ (progn (when hkey-debug (hkey-debug))
(eval hkey-action))
(setq hkey-forms (cdr hkey-forms))))
pred-value))
@@ -779,7 +779,7 @@ Return non-nil iff associated help documentation is found."
(setq hkey-forms (cdr hkey-forms))))
(if pred-value
(setq call (if assist-flag (cdr (cdr hkey-form))
- (car (cdr hkey-form)))
+ (cadr hkey-form))
cmd-sym (car call))
(setq cmd-sym (if assist-flag assist-key-default-function
action-key-default-function)
call cmd-sym))
diff --git a/hui-mouse.el b/hui-mouse.el
index 0c3193b..fa289ac 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -1205,26 +1205,39 @@ sets `hkey-value' to (identifier .
identifier-definition-buffer-position)."
(cdr hkey-value)))
;; Derived from `imenu' function in the imenu library.
-(defun smart-imenu-item-p (index-item &optional variable-flag)
- "If INDEX-ITEM is in the current buffer's imenu, return its definition
marker position, else nil.
-If INDEX-ITEM is both a function and a variable, the function
+(defun smart-imenu-item-p (index-key &optional variable-flag no-recurse-flag)
+ "If INDEX-KEY is in the current buffer's imenu, return its definition marker
position, else nil.
+If INDEX-KEY is both a function and a variable, the function
definition is used by default; in such a case, when optional
-VARIABLE-FLAG is non-nil, the variable definition is used instead."
- (when (stringp index-item)
- ;; Convert a string to an alist element.
- (if variable-flag
- ;; Match to variable definitions only.
- (setq index-item (assoc index-item
- (cdr (assoc "Variables"
(imenu--make-index-alist)))))
- ;; First try to match a function definition and if that fails,
- ;; then allow variable definitions and other types of matches as well.
- (let ((alist (imenu--make-index-alist)))
- (setq index-item (or (assoc index-item alist)
- ;; Does nothing unless the dash Emacs Lisp
- ;; library is available for the -flatten function.
- (and (require 'dash nil t)
- (assoc index-item (-flatten alist)))))))
- (if index-item (cdr index-item))))
+VARIABLE-FLAG is non-nil, the variable definition is used instead.
+NO-RECURSE-FLAG non-nil prevents infinite recursions."
+ (when (stringp index-key)
+ (let (index-item
+ index-position)
+ ;; Convert a string to an alist element.
+ (if variable-flag
+ ;; Match to variable definitions only.
+ (setq index-item (assoc index-key
+ (cdr (assoc "Variables"
(imenu--make-index-alist)))))
+ ;; First try to match a function definition and if that fails,
+ ;; then allow variable definitions and other types of matches as well.
+ (let ((alist (imenu--make-index-alist)))
+ (setq index-item (or (assoc index-key alist)
+ ;; Does nothing unless the dash Emacs Lisp
+ ;; library is available for the -flatten
function.
+ (and (require 'dash nil t)
+ (assoc index-key (-flatten alist)))))))
+ (when index-item
+ (setq index-position (when (markerp (cdr index-item))
+ (marker-position (cdr index-item))))
+ (if (and (eq index-position 1) (not no-recurse-flag))
+ ;; If index position is 1, this means the index markers have
+ ;; become out of date after buffer edits (likely imenu-auto-rescan
+ ;; is nil), so do a single rescan to try to fix this.
+ (progn (setq imenu--index-alist nil)
+ (imenu--make-index-alist t)
+ (smart-imenu-item-p index-key variable-flag t))
+ index-position)))))
;;; ************************************************************************
;;; smart-info functions
diff --git a/hui-window.el b/hui-window.el
index fe35813..737c3e9 100644
--- a/hui-window.el
+++ b/hui-window.el
@@ -72,7 +72,7 @@
(eval-when-compile (defvar assist-flag nil)) ;; Silences free variable
compiler warnings
(require 'hycontrol)
-;; For momentary highlighting of buffer/file item lines.
+;; If installed, use pulse library for momentary highlighting of buffer/file
item lines.
(require 'pulse nil t)
;;; ************************************************************************
- [elpa] externals/hyperbole e654a6d 02/51: Fail packaging when proper version number is missing, (continued)
- [elpa] externals/hyperbole e654a6d 02/51: Fail packaging when proper version number is missing, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 55a8009 05/51: Fail packaging when proper version number is missing, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 88e8aab 06/51: 7.0.8 test release: XML markup tag selection; global button renaming, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 62f3fd2 01/51: 7.0.7 test release: many changes, new logo; fixed def macros, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 7aa8e62 03/51: Merge pull request #20 from rswgnu/make-make-release-fail-on-wrong-version-number, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole cac90b5 10/51: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 0f8c29e 07/51: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole d087a82 11/51: Fixes for 7.0.8 test release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole fc7c511 15/51: Merge branch 'master' of hyperbole, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 4f0a651 16/51: hproperty:but-flash-time - revert value from 0.05 back to 1000, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole c30a718 18/51: Fix out-of-date imenu index after buffer changes,
Stefan Monnier <=
- [elpa] externals/hyperbole 766ac22 04/51: Large commit of RSW changes, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 9e2b4ba 08/51: hui-select.el - remove require of kotl-mode; caused cyclical loads, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 8e6ea41 12/51: Fix ibut handling in programming modes; add button links to glossary, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole ad4dc9f 09/51: Makefile - add missing gzipped tar file dependency to 'ftp' target, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 0e1203c 32/51: Publish 7.1.0 test release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole c565349 33/51: Fix entry addition which was failing due to level handling change, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole db4dd6c 13/51: Use float for delay instead of looping (#21), Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 5119a4c 17/51: hui-em-but.el: Properly highlight explicit buttons when loading, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 9a94a8f 19/51: Fix hproperty:item-highlight-color init error; add regional 'throw', Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 45fff9a 23/51: Many bug fixes and improvements, Stefan Monnier, 2020/07/12