Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
2026-06-18 Bob Weiner <rsw@gnu.org>

* hui-select.el (hui-select-get-syntax-table): Add and leave syntax-table
unchanged when in a programming mode so that <> pair syntax does not
interfere with {} region/sexp selection.

* test/hibtypes-tests.el (ibtypes::ilink-test): Add and ensure only one
instance of this test.

Expand Down
25 changes: 12 additions & 13 deletions hui-select.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Oct-96 at 02:25:27
;; Last-Mod: 7-Mar-26 at 18:39:40 by Bob Weiner
;; Last-Mod: 18-Jun-26 at 13:05:12 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -604,10 +604,7 @@ Also, add language-specific syntax setups to aid in thing selection."

(defun hui-select-get-region-boundaries ()
"Return the (START . END) boundaries of region for `hui-select-thing'."
(with-syntax-table
(if (memq major-mode hui-select-ignore-quoted-sexp-modes)
(syntax-table)
hui-select-syntax-table)
(with-syntax-table (hui-select-get-syntax-table)
(or (hui-select-boundaries (point))
(when (eq hui-select-previous 'punctuation)
(hui-select-word (point))))))
Expand All @@ -633,10 +630,8 @@ Also, add language-specific syntax setups to aid in thing selection."

(defun hui-select-scan-sexps (from count)
"Scan FROM point across COUNT sexpressions."
(if (memq major-mode hui-select-ignore-quoted-sexp-modes)
(scan-sexps from count)
(with-syntax-table hui-select-syntax-table
(scan-sexps from count))))
(with-syntax-table (hui-select-get-syntax-table)
(scan-sexps from count)))

;;;###autoload
(defun hui-select-thing (&optional interactive-flag)
Expand Down Expand Up @@ -1060,10 +1055,7 @@ call to select that syntactic unit."
(unless (and (memq major-mode hui-select-ignore-quoted-sexp-modes)
;; Ignore quoted identifier sexpressions, like #'function
(char-after) (memq (char-after) '(?# ?\')))
(with-syntax-table
(if (memq major-mode hui-select-ignore-quoted-sexp-modes)
(syntax-table)
hui-select-syntax-table)
(with-syntax-table (hui-select-get-syntax-table)
(let ((hui-select-char-p)
(hui-select-whitespace)
(hui-select-syntax-alist '((?\" . hui-select-string)
Expand All @@ -1078,6 +1070,13 @@ call to select that syntactic unit."
(hui-select-reset)
(funcall func)))))

(defun hui-select-get-syntax-table ()
"Return syntax table to use for syntactic selection based on `major-mode'."
(if (or (derived-mode-p 'prog-mode)
(memq major-mode hui-select-ignore-quoted-sexp-modes))
(syntax-table)
hui-select-syntax-table))

(defun hui-select-region-bigger-p (old-region new-region)
"Non-nil means the new region is bigger than the old region.
Return t if OLD-REGION is smaller than NEW-REGION and NEW-REGION
Expand Down