33; ; Author: Bob Weiner
44; ;
55; ; Orig-Date: 19-Oct-96 at 02:25:27
6- ; ; Last-Mod: 7-Mar -26 at 18:39:40 by Bob Weiner
6+ ; ; Last-Mod: 18-Jun -26 at 13:05:12 by Bob Weiner
77; ;
88; ; SPDX-License-Identifier: GPL-3.0-or-later
99; ;
@@ -604,10 +604,7 @@ Also, add language-specific syntax setups to aid in thing selection."
604604
605605(defun hui-select-get-region-boundaries ()
606606 " Return the (START . END) boundaries of region for `hui-select-thing' ."
607- (with-syntax-table
608- (if (memq major-mode hui-select-ignore-quoted-sexp-modes)
609- (syntax-table )
610- hui-select-syntax-table)
607+ (with-syntax-table (hui-select-get-syntax-table)
611608 (or (hui-select-boundaries (point ))
612609 (when (eq hui-select-previous 'punctuation )
613610 (hui-select-word (point ))))))
@@ -633,10 +630,8 @@ Also, add language-specific syntax setups to aid in thing selection."
633630
634631(defun hui-select-scan-sexps (from count )
635632 " Scan FROM point across COUNT sexpressions."
636- (if (memq major-mode hui-select-ignore-quoted-sexp-modes)
637- (scan-sexps from count)
638- (with-syntax-table hui-select-syntax-table
639- (scan-sexps from count))))
633+ (with-syntax-table (hui-select-get-syntax-table)
634+ (scan-sexps from count)))
640635
641636;;;### autoload
642637(defun hui-select-thing (&optional interactive-flag )
@@ -1060,10 +1055,7 @@ call to select that syntactic unit."
10601055 (unless (and (memq major-mode hui-select-ignore-quoted-sexp-modes)
10611056 ; ; Ignore quoted identifier sexpressions, like #'function
10621057 (char-after ) (memq (char-after ) '(?# ?\' )))
1063- (with-syntax-table
1064- (if (memq major-mode hui-select-ignore-quoted-sexp-modes)
1065- (syntax-table )
1066- hui-select-syntax-table)
1058+ (with-syntax-table (hui-select-get-syntax-table)
10671059 (let ((hui-select-char-p)
10681060 (hui-select-whitespace)
10691061 (hui-select-syntax-alist '((?\" . hui-select-string)
@@ -1078,6 +1070,13 @@ call to select that syntactic unit."
10781070 (hui-select-reset)
10791071 (funcall func)))))
10801072
1073+ (defun hui-select-get-syntax-table ()
1074+ " Return syntax table to use for syntactic selection based on `major-mode' ."
1075+ (if (or (derived-mode-p 'prog-mode )
1076+ (memq major-mode hui-select-ignore-quoted-sexp-modes))
1077+ (syntax-table )
1078+ hui-select-syntax-table))
1079+
10811080(defun hui-select-region-bigger-p (old-region new-region )
10821081 " Non-nil means the new region is bigger than the old region.
10831082Return t if OLD-REGION is smaller than NEW-REGION and NEW-REGION
0 commit comments