-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(require 'yaol) | ||
(require 'pophint) | ||
|
||
;;;###autoload | ||
(defcustom pophint-yaol:enable t | ||
"Whether to enable feature." | ||
:type 'boolean | ||
:group 'pophint) | ||
|
||
(defcustom pophint-yaol:head-action 'yaol-fold-clear-current | ||
"Function to invoke on it when hint selected." | ||
:type 'function | ||
:group 'pophint) | ||
|
||
;;;###autoload | ||
(defun pophint:do-yaol-head () (interactive)) | ||
(with-no-warnings | ||
(pophint:defsource | ||
:name "yaol-head" | ||
:description "Head of yaol." | ||
:source '((shown . "Head") | ||
(highlight . nil) | ||
(requires . 1) | ||
(method . (lambda () | ||
(let* ((startpt (when (yaol-next-head) | ||
(point))) | ||
(endpt (when startpt | ||
(yaol-node-fold-beg (-first-item (yaol-find-deepest-nodes-at (point)))))) | ||
(value (when endpt | ||
(buffer-substring-no-properties startpt endpt)))) | ||
(when (and startpt endpt | ||
(< startpt endpt)) | ||
`(:startpt ,startpt :endpt ,endpt :value ,value))))) | ||
(action . (lambda (hint) | ||
(with-selected-window (pophint:hint-window hint) | ||
(goto-char (pophint:hint-startpt hint)) | ||
(when pophint-yaol:head-action | ||
(funcall pophint-yaol:head-action)))))))) | ||
|
||
;;;###autoload | ||
(defun pophint-yaol:provision (activate) | ||
(interactive) | ||
(if activate | ||
(progn | ||
(add-to-list 'pophint:global-sources 'pophint:source-yaol-head t)) | ||
(setq pophint:global-sources | ||
(remove 'pophint:source-yaol-head pophint:global-sources)))) | ||
|
||
;;;###autoload | ||
(with-eval-after-load 'yaol | ||
(when pophint-yaol:enable (pophint-yaol:provision t))) | ||
|
||
|
||
(provide 'pophint-yaol) | ||
;;; pophint-yaol.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
;; Author: Hiroaki Otsu <[email protected]> | ||
;; Keywords: popup | ||
;; URL: https://github.com/aki2o/emacs-pophint | ||
;; Version: 1.2.0 | ||
;; Package-Requires: ((log4e "0.2.0") (yaxception "0.3")) | ||
;; Version: 1.3.0 | ||
;; Package-Requires: ((log4e "0.3.3") (yaxception "0.3")) | ||
|
||
;; This program is free software; you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
|
@@ -754,7 +754,7 @@ If nil, it means limitless." | |
|
||
(defsubst pophint--hintable-location-p (direction currpt startpt endpt) | ||
(when (and (not (ignore-errors (invisible-p startpt))) | ||
(not (ignore-errors (invisible-p endpt))) | ||
(not (ignore-errors (invisible-p (1- endpt)))) | ||
(case direction | ||
(around t) | ||
(forward (>= startpt currpt)) | ||
|