mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
This commit is contained in:
commit
447bb6ef5c
13 changed files with 273 additions and 146 deletions
|
|
@ -1735,7 +1735,7 @@ Hide all blocks @var{n} levels below this block
|
||||||
@vindex hs-indicator-maximum-buffer-size
|
@vindex hs-indicator-maximum-buffer-size
|
||||||
@vindex hs-isearch-open
|
@vindex hs-isearch-open
|
||||||
@vindex hs-hide-block-behavior
|
@vindex hs-hide-block-behavior
|
||||||
@vindex hs-special-modes-alist
|
@vindex hs-modes-alist
|
||||||
These variables can be used to customize Hideshow mode:
|
These variables can be used to customize Hideshow mode:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
@ -1782,6 +1782,9 @@ code blocks and comments), or @code{nil} (unhide neither code blocks
|
||||||
nor comments). The default value is @code{code}.
|
nor comments). The default value is @code{code}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
All necessary settings for each mode can be found in the variable
|
||||||
|
@code{hs-modes-alist}.
|
||||||
|
|
||||||
@node Symbol Completion
|
@node Symbol Completion
|
||||||
@section Completion for Symbol Names
|
@section Completion for Symbol Names
|
||||||
@cindex completion (symbol names)
|
@cindex completion (symbol names)
|
||||||
|
|
|
||||||
6
etc/NEWS
6
etc/NEWS
|
|
@ -1100,6 +1100,12 @@ should hide a block. If set to 'after-bol', hide the innermost block to
|
||||||
which the current line belongs. If set to 'after-cursor', hide the block
|
which the current line belongs. If set to 'after-cursor', hide the block
|
||||||
after cursor position. By default this is set to 'after-bol'.
|
after cursor position. By default this is set to 'after-bol'.
|
||||||
|
|
||||||
|
+++
|
||||||
|
*** The variable 'hs-special-modes-alist' is now obsolete.
|
||||||
|
Use the new variable 'hs-modes-alist' instead, which supports mode
|
||||||
|
hierarchy for each value.
|
||||||
|
|
||||||
|
|
||||||
** C-ts mode
|
** C-ts mode
|
||||||
|
|
||||||
+++
|
+++
|
||||||
|
|
|
||||||
|
|
@ -930,7 +930,7 @@ allowed. This minor issue currently only affects \"(/\" and \"/)\".")
|
||||||
"block" "critical") t)
|
"block" "critical") t)
|
||||||
"\\_>")
|
"\\_>")
|
||||||
"Regexp matching the end of an F90 \"block\", from the line start.
|
"Regexp matching the end of an F90 \"block\", from the line start.
|
||||||
Used in the F90 entry in `hs-special-modes-alist'.")
|
Used in the F90 entry in `hs-modes-alist'.")
|
||||||
|
|
||||||
;; Ignore the fact that FUNCTION, SUBROUTINE, WHERE, FORALL have a
|
;; Ignore the fact that FUNCTION, SUBROUTINE, WHERE, FORALL have a
|
||||||
;; following "(". DO, CASE, IF can have labels.
|
;; following "(". DO, CASE, IF can have labels.
|
||||||
|
|
@ -966,12 +966,12 @@ Used in the F90 entry in `hs-special-modes-alist'.")
|
||||||
"Regexp matching the start of an F90 \"block\", from the line start.
|
"Regexp matching the start of an F90 \"block\", from the line start.
|
||||||
A simple regexp cannot do this in fully correct fashion, so this
|
A simple regexp cannot do this in fully correct fashion, so this
|
||||||
tries to strike a compromise between complexity and flexibility.
|
tries to strike a compromise between complexity and flexibility.
|
||||||
Used in the F90 entry in `hs-special-modes-alist'.")
|
Used in the F90 entry in `hs-modes-alist'.")
|
||||||
|
|
||||||
;; hs-special-modes-alist is autoloaded.
|
;; hs-modes-alist is autoloaded.
|
||||||
(add-to-list 'hs-special-modes-alist
|
(add-to-list 'hs-modes-alist
|
||||||
`(f90-mode ,f90-start-block-re ,f90-end-block-re
|
`(f90-mode (start . ,f90-start-block-re) (end . ,f90-end-block-re)
|
||||||
"!" f90-end-of-block nil))
|
(c-start . "!") (forward-fn . f90-end-of-block)))
|
||||||
|
|
||||||
|
|
||||||
;; Imenu support.
|
;; Imenu support.
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,7 @@ than ENDDO.")
|
||||||
"\\|!\\|$\\)")
|
"\\|!\\|$\\)")
|
||||||
"Regexp matching the end of a Fortran \"block\", from the line start.
|
"Regexp matching the end of a Fortran \"block\", from the line start.
|
||||||
Note that only ENDDO is handled for the end of a DO-loop. Used
|
Note that only ENDDO is handled for the end of a DO-loop. Used
|
||||||
in the Fortran entry in `hs-special-modes-alist'.")
|
in the Fortran entry in `hs-modes-alist'.")
|
||||||
|
|
||||||
(defconst fortran-start-block-re
|
(defconst fortran-start-block-re
|
||||||
(concat
|
(concat
|
||||||
|
|
@ -582,11 +582,11 @@ in the Fortran entry in `hs-special-modes-alist'.")
|
||||||
"Regexp matching the start of a Fortran \"block\", from the line start.
|
"Regexp matching the start of a Fortran \"block\", from the line start.
|
||||||
A simple regexp cannot do this in fully correct fashion, so this
|
A simple regexp cannot do this in fully correct fashion, so this
|
||||||
tries to strike a compromise between complexity and flexibility.
|
tries to strike a compromise between complexity and flexibility.
|
||||||
Used in the Fortran entry in `hs-special-modes-alist'.")
|
Used in the Fortran entry in `hs-modes-alist'.")
|
||||||
|
|
||||||
(add-to-list 'hs-special-modes-alist
|
(add-to-list 'hs-modes-alist
|
||||||
`(fortran-mode ,fortran-start-block-re ,fortran-end-block-re
|
`(fortran-mode (start . ,fortran-start-block-re) (end . ,fortran-end-block-re)
|
||||||
"^[cC*!]" fortran-end-of-block nil))
|
(c-start . "^[cC*!]") (forward-fn . fortran-end-of-block)))
|
||||||
|
|
||||||
|
|
||||||
(defvar fortran-mode-syntax-table
|
(defvar fortran-mode-syntax-table
|
||||||
|
|
@ -1247,7 +1247,7 @@ Directive lines are treated as comments."
|
||||||
(goto-char i)
|
(goto-char i)
|
||||||
(= (line-beginning-position) p)))))
|
(= (line-beginning-position) p)))))
|
||||||
|
|
||||||
;; Used in hs-special-modes-alist.
|
;; Used in hs-modes-alist.
|
||||||
(defun fortran-end-of-block (&optional num)
|
(defun fortran-end-of-block (&optional num)
|
||||||
"Move point forward to the end of the current code block.
|
"Move point forward to the end of the current code block.
|
||||||
With optional argument NUM, go forward that many balanced blocks.
|
With optional argument NUM, go forward that many balanced blocks.
|
||||||
|
|
|
||||||
|
|
@ -370,30 +370,48 @@ This is only used if `hs-indicator-type' is set to `margin' or nil."
|
||||||
:version "31.1")
|
:version "31.1")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defvar hs-special-modes-alist
|
(defvar hs-special-modes-alist nil)
|
||||||
;; FIXME: Currently the check is made via
|
(make-obsolete-variable 'hs-special-modes-alist 'hs-modes-alist "31.1")
|
||||||
;; (assoc major-mode hs-special-modes-alist) so it doesn't pay attention
|
|
||||||
;; to the mode hierarchy.
|
;;;###autoload
|
||||||
'((c-mode "{" "}" "/[*/]" nil nil)
|
(defvar hs-modes-alist
|
||||||
(c-ts-mode "{" "}" "/[*/]" nil nil)
|
'((c-mode (start . "\\s(\\|{\\|\"")
|
||||||
(c++-mode "{" "}" "/[*/]" nil nil)
|
(end . "\\s)\\|}\\|\"")
|
||||||
(c++-ts-mode "{" "}" "/[*/]" nil nil)
|
(c-start . "/[*/]"))
|
||||||
(bibtex-mode ("@\\S(*\\(\\s(\\)" 1))
|
(c++-mode (start . "\\s(\\|{\\|\"")
|
||||||
(java-mode "{" "}" "/[*/]" nil nil)
|
(end . "\\s)\\|}\\|\"")
|
||||||
(java-ts-mode "{" "}" "/[*/]" nil nil)
|
(c-start . "/[*/]"))
|
||||||
(js-mode "{" "}" "/[*/]" nil)
|
(java-mode (start . "\\s(\\|{\\|\"")
|
||||||
(js-ts-mode "{" "}" "/[*/]" nil)
|
(end . "\\s)\\|}\\|\"")
|
||||||
(mhtml-mode "{\\|<[^/>]*?" "}\\|</[^/>]*[^/]>" "<!--" mhtml-forward nil)
|
(c-start . "/[*/]"))
|
||||||
|
(js-base-mode (start . "\\s(\\|{\\|\"")
|
||||||
|
(end . "\\s)\\|}\\|\"")
|
||||||
|
(c-start . "/[*/]"))
|
||||||
|
(bibtex-mode (start . ("@\\S(*\\(\\s(\\)" 1)))
|
||||||
|
(sgml-mode (start . "<[^/>]*?") (end . "</[^/>]*[^/]>")
|
||||||
|
(c-start . "<!--") (forward-fn . sgml-skip-tag-forward))
|
||||||
|
(mhtml-mode (start . "{\\|<[^/>]*?") (end . "}\\|</[^/>]*[^/]>")
|
||||||
|
(forward-fn . mhtml-forward))
|
||||||
|
(lisp-data-mode (start . "\\s(\\|\"") (end . "\\s)\\|\""))
|
||||||
;; Add more support here.
|
;; Add more support here.
|
||||||
)
|
)
|
||||||
"Alist for initializing the hideshow variables for different modes.
|
"Alist for initializing the hideshow variables for different modes.
|
||||||
Each element has the form
|
Each element is an alist with any of the cons-cells forms:
|
||||||
(MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC
|
(MODE &optional
|
||||||
FIND-BLOCK-BEGINNING-FUNC FIND-NEXT-BLOCK-FUNC
|
(start . START)
|
||||||
LOOKING-AT-BLOCK-START-P-FUNC).
|
(end . END)
|
||||||
|
(c-start . COMMENT-START)
|
||||||
|
(forward-fn . FORWARD-SEXP-FUNC)
|
||||||
|
(adjust-beg-fn . ADJUST-BEG-FUNC)
|
||||||
|
(adjust-end-fn . ADJUST-END-FUNC)
|
||||||
|
(find-beg-fn . FIND-BLOCK-BEGINNING-FUNC)
|
||||||
|
(find-next-fn . FIND-NEXT-BLOCK-FUNC)
|
||||||
|
(look-start-fn . LOOKING-AT-BLOCK-START-P-FUNC)
|
||||||
|
(commentp . INSIDE-COMMENT-P-FUNC)
|
||||||
|
(treesit-things . TREESIT-THINGS))
|
||||||
|
|
||||||
If non-nil, hideshow will use these values as regexps to define blocks
|
If non-nil, hideshow will use these values as regexps to define blocks
|
||||||
and comments, respectively for major mode MODE.
|
and comments, respectively for major mode MODE and its derivatives.
|
||||||
|
|
||||||
START, END and COMMENT-START are regular expressions. A block is
|
START, END and COMMENT-START are regular expressions. A block is
|
||||||
defined as text surrounded by START and END.
|
defined as text surrounded by START and END.
|
||||||
|
|
@ -403,7 +421,7 @@ MDATA-SELECTOR), where COMPLEX-START is a regexp with multiple parts and
|
||||||
MDATA-SELECTOR an integer that specifies which sub-match is the proper
|
MDATA-SELECTOR an integer that specifies which sub-match is the proper
|
||||||
place to adjust point, before calling `hs-forward-sexp-func'. Point
|
place to adjust point, before calling `hs-forward-sexp-func'. Point
|
||||||
is adjusted to the beginning of the specified match. For example,
|
is adjusted to the beginning of the specified match. For example,
|
||||||
see the `hs-special-modes-alist' entry for `bibtex-mode'.
|
see the `hs-modes-alist' entry for `bibtex-mode'.
|
||||||
|
|
||||||
For some major modes, `forward-sexp' does not work properly. In those
|
For some major modes, `forward-sexp' does not work properly. In those
|
||||||
cases, FORWARD-SEXP-FUNC specifies another function to use instead.
|
cases, FORWARD-SEXP-FUNC specifies another function to use instead.
|
||||||
|
|
@ -411,6 +429,9 @@ cases, FORWARD-SEXP-FUNC specifies another function to use instead.
|
||||||
See the documentation for `hs-adjust-block-beginning' to see what is the
|
See the documentation for `hs-adjust-block-beginning' to see what is the
|
||||||
use of ADJUST-BEG-FUNC.
|
use of ADJUST-BEG-FUNC.
|
||||||
|
|
||||||
|
See the documentation for `hs-adjust-block-end' to see what is the
|
||||||
|
use of ADJUST-END-FUNC.
|
||||||
|
|
||||||
See the documentation for `hs-find-block-beginning-func' to see
|
See the documentation for `hs-find-block-beginning-func' to see
|
||||||
what is the use of FIND-BLOCK-BEGINNING-FUNC.
|
what is the use of FIND-BLOCK-BEGINNING-FUNC.
|
||||||
|
|
||||||
|
|
@ -420,7 +441,16 @@ is the use of FIND-NEXT-BLOCK-FUNC.
|
||||||
See the documentation for `hs-looking-at-block-start-p-func' to
|
See the documentation for `hs-looking-at-block-start-p-func' to
|
||||||
see what is the use of LOOKING-AT-BLOCK-START-P-FUNC.
|
see what is the use of LOOKING-AT-BLOCK-START-P-FUNC.
|
||||||
|
|
||||||
If any of the elements is left nil or omitted, hideshow tries to guess
|
See the documentation for `hs-inside-comment-p-func' to see what is the
|
||||||
|
use of INSIDE-COMMENT-P-FUNC.
|
||||||
|
|
||||||
|
TREESIT-THINGS is a thing defined in `treesit-thing-settings' to
|
||||||
|
determine if current block at point is valid, see
|
||||||
|
`treesit-thing-settings' for more information.
|
||||||
|
|
||||||
|
All the elements support mode hierarchy. If any of the elements is left
|
||||||
|
nil or omitted, hideshow searches for a value defined in some parent
|
||||||
|
mode in this alist; if no value is found, it tries to guess the
|
||||||
appropriate values. The regexps should not contain leading or trailing
|
appropriate values. The regexps should not contain leading or trailing
|
||||||
whitespace. Case does not matter.")
|
whitespace. Case does not matter.")
|
||||||
|
|
||||||
|
|
@ -548,7 +578,7 @@ element (using `match-beginning') before calling `hs-forward-sexp-func'.")
|
||||||
(defvar-local hs-block-end-regexp nil
|
(defvar-local hs-block-end-regexp nil
|
||||||
"Regexp for end of block.")
|
"Regexp for end of block.")
|
||||||
|
|
||||||
(defvar-local hs-forward-sexp-func #'forward-sexp
|
(defvar-local hs-forward-sexp-func nil
|
||||||
"Function used to do a `forward-sexp'.
|
"Function used to do a `forward-sexp'.
|
||||||
Should change for Algol-ish modes. For single-character block
|
Should change for Algol-ish modes. For single-character block
|
||||||
delimiters -- ie, the syntax table regexp for the character is
|
delimiters -- ie, the syntax table regexp for the character is
|
||||||
|
|
@ -556,7 +586,7 @@ either `(' or `)' -- `hs-forward-sexp-func' would just be
|
||||||
`forward-sexp'. For other modes such as simula, a more specialized
|
`forward-sexp'. For other modes such as simula, a more specialized
|
||||||
function is necessary.")
|
function is necessary.")
|
||||||
|
|
||||||
(defvar-local hs-adjust-block-beginning #'identity
|
(defvar-local hs-adjust-block-beginning nil
|
||||||
"Function used to tweak the block beginning.
|
"Function used to tweak the block beginning.
|
||||||
The block is hidden from the position returned by this function,
|
The block is hidden from the position returned by this function,
|
||||||
as opposed to hiding it from the position returned when searching
|
as opposed to hiding it from the position returned when searching
|
||||||
|
|
@ -576,7 +606,18 @@ It should not move the point.
|
||||||
|
|
||||||
See `hs-c-like-adjust-block-beginning' for an example of using this.")
|
See `hs-c-like-adjust-block-beginning' for an example of using this.")
|
||||||
|
|
||||||
(defvar-local hs-find-block-beginning-func #'hs-find-block-beginning
|
(defvar-local hs-adjust-block-end nil
|
||||||
|
"Function used to tweak the block end.
|
||||||
|
This is useful to ensure some characters such as parenthesis or curly
|
||||||
|
braces get properly hidden in python-like modes.
|
||||||
|
|
||||||
|
It is called with 1 argument which is the start position where the
|
||||||
|
overlay will be created.
|
||||||
|
|
||||||
|
It should return the last position to hide or nil. If it returns nil,
|
||||||
|
hideshow will guess the end position.")
|
||||||
|
|
||||||
|
(defvar-local hs-find-block-beginning-func nil
|
||||||
"Function used to do `hs-find-block-beginning'.
|
"Function used to do `hs-find-block-beginning'.
|
||||||
It should reposition point at the beginning of the current block
|
It should reposition point at the beginning of the current block
|
||||||
and return point, or nil if original point was not in a block.
|
and return point, or nil if original point was not in a block.
|
||||||
|
|
@ -585,7 +626,7 @@ Specifying this function is necessary for languages such as
|
||||||
Python, where regexp search and `syntax-ppss' check is not enough
|
Python, where regexp search and `syntax-ppss' check is not enough
|
||||||
to find the beginning of the current block.")
|
to find the beginning of the current block.")
|
||||||
|
|
||||||
(defvar-local hs-find-next-block-func #'hs-find-next-block
|
(defvar-local hs-find-next-block-func nil
|
||||||
"Function used to do `hs-find-next-block'.
|
"Function used to do `hs-find-next-block'.
|
||||||
It should reposition point at next block start.
|
It should reposition point at next block start.
|
||||||
|
|
||||||
|
|
@ -601,7 +642,7 @@ Specifying this function is necessary for languages such as
|
||||||
Python, where regexp search is not enough to find the beginning
|
Python, where regexp search is not enough to find the beginning
|
||||||
of the next block.")
|
of the next block.")
|
||||||
|
|
||||||
(defvar-local hs-looking-at-block-start-p-func #'hs-looking-at-block-start-p
|
(defvar-local hs-looking-at-block-start-p-func nil
|
||||||
"Function used to do `hs-looking-at-block-start-p'.
|
"Function used to do `hs-looking-at-block-start-p'.
|
||||||
It should return non-nil if the point is at the block start.
|
It should return non-nil if the point is at the block start.
|
||||||
|
|
||||||
|
|
@ -610,7 +651,20 @@ Python, where `looking-at' and `syntax-ppss' check is not enough
|
||||||
to check if the point is at the block start.")
|
to check if the point is at the block start.")
|
||||||
|
|
||||||
(defvar-local hs-inside-comment-p-func nil
|
(defvar-local hs-inside-comment-p-func nil
|
||||||
"Function used to check if point is inside a comment.")
|
"Function used to check if point is inside a comment.
|
||||||
|
If point is inside a comment, it should return a list containing the
|
||||||
|
buffer position of the start and the end of the comment, otherwise
|
||||||
|
return nil.
|
||||||
|
|
||||||
|
A comment block can be hidden only if on its starting line there is only
|
||||||
|
whitespace preceding the actual comment beginning. If point is inside
|
||||||
|
of a comment but this condition is not met, it can return a list having
|
||||||
|
a nil as its car and the end of comment position as cdr.")
|
||||||
|
|
||||||
|
(defvar-local hs-treesit-things nil
|
||||||
|
"Treesit things to check if point is at a valid block.
|
||||||
|
The value should be a thing defined in `treesit-thing-settings' for the
|
||||||
|
current buffer's major mode.")
|
||||||
|
|
||||||
(defvar hs-headline nil
|
(defvar hs-headline nil
|
||||||
"Text of the line where a hidden block begins, set during isearch.
|
"Text of the line where a hidden block begins, set during isearch.
|
||||||
|
|
@ -703,8 +757,7 @@ point."
|
||||||
;; `block-start' is the point at the end of the block
|
;; `block-start' is the point at the end of the block
|
||||||
;; beginning, which may need to be adjusted
|
;; beginning, which may need to be adjusted
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (funcall (or hs-adjust-block-beginning #'identity)
|
(goto-char (funcall hs-adjust-block-beginning header-end))
|
||||||
header-end))
|
|
||||||
(setq block-beg (line-end-position)))
|
(setq block-beg (line-end-position)))
|
||||||
;; `block-end' is the point at the end of the block
|
;; `block-end' is the point at the end of the block
|
||||||
(hs-forward-sexp mdata 1)
|
(hs-forward-sexp mdata 1)
|
||||||
|
|
@ -716,7 +769,8 @@ point."
|
||||||
(funcall hs-block-end-regexp)
|
(funcall hs-block-end-regexp)
|
||||||
(match-beginning 0))
|
(match-beginning 0))
|
||||||
(t (point))))
|
(t (point))))
|
||||||
(cons block-beg block-end))))))
|
(cons block-beg
|
||||||
|
(or (funcall hs-adjust-block-end block-beg) block-end)))))))
|
||||||
|
|
||||||
(defun hs--make-indicators-overlays (beg)
|
(defun hs--make-indicators-overlays (beg)
|
||||||
"Helper function to make the indicators overlays."
|
"Helper function to make the indicators overlays."
|
||||||
|
|
@ -924,18 +978,6 @@ Otherwise, return nil."
|
||||||
(goto-char (if end q (min p (match-end 0))))
|
(goto-char (if end q (min p (match-end 0))))
|
||||||
nil)))))
|
nil)))))
|
||||||
|
|
||||||
(defun hs-inside-comment-p ()
|
|
||||||
"Return non-nil if point is inside a comment, otherwise nil.
|
|
||||||
Actually, return a list containing the buffer position of the start
|
|
||||||
and the end of the comment. A comment block can be hidden only if on
|
|
||||||
its starting line there is only whitespace preceding the actual comment
|
|
||||||
beginning. If we are inside of a comment but this condition is not met,
|
|
||||||
we return a list having a nil as its car and the end of comment position
|
|
||||||
as cdr."
|
|
||||||
(if (functionp hs-inside-comment-p-func)
|
|
||||||
(funcall hs-inside-comment-p-func)
|
|
||||||
(hs-inside-comment-p--default)))
|
|
||||||
|
|
||||||
(defun hs-inside-comment-p--default ()
|
(defun hs-inside-comment-p--default ()
|
||||||
(save-excursion
|
(save-excursion
|
||||||
;; the idea is to look backwards for a comment start regexp, do a
|
;; the idea is to look backwards for a comment start regexp, do a
|
||||||
|
|
@ -987,43 +1029,100 @@ as cdr."
|
||||||
(when (>= (point) q)
|
(when (>= (point) q)
|
||||||
(list (and hideable p) (point))))))))
|
(list (and hideable p) (point))))))))
|
||||||
|
|
||||||
|
(defun hs--get-mode-value (value &optional old-nth)
|
||||||
|
"Get VALUE for current major mode in `hs-modes-alist'.
|
||||||
|
OLD-NTH is only used for backward compatibility with
|
||||||
|
`hs-special-modes-alist'."
|
||||||
|
(if-let* (old-nth
|
||||||
|
(old-lookup (assoc major-mode hs-special-modes-alist)))
|
||||||
|
(nth old-nth old-lookup)
|
||||||
|
(catch 'hs-grok-exit
|
||||||
|
(dolist (modes (get major-mode 'derived-mode--all-parents))
|
||||||
|
;; If we cannot find VALUE in current MODES, try to find it in
|
||||||
|
;; the next mode in MODES
|
||||||
|
(if-let* ((list (assoc modes hs-modes-alist))
|
||||||
|
(elm (alist-get value list)))
|
||||||
|
(throw 'hs-grok-exit elm))))))
|
||||||
|
|
||||||
(defun hs-grok-mode-type ()
|
(defun hs-grok-mode-type ()
|
||||||
"Set up hideshow variables for new buffers.
|
"Set up hideshow variables for new buffers.
|
||||||
If `hs-special-modes-alist' has information associated with the
|
If `hs-modes-alist' has information associated with the
|
||||||
current buffer's major mode, use that.
|
current buffer's major mode, use that.
|
||||||
Otherwise, guess start, end and `comment-start' regexps; `forward-sexp'
|
Otherwise, guess start, end and `comment-start' regexps; `forward-sexp'
|
||||||
function; and adjust-block-beginning function."
|
function; and adjust-block-beginning function."
|
||||||
(if (and (bound-and-true-p comment-start)
|
(if (and (bound-and-true-p comment-start)
|
||||||
(bound-and-true-p comment-end))
|
(bound-and-true-p comment-end))
|
||||||
(let* ((lookup (assoc major-mode hs-special-modes-alist))
|
(let ((start-elem (ensure-list (hs--get-mode-value 'start 1))))
|
||||||
(start-elem (or (nth 1 lookup) "\\s(")))
|
;; If some these variables are already set, use them instead.
|
||||||
(if (listp start-elem)
|
(setq
|
||||||
;; handle (START-REGEXP MDATA-SELECT)
|
;; handle (START-REGEXP MDATA-SELECT) and simple START-REGEXP
|
||||||
(setq hs-block-start-regexp (car start-elem)
|
hs-block-start-regexp
|
||||||
hs-block-start-mdata-select (cadr start-elem))
|
(if (local-variable-p 'hs-block-start-regexp)
|
||||||
;; backwards compatibility: handle simple START-REGEXP
|
hs-block-start-regexp
|
||||||
(setq hs-block-start-regexp start-elem
|
(or (car start-elem) "\\s("))
|
||||||
hs-block-start-mdata-select 0))
|
|
||||||
(setq hs-block-end-regexp (or (nth 2 lookup) "\\s)")
|
hs-block-start-mdata-select
|
||||||
hs-c-start-regexp (or (nth 3 lookup)
|
(if (local-variable-p 'hs-block-start-mdata-select)
|
||||||
(let ((c-start-regexp
|
hs-block-start-mdata-select
|
||||||
(regexp-quote comment-start)))
|
(or (cadr start-elem) 0))
|
||||||
(if (string-match " +$" c-start-regexp)
|
|
||||||
(substring c-start-regexp
|
hs-block-end-regexp
|
||||||
0 (1- (match-end 0)))
|
(if (local-variable-p 'hs-block-end-regexp)
|
||||||
c-start-regexp)))
|
hs-block-end-regexp
|
||||||
hs-forward-sexp-func (or (nth 4 lookup) #'forward-sexp)
|
(or (hs--get-mode-value 'end 2) "\\s)"))
|
||||||
hs-adjust-block-beginning (or (nth 5 lookup) #'identity)
|
|
||||||
hs-find-block-beginning-func (or (nth 6 lookup)
|
hs-c-start-regexp
|
||||||
#'hs-find-block-beginning)
|
(if (local-variable-p 'hs-c-start-regexp)
|
||||||
hs-find-next-block-func (or (nth 7 lookup)
|
hs-c-start-regexp
|
||||||
#'hs-find-next-block)
|
(or (hs--get-mode-value 'c-start 3)
|
||||||
hs-looking-at-block-start-p-func
|
(let ((c-start-regexp
|
||||||
(or (nth 8 lookup)
|
(regexp-quote comment-start)))
|
||||||
#'hs-looking-at-block-start-p)))
|
(if (string-match " +$" c-start-regexp)
|
||||||
|
(substring c-start-regexp
|
||||||
|
0 (1- (match-end 0)))
|
||||||
|
c-start-regexp))))
|
||||||
|
|
||||||
|
hs-forward-sexp-func
|
||||||
|
(if (local-variable-p 'hs-forward-sexp-func)
|
||||||
|
hs-forward-sexp-func
|
||||||
|
(or (hs--get-mode-value 'forward-fn 4)
|
||||||
|
#'forward-sexp))
|
||||||
|
|
||||||
|
hs-adjust-block-beginning
|
||||||
|
(or (hs--get-mode-value 'adjust-fn 5) #'identity)
|
||||||
|
|
||||||
|
hs-adjust-block-end
|
||||||
|
(or (hs--get-mode-value 'adjust-end-fn) #'ignore)
|
||||||
|
|
||||||
|
hs-find-block-beginning-func
|
||||||
|
(if (local-variable-p 'hs-find-block-beginning-func)
|
||||||
|
hs-find-block-beginning-func
|
||||||
|
(or (hs--get-mode-value 'find-beg-fn 6)
|
||||||
|
#'hs-find-block-beginning))
|
||||||
|
|
||||||
|
hs-find-next-block-func
|
||||||
|
(if (local-variable-p 'hs-find-next-block-func)
|
||||||
|
hs-find-next-block-func
|
||||||
|
(or (hs--get-mode-value 'find-next-fn 7)
|
||||||
|
#'hs-find-next-block))
|
||||||
|
|
||||||
|
hs-looking-at-block-start-p-func
|
||||||
|
(if (local-variable-p 'hs-looking-at-block-start-p-func)
|
||||||
|
hs-looking-at-block-start-p-func
|
||||||
|
(or (hs--get-mode-value 'look-start-fn 8)
|
||||||
|
#'hs-looking-at-block-start-p))
|
||||||
|
|
||||||
|
hs-inside-comment-p-func
|
||||||
|
(if (local-variable-p 'hs-inside-comment-p-func)
|
||||||
|
hs-inside-comment-p-func
|
||||||
|
(or (hs--get-mode-value 'commentp)
|
||||||
|
#'hs-inside-comment-p--default))
|
||||||
|
|
||||||
|
hs-treesit-things
|
||||||
|
(or (hs--get-mode-value 'treesit-things) 'list)))
|
||||||
|
|
||||||
(setq hs-minor-mode nil)
|
(setq hs-minor-mode nil)
|
||||||
(error "%s Mode doesn't support Hideshow Minor Mode"
|
(error "%S doesn't support Hideshow Minor Mode" major-mode)))
|
||||||
(format-mode-line mode-name))))
|
|
||||||
|
|
||||||
(defun hs-find-block-beginning ()
|
(defun hs-find-block-beginning ()
|
||||||
"Reposition point at block-start.
|
"Reposition point at block-start.
|
||||||
|
|
@ -1102,7 +1201,7 @@ Return point, or nil if original point was not in a block."
|
||||||
(defun hs-already-hidden-p ()
|
(defun hs-already-hidden-p ()
|
||||||
"Return non-nil if point is in an already-hidden block, otherwise nil."
|
"Return non-nil if point is in an already-hidden block, otherwise nil."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((c-reg (hs-inside-comment-p)))
|
(let ((c-reg (funcall hs-inside-comment-p-func)))
|
||||||
(if (and c-reg (nth 0 c-reg))
|
(if (and c-reg (nth 0 c-reg))
|
||||||
;; point is inside a comment, and that comment is hideable
|
;; point is inside a comment, and that comment is hideable
|
||||||
(goto-char (nth 0 c-reg))
|
(goto-char (nth 0 c-reg))
|
||||||
|
|
@ -1170,7 +1269,7 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments."
|
||||||
(eq (point) (match-beginning 0)))
|
(eq (point) (match-beginning 0)))
|
||||||
(goto-char (match-end 0)))))
|
(goto-char (match-end 0)))))
|
||||||
;; found a comment, probably
|
;; found a comment, probably
|
||||||
(let ((c-reg (hs-inside-comment-p)))
|
(let ((c-reg (funcall hs-inside-comment-p-func)))
|
||||||
(when (and c-reg (car c-reg))
|
(when (and c-reg (car c-reg))
|
||||||
(if (hs-hideable-region-p (car c-reg) (nth 1 c-reg))
|
(if (hs-hideable-region-p (car c-reg) (nth 1 c-reg))
|
||||||
(hs-hide-block-at-point t c-reg)
|
(hs-hide-block-at-point t c-reg)
|
||||||
|
|
@ -1196,7 +1295,7 @@ Upon completion, point is repositioned and the normal hook
|
||||||
`hs-hide-hook' is run. See documentation for `run-hooks'."
|
`hs-hide-hook' is run. See documentation for `run-hooks'."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(hs-life-goes-on
|
(hs-life-goes-on
|
||||||
(let ((c-reg (hs-inside-comment-p)))
|
(let ((c-reg (funcall hs-inside-comment-p-func)))
|
||||||
(cond
|
(cond
|
||||||
((and c-reg (or (null (nth 0 c-reg))
|
((and c-reg (or (null (nth 0 c-reg))
|
||||||
(not (hs-hideable-region-p (car c-reg) (nth 1 c-reg)))))
|
(not (hs-hideable-region-p (car c-reg) (nth 1 c-reg)))))
|
||||||
|
|
@ -1246,7 +1345,7 @@ See documentation for functions `hs-hide-block' and `run-hooks'."
|
||||||
(hs--refresh-indicators ov-start ov-end)
|
(hs--refresh-indicators ov-start ov-end)
|
||||||
t))
|
t))
|
||||||
;; not immediately obvious, look for a suitable block
|
;; not immediately obvious, look for a suitable block
|
||||||
(let ((c-reg (hs-inside-comment-p))
|
(let ((c-reg (funcall hs-inside-comment-p-func))
|
||||||
p q)
|
p q)
|
||||||
(cond (c-reg
|
(cond (c-reg
|
||||||
(when (car c-reg)
|
(when (car c-reg)
|
||||||
|
|
@ -1309,7 +1408,7 @@ This can be useful if you have huge RCS logs in those comments."
|
||||||
(let ((c-reg (save-excursion
|
(let ((c-reg (save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(skip-chars-forward " \t\n\f")
|
(skip-chars-forward " \t\n\f")
|
||||||
(hs-inside-comment-p))))
|
(funcall hs-inside-comment-p-func))))
|
||||||
(when c-reg
|
(when c-reg
|
||||||
(let ((beg (car c-reg)) (end (cadr c-reg)))
|
(let ((beg (car c-reg)) (end (cadr c-reg)))
|
||||||
;; see if we have enough comment lines to hide
|
;; see if we have enough comment lines to hide
|
||||||
|
|
@ -1341,10 +1440,8 @@ Key bindings:
|
||||||
(setq hs-headline nil)
|
(setq hs-headline nil)
|
||||||
(if hs-minor-mode
|
(if hs-minor-mode
|
||||||
(progn
|
(progn
|
||||||
;; Use such heuristics that if one buffer-local variable
|
;; Set the variables according to `hs-modes-alist'.
|
||||||
;; is already defined, don't overwrite other variables too.
|
(hs-grok-mode-type)
|
||||||
(unless (buffer-local-value 'hs-inside-comment-p-func (current-buffer))
|
|
||||||
(hs-grok-mode-type))
|
|
||||||
;; Turn off this mode if we change major modes.
|
;; Turn off this mode if we change major modes.
|
||||||
(add-hook 'change-major-mode-hook
|
(add-hook 'change-major-mode-hook
|
||||||
#'turn-off-hideshow
|
#'turn-off-hideshow
|
||||||
|
|
|
||||||
|
|
@ -167,12 +167,12 @@ with no args, if that value is non-nil."
|
||||||
;; imenu support
|
;; imenu support
|
||||||
(setq-local imenu-generic-expression icon-imenu-generic-expression)
|
(setq-local imenu-generic-expression icon-imenu-generic-expression)
|
||||||
;; hideshow support
|
;; hideshow support
|
||||||
;; we start from the assertion that `hs-special-modes-alist' is autoloaded.
|
;; we start from the assertion that `hs-modes-alist' is autoloaded.
|
||||||
(unless (assq 'icon-mode hs-special-modes-alist)
|
(unless (assq 'icon-mode hs-modes-alist)
|
||||||
(setq hs-special-modes-alist
|
(setq hs-modes-alist
|
||||||
(cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil
|
(cons '(icon-mode (start . "\\<procedure\\>") (end . "\\<end\\>")
|
||||||
icon-forward-sexp-function)
|
(forward-fn . icon-forward-sexp-function))
|
||||||
hs-special-modes-alist))))
|
hs-modes-alist))))
|
||||||
|
|
||||||
;; This is used by indent-for-comment to decide how much to
|
;; This is used by indent-for-comment to decide how much to
|
||||||
;; indent a comment in Icon code based on its context.
|
;; indent a comment in Icon code based on its context.
|
||||||
|
|
|
||||||
|
|
@ -553,12 +553,12 @@ See `imenu-generic-expression'.")
|
||||||
(add-hook 'flymake-diagnostic-functions #'lua-flymake nil t)
|
(add-hook 'flymake-diagnostic-functions #'lua-flymake nil t)
|
||||||
|
|
||||||
;; Hide-show setup
|
;; Hide-show setup
|
||||||
(unless (assq 'lua-mode hs-special-modes-alist)
|
(unless (assq 'lua-mode hs-modes-alist)
|
||||||
(add-to-list 'hs-special-modes-alist
|
(add-to-list 'hs-modes-alist
|
||||||
`(lua-mode
|
`(lua-mode
|
||||||
,(regexp-opt (mapcar 'car lua-sexp-alist) 'words) ; Start
|
(start . ,(regexp-opt (mapcar 'car lua-sexp-alist) 'words)) ; Start
|
||||||
,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ; End
|
(end . ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words)) ; End
|
||||||
nil lua-forward-sexp))))
|
(forward-fn . lua-forward-sexp)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
|
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
|
||||||
|
|
|
||||||
|
|
@ -5912,6 +5912,22 @@ are also searched. REGEXP is passed to `looking-at' to set
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(looking-at regexp)))))
|
(looking-at regexp)))))
|
||||||
|
|
||||||
|
(defun python-ts-hs-adjust-block-end-fn (block-beg)
|
||||||
|
"Python-ts-mode specific `hs-adjust-block-end' function for `hs-minor-mode'.
|
||||||
|
|
||||||
|
BLOCK-BEG is the beginning position where the hiding will be performed.
|
||||||
|
|
||||||
|
This is only used to properly hide the block when there are not closing
|
||||||
|
parens."
|
||||||
|
(unless (save-excursion
|
||||||
|
(goto-char block-beg)
|
||||||
|
(treesit-thing-at
|
||||||
|
(1- (point))
|
||||||
|
'(or "argument_list"
|
||||||
|
(and anonymous "\\`[](),[{}]\\'")
|
||||||
|
"string")))
|
||||||
|
(line-end-position)))
|
||||||
|
|
||||||
|
|
||||||
;;; Imenu
|
;;; Imenu
|
||||||
|
|
||||||
|
|
@ -7339,21 +7355,24 @@ implementations: `python-mode' and `python-ts-mode'."
|
||||||
#'python-eldoc-function))))
|
#'python-eldoc-function))))
|
||||||
(eldoc-add-command-completions "python-indent-dedent-line-backspace")
|
(eldoc-add-command-completions "python-indent-dedent-line-backspace")
|
||||||
|
|
||||||
;; TODO: Use tree-sitter to figure out the block in `python-ts-mode'.
|
(add-to-list
|
||||||
(dolist (mode '(python-mode python-ts-mode))
|
'hs-modes-alist
|
||||||
(add-to-list
|
`(python-mode
|
||||||
'hs-special-modes-alist
|
(start . ,python-nav-beginning-of-block-regexp)
|
||||||
`(,mode
|
;; Use the empty string as end regexp so it doesn't default to
|
||||||
,python-nav-beginning-of-block-regexp
|
;; "\\s)". This way parens at end of defun are properly hidden.
|
||||||
;; Use the empty string as end regexp so it doesn't default to
|
(end . "")
|
||||||
;; "\\s)". This way parens at end of defun are properly hidden.
|
(c-start . "#")
|
||||||
""
|
(forward-fn . python-hideshow-forward-sexp-function)
|
||||||
"#"
|
(find-beg-fn . python-nav-beginning-of-block)
|
||||||
python-hideshow-forward-sexp-function
|
(find-next-fn . python-hideshow-find-next-block)
|
||||||
nil
|
(look-start-fn . python-info-looking-at-beginning-of-block)))
|
||||||
python-nav-beginning-of-block
|
|
||||||
python-hideshow-find-next-block
|
(add-to-list
|
||||||
python-info-looking-at-beginning-of-block)))
|
'hs-modes-alist
|
||||||
|
'(python-ts-mode
|
||||||
|
(treesit-things . (or defun sexp))
|
||||||
|
(adjust-end-fn . python-ts-hs-adjust-block-end-fn)))
|
||||||
|
|
||||||
(setq-local outline-regexp (python-rx (* space) block-start))
|
(setq-local outline-regexp (python-rx (* space) block-start))
|
||||||
(setq-local outline-level
|
(setq-local outline-level
|
||||||
|
|
|
||||||
|
|
@ -4363,12 +4363,12 @@ Key bindings specific to `verilog-mode-map' are:
|
||||||
(when (and (boundp 'which-func-modes) (listp which-func-modes))
|
(when (and (boundp 'which-func-modes) (listp which-func-modes))
|
||||||
(add-to-list 'which-func-modes 'verilog-mode))
|
(add-to-list 'which-func-modes 'verilog-mode))
|
||||||
;; hideshow support
|
;; hideshow support
|
||||||
(when (boundp 'hs-special-modes-alist)
|
(when (boundp 'hs-modes-alist)
|
||||||
(unless (assq 'verilog-mode hs-special-modes-alist)
|
(unless (assq 'verilog-mode hs-modes-alist)
|
||||||
(setq hs-special-modes-alist
|
(setq hs-modes-alist
|
||||||
(cons '(verilog-mode "\\<begin\\>" "\\<end\\>" nil
|
(cons '(verilog-mode (beg . "\\<begin\\>") (end . "\\<end\\>")
|
||||||
verilog-forward-sexp-function)
|
(forward-fn . verilog-forward-sexp-function))
|
||||||
hs-special-modes-alist))))
|
hs-modes-alist))))
|
||||||
|
|
||||||
(add-hook 'completion-at-point-functions
|
(add-hook 'completion-at-point-functions
|
||||||
#'verilog-completion-at-point nil 'local)
|
#'verilog-completion-at-point nil 'local)
|
||||||
|
|
|
||||||
|
|
@ -13282,11 +13282,11 @@ File statistics: \"%s\"\n\
|
||||||
(if (not (boundp 'hs-block-start-mdata-select))
|
(if (not (boundp 'hs-block-start-mdata-select))
|
||||||
(vhdl-warning-when-idle "Install included `hideshow.el' patch first (see INSTALL file)")
|
(vhdl-warning-when-idle "Install included `hideshow.el' patch first (see INSTALL file)")
|
||||||
;; initialize hideshow
|
;; initialize hideshow
|
||||||
(unless (assoc 'vhdl-mode hs-special-modes-alist)
|
(unless (assoc 'vhdl-mode hs-modes-alist)
|
||||||
(setq hs-special-modes-alist
|
(setq hs-modes-alist
|
||||||
(cons (list 'vhdl-mode vhdl-hs-start-regexp nil "--\\( \\|$\\)"
|
(cons `(vhdl-mode (start . ,vhdl-hs-start-regexp) (c-start . "--\\( \\|$\\)")
|
||||||
'vhdl-hs-forward-sexp-func nil)
|
(forward-fn . vhdl-hs-forward-sexp-func))
|
||||||
hs-special-modes-alist)))
|
hs-modes-alist)))
|
||||||
(if (featurep 'xemacs) (make-local-hook 'hs-minor-mode-hook))
|
(if (featurep 'xemacs) (make-local-hook 'hs-minor-mode-hook))
|
||||||
(if vhdl-hide-all-init
|
(if vhdl-hide-all-init
|
||||||
(add-hook 'hs-minor-mode-hook #'hs-hide-all nil t)
|
(add-hook 'hs-minor-mode-hook #'hs-hide-all nil t)
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ This is used by `mhtml--pre-command'.")
|
||||||
(flyspell-generic-progmode-verify)
|
(flyspell-generic-progmode-verify)
|
||||||
t)))
|
t)))
|
||||||
|
|
||||||
;; Support for hideshow.el (see `hs-special-modes-alist').
|
;; Support for hideshow.el (see `hs-modes-alist').
|
||||||
(defun mhtml-forward (arg)
|
(defun mhtml-forward (arg)
|
||||||
"Move point forward past a structured expression.
|
"Move point forward past a structured expression.
|
||||||
If point is on a tag, move to the end of the tag.
|
If point is on a tag, move to the end of the tag.
|
||||||
|
|
|
||||||
|
|
@ -4249,7 +4249,7 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
|
||||||
|
|
||||||
(defun treesit-hs-block-end ()
|
(defun treesit-hs-block-end ()
|
||||||
"Tree-sitter implementation of `hs-block-end-regexp'."
|
"Tree-sitter implementation of `hs-block-end-regexp'."
|
||||||
(let* ((pred 'list)
|
(let* ((pred (bound-and-true-p hs-treesit-things))
|
||||||
(thing (treesit-thing-at
|
(thing (treesit-thing-at
|
||||||
(if (bobp) (point) (1- (point))) pred))
|
(if (bobp) (point) (1- (point))) pred))
|
||||||
(end (when thing (treesit-node-end thing)))
|
(end (when thing (treesit-node-end thing)))
|
||||||
|
|
@ -4262,7 +4262,7 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
|
||||||
|
|
||||||
(defun treesit-hs-find-block-beginning ()
|
(defun treesit-hs-find-block-beginning ()
|
||||||
"Tree-sitter implementation of `hs-find-block-beginning-func'."
|
"Tree-sitter implementation of `hs-find-block-beginning-func'."
|
||||||
(let* ((pred 'list)
|
(let* ((pred (bound-and-true-p hs-treesit-things))
|
||||||
(thing (treesit-thing-at (point) pred))
|
(thing (treesit-thing-at (point) pred))
|
||||||
(beg (when thing (treesit-node-start thing)))
|
(beg (when thing (treesit-node-start thing)))
|
||||||
(end (when beg (min (1+ beg) (point-max)))))
|
(end (when beg (min (1+ beg) (point-max)))))
|
||||||
|
|
@ -4279,17 +4279,18 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
|
||||||
(when comments
|
(when comments
|
||||||
(if (treesit-thing-defined-p 'comment (treesit-language-at (point)))
|
(if (treesit-thing-defined-p 'comment (treesit-language-at (point)))
|
||||||
'comment "\\`comment\\'")))
|
'comment "\\`comment\\'")))
|
||||||
(pred (if comment-pred (append '(or list) (list comment-pred)) 'list))
|
(hs-things (bound-and-true-p hs-treesit-things))
|
||||||
|
(pred (append `(or ,hs-things) (when comment-pred (list comment-pred))))
|
||||||
;; `treesit-navigate-thing' can't find a thing at bobp,
|
;; `treesit-navigate-thing' can't find a thing at bobp,
|
||||||
;; so use `treesit-thing-at' to match at bobp.
|
;; so use `treesit-thing-at' to match at bobp.
|
||||||
(current (treesit-thing-at (point) pred))
|
(current (treesit-thing-at (point) pred))
|
||||||
(beg (or (and current (eq (point) (treesit-node-start current)) (point))
|
(beg (or (and current (eq (point) (treesit-node-start current)) (point))
|
||||||
(treesit-navigate-thing (point) 1 'beg pred)))
|
(treesit-navigate-thing (point) 1 'beg pred)))
|
||||||
;; Check if we found a list or a comment
|
;; Check if we found a block or a comment
|
||||||
(list-thing (when beg (treesit-thing-at beg 'list)))
|
(block-thing (when beg (treesit-thing-at beg hs-things)))
|
||||||
(comment-thing (when beg (treesit-thing-at beg comment-pred)))
|
(comment-thing (when beg (treesit-thing-at beg comment-pred)))
|
||||||
(comment-p (and comment-thing (eq beg (treesit-node-start comment-thing))))
|
(comment-p (and comment-thing (eq beg (treesit-node-start comment-thing))))
|
||||||
(thing (if comment-p comment-thing list-thing))
|
(thing (if comment-p comment-thing block-thing))
|
||||||
(end (if thing (min (1+ (treesit-node-start thing)) (point-max)))))
|
(end (if thing (min (1+ (treesit-node-start thing)) (point-max)))))
|
||||||
(when (and end (<= end maxp))
|
(when (and end (<= end maxp))
|
||||||
(goto-char end)
|
(goto-char end)
|
||||||
|
|
@ -4301,7 +4302,7 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
|
||||||
|
|
||||||
(defun treesit-hs-looking-at-block-start-p ()
|
(defun treesit-hs-looking-at-block-start-p ()
|
||||||
"Tree-sitter implementation of `hs-looking-at-block-start-p-func'."
|
"Tree-sitter implementation of `hs-looking-at-block-start-p-func'."
|
||||||
(let* ((pred 'list)
|
(let* ((pred (bound-and-true-p hs-treesit-things))
|
||||||
(thing (treesit-thing-at (point) pred))
|
(thing (treesit-thing-at (point) pred))
|
||||||
(beg (when thing (treesit-node-start thing)))
|
(beg (when thing (treesit-node-start thing)))
|
||||||
(end (min (1+ (point)) (point-max))))
|
(end (min (1+ (point)) (point-max))))
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,15 @@
|
||||||
|
|
||||||
(ert-deftest test-map-ynp-kmacro ()
|
(ert-deftest test-map-ynp-kmacro ()
|
||||||
"Test that `map-y-or-n-p' in a kmacro terminates on end of input."
|
"Test that `map-y-or-n-p' in a kmacro terminates on end of input."
|
||||||
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET y"))
|
(cl-letf* (((symbol-function #'backtrace-print) (lambda ()))) ;; bug#67836
|
||||||
(should-error
|
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET y"))
|
||||||
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET")))
|
(should-error
|
||||||
(unless noninteractive
|
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET")))
|
||||||
(let ((noninteractive t))
|
(unless noninteractive
|
||||||
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET y"))
|
(let ((noninteractive t))
|
||||||
(should-error
|
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET y"))
|
||||||
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET"))))))
|
(should-error
|
||||||
|
(execute-kbd-macro (read-kbd-macro "M-: (map-ynp-tests-simple-call) RET")))))))
|
||||||
|
|
||||||
(provide 'map-ynp-tests)
|
(provide 'map-ynp-tests)
|
||||||
;;; map-ynp-tests.el ends here
|
;;; map-ynp-tests.el ends here
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue