[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole d1fb45a 15/53: File/Dir linking fix; Smart Ke
From: |
Robert Weiner |
Subject: |
[elpa] externals/hyperbole d1fb45a 15/53: File/Dir linking fix; Smart Key reloading; helm mouse control improvements; Hyperbole menu use doc strings |
Date: |
Wed, 15 Nov 2017 22:47:00 -0500 (EST) |
branch: externals/hyperbole
commit d1fb45a4127d60337c18a94ce99995bd758ae3bd
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>
File/Dir linking fix; Smart Key reloading; helm mouse control improvements;
Hyperbole menu use doc strings
* hui-mini.el (hui:menu-item): Improved so that if menu item has no help
string but its action is a
function with a doc string, then it will use the first line of the
action doc string for displaying
help on the item.
* hmouse-key.el (hmouse-check-action-key, hmouse-check-assist-key): Added
to check that both depress
and release events are set to Smart Mouse Keys. Mainly for use with
helm. Called from smart-helm
and smart-helm-assist respectively.
* hui-mouse.el (action-key-error, assist-key-error): Maded explicit these
are messages from Hyperbole.
(smart-helm-at-header): Corrected doc string.
(smart-helm-at): Added to test type of helm thing point is at.
(smart-helm, smart-helm-assist): Updated to complement each
other better; made section header
clicks work.
* hmouse-key.el (hmouse-add-unshifted-smart-keys): Renamed from
hmouse-add-unshifted-keys.
Made interactive and added error if invoked under something other than
GNU Emacs 19 or higher.
(hmouse-update-smart-keys): Added to provide interactive
updating of Smart Keys
whenever a matching context or action has been changed in the source
code; reloads any
changes to "hui-mouse", "hui-window", "hibtypes" or "hactypes", most
notably changes to
hkey-alist and hmouse-alist.
* hui-mouse.el (hkey-alist, smart-outline-char-invisible-p, smart-eolp):
Added and used to improve and narrow matching of end-of-lines.
Previously, did not handle
new-style Emacs outlines properly nor helm section header lines.
* kotl/kotl-mode.el (kotl-mode:action-key, kotl-mode:assist-key):
hui-mouse.el (smart-outline, smart-outline-assist): Changed to invoke
action/assist-key-eol-function
for end-of-line scrolling, eliminating hard-coded call.
man/hyperbole.texi (Smart Key - Emacs Outline Mode): Documented this
change.
* hargs.el (hargs:at-p): Fixed bug when linking to files or directories,
would choose
symbol at Action Key release point rather than the file or directory
containing
that symbol. This was caused by allowing matches to non-existent files
and dirs
when the 'no-default' argument was t. Now prevented such matching.
This could
occur when creating or editing explicit button links.
---
.hypb | Bin 2645 -> 2682 bytes
Changes | 38 ++++++++++
DEMO | 14 ++--
hargs.el | 8 +--
hmouse-key.el | 37 +++++++++-
hmouse-sh.el | 6 +-
hpath.el | 24 +++----
hui-mini.el | 8 ++-
hui-mouse.el | 201 +++++++++++++++++++++++++++++++++++++++--------------
kotl/kotl-mode.el | 10 +--
kotl/kview.el | 8 +--
man/hyperbole.texi | 6 +-
12 files changed, 268 insertions(+), 92 deletions(-)
diff --git a/.hypb b/.hypb
index 38dedb9..64a7049 100644
Binary files a/.hypb and b/.hypb differ
diff --git a/Changes b/Changes
index 3a1f450..71b62aa 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,41 @@
+2017-09-25 Bob Weiner <address@hidden>
+
+* hui-mini.el (hui:menu-item): Improved so that if menu item has no help
string but its action is a
+ function with a doc string, then it will use the first line of the action
doc string for displaying
+ help on the item.
+
+* hmouse-key.el (hmouse-check-action-key, hmouse-check-assist-key): Added to
check that both depress
+ and release events are set to Smart Mouse Keys. Mainly for use with helm.
Called from smart-helm
+ and smart-helm-assist respectively.
+
+* hui-mouse.el (action-key-error, assist-key-error): Maded explicit these are
messages from Hyperbole.
+ (smart-helm-at-header): Corrected doc string.
+ (smart-helm-at): Added to test type of helm thing point is at.
+ (smart-helm, smart-helm-assist): Updated to complement each
other better; made section header
+ clicks work.
+
+* hmouse-key.el (hmouse-add-unshifted-smart-keys): Renamed from
hmouse-add-unshifted-keys.
+ Made interactive and added error if invoked under something other than GNU
Emacs 19 or higher.
+ (hmouse-update-smart-keys): Added to provide interactive
updating of Smart Keys
+ whenever a matching context or action has been changed in the source
code; reloads any
+ changes to "hui-mouse", "hui-window", "hibtypes" or "hactypes", most
notably changes to
+ hkey-alist and hmouse-alist.
+
+* hui-mouse.el (hkey-alist, smart-outline-char-invisible-p, smart-eolp):
+ Added and used to improve and narrow matching of end-of-lines.
Previously, did not handle
+ new-style Emacs outlines properly nor helm section header lines.
+
+* kotl/kotl-mode.el (kotl-mode:action-key, kotl-mode:assist-key):
+ hui-mouse.el (smart-outline, smart-outline-assist): Changed to invoke
action/assist-key-eol-function
+ for end-of-line scrolling, eliminating hard-coded call.
+ man/hyperbole.texi (Smart Key - Emacs Outline Mode): Documented this change.
+
+* hargs.el (hargs:at-p): Fixed bug when linking to files or directories, would
choose
+ symbol at Action Key release point rather than the file or directory
containing
+ that symbol. This was caused by allowing matches to non-existent files
and dirs
+ when the 'no-default' argument was t. Now prevented such matching. This
could
+ occur when creating or editing explicit button links.
+
2017-09-24 Bob Weiner <address@hidden>
* hib-social.el (hibtypes-git-get-locate-command): Added this function to
trigger an
diff --git a/DEMO b/DEMO
index 459ab26..f9f1cd1 100644
--- a/DEMO
+++ b/DEMO
@@ -1,6 +1,9 @@
+
+
+
* GNU Hyperbole Demonstration and Introduction by Bob Weiner
Welcome to GNU Hyperbole. Hyperbole will super-charge your GNU Emacs
@@ -463,8 +466,7 @@ The file "hib-social.el" has more details on this.
For software developers who use Github for publishing and version control,
Github links are similar to social media links but reference specific Github
-web pages. Hyperbole automatically locates all your local git repository
-directories and indexes them for later use.
+web pages.
Press the Action Key on address@hidden to go to RSW's gihub home page.
address@hidden works too.
@@ -479,10 +481,10 @@ of the git commit hash code:
github#hyperbole/5ae3550 (project can be given with user default)
gh#5ae3550 (user and project defaults are used)
-An Action Key presses on the first commit reference above will work
-because user, project and commit hash code are all included. The
-second and third versions require the setup of default values as
-explained in "(hyperbole)github-reference".
+An Action Key press on the first commit reference above works because
+user, project and commit hash code are all included. The second and
+third versions require the setup of default values, as explained in
+"(hyperbole)github-reference".
** Git (Local) References
diff --git a/hargs.el b/hargs.el
index 61d0415..a291078 100644
--- a/hargs.el
+++ b/hargs.el
@@ -260,7 +260,7 @@ If optional argument NO-DEFAULT is non-nil, nil is returned
instead of any
default values.
Caller should have checked whether an argument is presently being read
-and set `hargs:reading-p' to an appropriate argument type.
+and has set `hargs:reading-p' to an appropriate argument type.
Handles all of the interactive argument types that `hargs:iform-read' does."
(cond ((and (eq hargs:reading-p 'kcell)
(eq major-mode 'kotl-mode)
@@ -305,7 +305,7 @@ Handles all of the interactive argument types that
`hargs:iform-read' does."
;; Unquoted remote file name.
((hpath:is-p (hpath:remote-at-p) 'file))
;; Possibly non-existent file name
- ((hpath:at-p nil 'non-exist))
+ ((if no-default (hpath:at-p 'file 'non-exist)))
(no-default nil)
((buffer-file-name))
))
@@ -322,8 +322,8 @@ Handles all of the interactive argument types that
`hargs:iform-read' does."
((hpath:at-p 'directory))
;; Unquoted remote directory name.
((hpath:is-p (hpath:remote-at-p) 'directory))
- ;; Possibly non-existant directory name
- ((hpath:at-p 'directory 'non-exist))
+ ;; Possibly non-existent directory name
+ ((if no-default (hpath:at-p 'directory 'non-exist)))
(no-default nil)
(default-directory)
))
diff --git a/hmouse-key.el b/hmouse-key.el
index 279bafa..0b832c7 100644
--- a/hmouse-key.el
+++ b/hmouse-key.el
@@ -44,6 +44,22 @@
;;; Public functions
;;; ************************************************************************
+(defun hmouse-check-action-key ()
+ "After use of the Action Mouse Key, ensure both depress and release events
are assigned to the key.
+Returns t iff the key is properly bound, else nil."
+ (and (or (and (eventp action-key-depress-args) (eventp
action-key-release-args))
+ (not (or action-key-depress-args action-key-release-args)))
+ (where-is-internal 'action-key-depress-emacs (current-global-map) t)
+ (where-is-internal 'action-mouse-key-emacs (current-global-map) t)))
+
+(defun hmouse-check-assist-key ()
+ "After use of the Assist Mouse Key, ensure both depress and release events
are assigned to the key.
+Returns t iff the key is properly bound, else nil."
+ (and (or (and (eventp assist-key-depress-args) (eventp
assist-key-release-args))
+ (not (or assist-key-depress-args assist-key-release-args)))
+ (where-is-internal 'assist-key-depress-emacs (current-global-map) t)
+ (where-is-internal 'assist-mouse-key-emacs (current-global-map) t)))
+
(defun hmouse-set-bindings (key-binding-list)
"Sets mouse keys used as Smart Keys to bindings in KEY-BINDING-LIST.
KEY-BINDING-LIST is the value of either `hmouse-previous-bindings'
@@ -98,10 +114,13 @@ Assist Key = shift-right mouse key."
(if hmouse-middle-flag "{Mouse-2} and {Shift Mouse-2} invoke"
"{Shift-Mouse-2} invokes"))))
-(defun hmouse-add-unshifted-keys ()
+(defun hmouse-add-unshifted-smart-keys ()
"GNU Emacs only: binds [mouse-2] to the Action Key and [mouse-3] to the
Assist Key."
- (hmouse-install t)
- (hmouse-bind-key 3 #'assist-key-depress-emacs #'assist-mouse-key-emacs))
+ (interactive)
+ (if hyperb:emacs-p
+ (progn (hmouse-install t)
+ (hmouse-bind-key 3 #'assist-key-depress-emacs
#'assist-mouse-key-emacs))
+ (error "(hmouse-add-unshifted-smart-keys): Works under only GNU Emacs 19
or above")))
(defun hmouse-toggle-bindings ()
"Toggles between Smart Mouse Key settings and their prior bindings.
@@ -125,6 +144,18 @@ mouse key the Paste Key instead of the Action Key."
(error "(hmouse-toggle-bindings): `%s' is empty."
(if hmouse-bindings-flag 'hmouse-previous-bindings
'hmouse-bindings)))))
+;; Define function to reload Smart Key actions after a source code change.
+(defun hmouse-update-smart-keys ()
+ "Reloads the contexts and actions associated with the Smart Keys after any
programmatic changes are made."
+ (interactive)
+ (makunbound 'hkey-alist)
+ (makunbound 'hmouse-alist)
+ (let ((load-prefer-newer t))
+ ;; This also reloads "hui-window" where mouse-only actions are defined.
+ (mapc #'load '("hui-mouse" "hibtypes" "hactypes")))
+ (message "Hyperbole Smart Key and Smart Mouse Key actions have been
updated."))
+
+
;;; ************************************************************************
;;; Private variables
;;; ************************************************************************
diff --git a/hmouse-sh.el b/hmouse-sh.el
index a778a3d..379e9de 100644
--- a/hmouse-sh.el
+++ b/hmouse-sh.el
@@ -32,8 +32,7 @@
(defun hmouse-bind-key (mouse-key-number depress-cmd release-cmd)
"Ensure MOUSE-KEY-NUMBER (1-5), e.g. 1 for [mouse-1], is globally bound to
DEPRESS-CMD and RELEASE-CMD (includes depresses and drags).
-Use nil as cmd values to unbind a key."
- ;; Works under GNU Emacs only.
+Use nil as cmd values to unbind a key. Works under GNU Emacs only."
(hmouse-set-key-list
depress-cmd
(nth (1- mouse-key-number)
@@ -141,8 +140,7 @@ Use nil as cmd values to unbind a key."
(defun hmouse-bind-shifted-key (shifted-mouse-key-number depress-cmd
release-cmd)
"Ensure shifted MOUSE-KEY-NUMBER (1-5), e.g. 1 for [Smouse-1], is globally
bound to DEPRESS-CMD and RELEASE-CMD (includes depresses and drags).
-Use nil as CMD value to unbind the key."
- ;; Works under GNU Emacs only.
+Use nil as CMD value to unbind the key. Works under GNU Emacs only."
(hmouse-set-key-list
depress-cmd
(nth (1- shifted-mouse-key-number)
diff --git a/hpath.el b/hpath.el
index c3d631c..e47e08a 100644
--- a/hpath.el
+++ b/hpath.el
@@ -898,19 +898,19 @@ nonexistent local paths are allowed."
(format rtn-path suffix))
(format rtn-path ""))))))))
- (defun hpath:push-tag-mark ()
- "Add a tag return marker at point if within a programming language
file buffer.
+(defun hpath:push-tag-mark ()
+ "Add a tag return marker at point if within a programming language file
buffer.
Is a no-op if the function `push-tag-mark' is not available."
- (and buffer-file-name
- comment-start
- (not (memq last-command
- '(xref-find-definitions find-tag
find-tag-other-window tags-loop-continue)))
- (or (and (fboundp 'xref-push-marker-stack)
- ;; push old position
- (xref-push-marker-stack))
- (and (fboundp 'push-tag-mark)
- ;; push old position
- (push-tag-mark)))))
+ (and buffer-file-name
+ comment-start
+ (not (memq last-command
+ '(xref-find-definitions find-tag find-tag-other-window
tags-loop-continue)))
+ (or (and (fboundp 'xref-push-marker-stack)
+ ;; push old position
+ (xref-push-marker-stack))
+ (and (fboundp 'push-tag-mark)
+ ;; push old position
+ (push-tag-mark)))))
(defun hpath:relative-to (path &optional default-dir)
"Returns PATH relative to optional DEFAULT-DIR or `default-directory'.
diff --git a/hui-mini.el b/hui-mini.el
index 782ef51..e986d41 100644
--- a/hui-mini.el
+++ b/hui-mini.el
@@ -320,8 +320,12 @@ constructs. If not given, the top-level Hyperbole menu is
used."
(and doc-flag
;; Not another menu to display
(not (and (listp act-form) (atom (car act-form)) (atom
(cdr act-form))))))
- (let ((help-str (or (car (cdr (cdr label-act-help-list)))
- "No help documentation for this item.")))
+ (let* ((help-str (car (cdr (cdr label-act-help-list))))
+ (cmd (if help-str nil (car (cdr label-act-help-list))))
+ (doc-str (if help-str nil (and (functionp cmd)
(documentation cmd)))))
+ (and doc-str (string-match "\n" doc-str)
+ (setq doc-str (substring doc-str 0 (match-beginning 0))))
+ (setq help-str (or help-str doc-str "No help documentation for
this item."))
(if help-string-flag
help-str
(concat (car label-act-help-list) "\n "
diff --git a/hui-mouse.el b/hui-mouse.el
index 6e8a3bf..06676fc 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -47,9 +47,9 @@
"*Command that sets point to the mouse cursor position.")
(defun action-key-error ()
- (hypb:error "(Action Key): No action defined for this context; try another
location."))
+ (hypb:error "(Hyperbole Action Key): No action defined for this context; try
another location."))
(defun assist-key-error ()
- (hypb:error "(Assist Key): No action defined for this context; try another
location."))
+ (hypb:error "(Hyperbole Assist Key): No action defined for this context; try
another location."))
(defcustom action-key-default-function #'action-key-error
"*Function run by the Action Key in an unspecified context.
@@ -103,7 +103,8 @@ Its default value is #'smart-scroll-down."
(hargs:select-p hkey-value 'assist)))
;;
;; If reading a Hyperbole menu item and nothing is selected, just return.
- ;; If in a helm session, quit the session and activate the selected item.
+ ;; Or if in a helm session with point in the minibuffer, quit the
+ ;; session and activate the selected item.
((and (> (minibuffer-depth) 0)
(eq (selected-window) (minibuffer-window))
(or (eq hargs:reading-p 'hmenu)
@@ -121,9 +122,10 @@ Its default value is #'smart-scroll-down."
((and (fboundp 'xref--item-at-point) (xref--item-at-point)) .
((xref-goto-xref) . (xref-show-location-at-point)))
;;
+ ;; If at the end of a line (eol), invoke the associated Smart Key handler
EOL handler.
((if (eq major-mode 'kotl-mode)
(and (not (kotl-mode:eobp)) (kotl-mode:eolp))
- (and (not (eobp)) (or (eolp) (and selective-display (eq
(following-char) ?\r))))) .
+ (smart-eolp)) .
((funcall action-key-eol-function) . (funcall assist-key-eol-function)))
;;
;; The Smart Menu system provides menus within Emacs on a dumb terminal.
@@ -161,7 +163,7 @@ Its default value is #'smart-scroll-down."
;; Direct access selection of helm-major-mode completions
((setq hkey-value (and (or (eq major-mode 'helm-major-mode)
(and (featurep 'helm) (equal helm-action-buffer
(buffer-name))))
- (or (eobp)
+ (or (eolp)
(smart-helm-at-header)
(smart-helm-line-has-action)))) .
((smart-helm) . (smart-helm-assist)))
@@ -777,7 +779,7 @@ If assist-key is pressed within:
;;; ************************************************************************
(defun smart-helm-at-header ()
- "Return t iff Action Mouse Key depress was on the first header line of the
current buffer."
+ "Return t iff Action Mouse Key depress was on the first fixed header line or
a helm section header of the current buffer."
(or (helm-pos-header-line-p)
(and (eventp action-key-depress-args)
(eq (posn-area (event-start action-key-depress-args))
@@ -785,11 +787,11 @@ If assist-key is pressed within:
(defun smart-helm-line-has-action ()
"Marks and returns the actions for the helm selection item at point, or nil
if line lacks any action.
-Assumes Hyperbole has already checked that point is in a helm buffer."
- (if hkey-debug (setq cursor-type t))
+Assumes Hyperbole has already checked that helm is active."
(let ((helm-buffer (if (equal helm-action-buffer (buffer-name)) helm-buffer
(buffer-name))))
(save-excursion
(with-helm-buffer
+ (if hkey-debug (setq cursor-type t)) ; For testing where mouse presses
set point.
(when (not (or (eobp)
(smart-helm-at-header)
(helm-pos-candidate-separator-p)))
@@ -813,60 +815,136 @@ Assumes Hyperbole has already checked that point is in a
helm buffer."
(helm-resume helm-buffer)
(sit-for 0.2)))
+(defun smart-helm-at (depress-event)
+ "Return non-nil iff Smart Mouse DEPRESS-EVENT was on a helm section header,
candidate separator or at eob or eol.
+If non-nil, returns a property list of the form: (section-header <bool>
separator <bool> eob <bool> or eol <bool>).
+If a section-header or separator, selects the first following candidate line.
+Assumes Hyperbole has already checked that helm is active."
+ (and (eventp depress-event)
+ ;; Nil means in the buffer text area
+ (not (posn-area (event-start depress-event)))
+ (with-helm-buffer
+ (let ((opoint (point))
+ things)
+ (mouse-set-point depress-event)
+ (setq things (list 'section-header (helm-pos-header-line-p)
+ 'separator (helm-pos-candidate-separator-p)
+ 'eob (eobp)
+ 'eol (eolp)))
+ (cond ((or (plist-get things 'section-header) (plist-get things
'separator))
+ (helm-next-line 1)
+ things)
+ ((plist-get things 'eol)
+ (helm-mark-current-line)
+ things)
+ ((plist-get things 'eob)
+ things)
+ (t
+ (goto-char opoint)
+ nil))))))
+
(defun smart-helm()
"Executes helm actions based on Action Key click locations:
+ At the end of the buffer, quits from helm and exits the minibuffer.
On a candidate line, performs the candidate's first action and remains in
the minibuffer;
- On the top, fixed header line, displays a list of actions available for the
selected candidate;
+ On the top, fixed header line, toggles display of the selected candidate's
possible actions;
On an action list line, performs the action after exiting the minibuffer;
- At the end of the buffer, quits from helm and exits the minibuffer.
On a source section header, moves to the next source section or first if on
last.
On a candidate separator line, does nothing.
In the minibuffer window, ends the helm session and performs the selected
item's action."
- (let ((non-text-area-p (and (eventp action-key-depress-args)
- (posn-area (event-start
action-key-depress-args))))
- (separator (helm-pos-candidate-separator-p))
- (eob (eobp)))
+ (unless (hmouse-check-action-key)
+ (error "(smart-helm): Hyperbole Action Mouse Key - either depress or
release event is improperly configured"))
+ (let* ((non-text-area-p (and (eventp action-key-depress-args)
+ (posn-area (event-start
action-key-depress-args))))
+ (at-plist (smart-helm-at action-key-depress-args))
+ (section-hdr (plist-get at-plist 'section-header))
+ (separator (plist-get at-plist 'separator))
+ (eob (plist-get at-plist 'eob))
+ (eol (plist-get at-plist 'eol)))
(smart-helm-resume-helm)
- (if (> (minibuffer-depth) 0)
- (select-window (minibuffer-window)))
- (when (and (smart-helm-alive-p) (not separator))
- (let* ((key (kbd (cond
- ;; Move to next source section or first
- ;; if on last.
- ((helm-pos-header-line-p) "C-o")
+ ;; Handle end-of-line clicks.
+ (if (and eol (not eob) (not non-text-area-p))
+ (progn (with-helm-buffer (funcall action-key-eol-function))
+ (if (> (minibuffer-depth) 0)
+ (select-window (minibuffer-window))))
+ (if (> (minibuffer-depth) 0)
+ (select-window (minibuffer-window)))
+ (when (and (smart-helm-alive-p) (not separator))
+ (let* ((key (kbd (cond
+ ;; Exit
+ (eob "C-g")
+ ;; Move to next source section or first if on last.
+ (section-hdr "C-o")
+ ;; If line of the key press is the first /
+ ;; header line in the window or outside the
+ ;; buffer area, then use {TAB} command to
+ ;; switch between match list and action list.
+ (non-text-area-p "TAB")
+ ;; RET: Performs action of selection and exits the
minibuffer.
+ ;; C-j: Performs action of selection and stays in
minibuffer.
+ (hkey-value
+ (if (helm-action-window) "RET" "C-j"))
+ (t "RET"))))
+ (binding (key-binding key)))
+ (if hkey-debug
+ (message "(HyDebug): In smart-helm, key to execute is: {%s};
binding is: %s"
+ (key-description key) binding))
+ (call-interactively binding))))))
+
+(defun smart-helm-assist()
+ "Executes helm actions based on Assist Key click locations:
+ At the end of the buffer, quits from helm and exits the minibuffer.
+ On a candidate line, display's the candidate's first action and remains in
the minibuffer;
+ On the top, fixed header line, toggles display of the selected candidate's
possible actions;
+ On an action list line, performs the action after exiting the minibuffer;
+ On a source section header, moves to the previous source section or last if
on first.
+ On a candidate separator line, does nothing.
+ In the minibuffer window, ends the helm session and performs the selected
item's action."
+ ;; Hyperbole has checked that this line has an action prior to
+ ;; invoking this function.
+ (unless (hmouse-check-assist-key)
+ (error "(smart-helm-assist): Hyperbole Assist Mouse Key - either depress
or release event is improperly configured"))
+ (let* ((non-text-area-p (and (eventp assist-key-depress-args)
+ (posn-area (event-start
assist-key-depress-args))))
+ (at-plist (smart-helm-at assist-key-depress-args))
+ (section-hdr (plist-get at-plist 'section-header))
+ (separator (plist-get at-plist 'separator))
+ (eob (plist-get at-plist 'eob))
+ (eol (plist-get at-plist 'eol))
+ (key))
+ (unwind-protect
+ (smart-helm-resume-helm)
+ ;; Handle end-of-line clicks.
+ (cond ((and eol (not eob) (not non-text-area-p))
+ (with-helm-buffer (funcall assist-key-eol-function)))
+ ((and (smart-helm-alive-p) (not separator))
+ (setq key (cond
;; Exit
(eob "C-g")
+ ;; Move to previous source section or last if on last.
+ (section-hdr "M-o")
;; If line of the key press is the first /
;; header line in the window or outside the
;; buffer area, then use {TAB} command to
;; switch between match list and action list.
(non-text-area-p "TAB")
- ;; RET: Performs action of selection and exits the
minibuffer.
- ;; C-j: Performs action of selection and stays in
minibuffer.
- (hkey-value
- (if (helm-action-window) "RET" "C-j"))
- (t "RET"))))
- (binding (key-binding key)))
- (if hkey-debug
- (message "(HyDebug): In smart-helm, key to execute is: {%s};
binding is: %s"
- (key-description key) binding))
- (call-interactively binding)))))
-
-(defun smart-helm-assist()
- "Displays the selected item (including its action for the helm line at
point."
- (smart-helm-resume-helm)
- ;; Hyperbole has checked that this line has an action prior
- ;; to invoking this function.
- (unwind-protect
- (with-help-window "*Helm Help*"
- (let ((helm-buffer (if (equal helm-action-buffer (buffer-name))
helm-buffer (buffer-name))))
- (with-helm-buffer
- (princ "The current helm selection item is:\n\t")
- (princ (helm-get-selection (helm-buffer-get)))
- (princ "\nwith an action of:\n\t")
- (princ (helm-get-current-action)))))
- (if (> (minibuffer-depth) 0)
- (select-window (minibuffer-window)))))
+ ;; Display action for the current line and
+ ;; return nil.
+ (t (with-help-window "*Helm Help*"
+ (let ((helm-buffer (if (equal helm-action-buffer
(buffer-name))
+ helm-buffer (buffer-name))))
+ (with-helm-buffer
+ (princ "The current helm selection item
is:\n\t")
+ (princ (helm-get-selection (helm-buffer-get)))
+ (princ "\nwith an action of:\n\t")
+ (princ (helm-get-current-action)))
+ nil)))))
+ (if hkey-debug
+ (message "(HyDebug): In smart-helm-assist, key to execute is:
{%s}; binding is: %s"
+ (if key (key-description key) "Help" (if key binding
"None"))))))
+ (if (> (minibuffer-depth) 0)
+ (select-window (minibuffer-window))))
+ (if key (call-interactively (key-binding (kbd key))))))
;;; ************************************************************************
;;; smart-hmail functions
@@ -1186,7 +1264,8 @@ If key is pressed:
buffer;
(4) on a header line but not at the beginning or end, if headings subtree is
hidden then show it, otherwise hide it;
- (5) anywhere else, scroll up a windowful."
+ (5) anywhere else, invoke `action-key-eol-function', typically to scroll up
+ a windowful."
(interactive)
(cond (smart-outline-cut
@@ -1203,7 +1282,7 @@ If key is pressed:
((or (eolp) (zerop (save-excursion (beginning-of-line)
(outline-level))))
- (smart-scroll-up))
+ (funcall action-key-eol-function))
;; On an outline header line but not at the start/end of line.
((smart-outline-subtree-hidden-p)
(outline-show-subtree))
@@ -1225,7 +1304,8 @@ If assist-key is pressed:
subtree) from the buffer;
(4) on a header line but not at the beginning or end, if heading body is
hidden then show it, otherwise hide it;
- (5) anywhere else, scroll down a windowful."
+ (5) anywhere else, invoke `assist-key-eol-function', typically to scroll down
+ a windowful."
(interactive)
(cond (smart-outline-cut (yank))
@@ -1239,7 +1319,7 @@ If assist-key is pressed:
nil (outline-level)))))
((or (eolp) (zerop (save-excursion (beginning-of-line)
(outline-level))))
- (smart-scroll-down))
+ (funcall assist-key-eol-function))
;; On an outline header line but not at the start/end of line.
((smart-outline-subtree-hidden-p)
(outline-show-entry))
@@ -1267,6 +1347,25 @@ CURR-ENTRY-LEVEL is not needed."
"Returns t if at least initial subtree of heading is hidden, else nil."
(outline-invisible-in-p (point) (or (save-excursion (re-search-forward
"[\n\r]" nil t)) (point))))
+(defun smart-outline-char-invisible-p (&optional pos)
+ "Return t if the character after point is invisible/hidden, else nil."
+ (or pos (setq pos (point)))
+ (when (or
+ ;; New-style Emacs outlines with invisible properties to hide lines
+ (kproperty:get pos 'invisible)
+ (delq nil (mapcar (lambda (o) (overlay-get o 'invisible))
+ (overlays-at (or pos (point)))))
+ ;; Old-style Emacs outlines using \r (^M) characters to hide lines
+ (and selective-display (eq (following-char) ?\r)))
+ t))
+
+(defun smart-eolp ()
+ "Return t if point is at the end of a visible line but not the end of the
buffer."
+ ;; smart-helm handles eol for helm buffers
+ (unless (and (smart-helm-alive-p) (equal (helm-buffer-get) (buffer-name)))
+ (and (not (eobp)) (eolp) (or (not (smart-outline-char-invisible-p))
+ (not (smart-outline-char-invisible-p (1-
(point))))))))
+
;;; ************************************************************************
;;; smart-push-button functions
;;; ************************************************************************
diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index d3408f7..44883a0 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -1967,10 +1967,11 @@ If key is pressed:
a cell, then move point to prior location and begin creation of a
klink to some other outline cell; hit the Action Key twice to select the
link referent cell;
- (4) anywhere else, scroll up a windowful."
+ (4) anywhere else, invoke `action-key-eol-function', typically to scroll up
+ a windowful."
(interactive)
(cond ((kotl-mode:eobp) (kotl-mode:show-all))
- ((kotl-mode:eolp) (smart-scroll-up))
+ ((kotl-mode:eolp) (funcall action-key-eol-function))
((not (kview:valid-position-p))
(if (markerp action-key-depress-prev-point)
(progn (select-window
@@ -2001,10 +2002,11 @@ If assist-key is pressed:
a cell, then move point to prior location and prompt to move one tree to
a new location in the outline; hit the Action Key twice to select the
tree to move and where to move it;
- (4) anywhere else, scroll down a windowful."
+ (4) anywhere else, invoke `assist-key-eol-function', typically to scroll down
+ a windowful."
(interactive)
(cond ((kotl-mode:eobp) (kotl-mode:overview))
- ((kotl-mode:eolp) (smart-scroll-down))
+ ((kotl-mode:eolp) (funcall assist-key-eol-function))
((not (kview:valid-position-p))
(if (markerp assist-key-depress-prev-point)
(progn (select-window
diff --git a/kotl/kview.el b/kotl/kview.el
index 9886473..6be5616 100644
--- a/kotl/kview.el
+++ b/kotl/kview.el
@@ -525,10 +525,10 @@ level."
(defun kview:char-invisible-p (&optional pos)
"Return t if the character after point is invisible/hidden, else nil."
(or pos (setq pos (point)))
- (if (or (kproperty:get pos 'invisible)
- (delq nil (mapcar (lambda (o) (overlay-get o 'invisible))
- (overlays-at (or pos (point))))))
- t))
+ (when (or (kproperty:get pos 'invisible)
+ (delq nil (mapcar (lambda (o) (overlay-get o 'invisible))
+ (overlays-at (or pos (point))))))
+ t))
(defun kview:char-visible-p (&optional pos)
"Return t if the character after point is visible, else nil."
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 61a5743..8083927 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -7695,7 +7695,8 @@ and outline-minor-mode is enabled:
(4) on a header line but not at the beginning or end of the line,
if the headings subtree is hidden, shows it, otherwise hides
it;
- (5) anywhere else, scrolls up a windowful.
+ (5) anywhere else, invokes @code{action-key-eol-function}, typically
+ to scroll up a windowful.
ASSIST KEY
(1) after an outline heading has been cut via the Action Key,
allows multiple pastes throughout the buffer (the last paste
@@ -7705,7 +7706,8 @@ and outline-minor-mode is enabled:
(sans subtree) from the buffer;
(4) on a header line but not at the beginning or end, if the
heading body is hidden, shows it, otherwise hides it;
- (5) anywhere else, scrolls down a windowful.
+ (5) anywhere else, invokes @code{assist-key-eol-function}, typically
+ to scroll down a windowful.
@end group
@end format
- [elpa] externals/hyperbole 2e55c34 31/53: Add defvar for assist-flag, (continued)
- [elpa] externals/hyperbole 2e55c34 31/53: Add defvar for assist-flag, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 620685a 11/53: Add git and github reference support for branches, issues, pull requests and tags., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 6b68100 40/53: Fixed predicate test in kbd-key:key-and-arguments., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole bf0e9fb 24/53: Added new git-find-file command and associated git#=file implicit button type., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 1a85b83 10/53: * DEMO (Git References): Added., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 67c00f5 42/53: Added additional Hyperbole Manual section changes., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole ff17563 44/53: Use replace-regexp-in-string instead of replace-in-string, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole e2f6fbd 21/53: V6.0.2b; Fixed ebut creation argument prompting; Normal key seqs and ESC for meta allowed in HyControl, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 70b6a79 29/53: Added modeline drag to window to replace dest. buffer with source buffer; showed Hyperbole key bindings in menu, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 8f70846 45/53: Correct spelling, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole d1fb45a 15/53: File/Dir linking fix; Smart Key reloading; helm mouse control improvements; Hyperbole menu use doc strings,
Robert Weiner <=
- [elpa] externals/hyperbole 2161b1c 22/53: Added hmouse-pulse-flag and more pulsing; fixed many small internal Hyperbole button handling functions., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 547c18f 26/53: Added gh#status to show github status; eliminated annot-bib matches from programming modes., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole cf8ae0c 49/53: Makefile (help): Removed misplaced double quote characters., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 50dc88d 23/53: V6.0.2c - Smart Key and popup menu buffer fixes; simplified Assist Key handling code, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 1188e43 51/53: smart-clib-sym: Removed file-newer Perl script dependency; file-newer: Removed., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole c45ce9b 52/53: Merge branch 'master' of http://git.savannah.gnu.org/r/hyperbole into externals/hyperbole, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 45714d5 46/53: Minor doc and code improvements, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 9b2d75a 53/53: Merge branch 'externals/hyperbole' of git+ssh://git.sv.gnu.org/srv/git/emacs/elpa into externals/hyperbole, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a76d502 34/53: Hyperbole 6.0.2f pre-release, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 450688e 39/53: Corrected mouse-position and mouse-pixel-position to return selected frame; added key sequences with args support., Robert Weiner, 2017/11/15