[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hyperbole 202a3f9404 08/12: * hui-select.el: Fix a few wa
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/hyperbole 202a3f9404 08/12: * hui-select.el: Fix a few warnings and improve some docstrings |
Date: |
Tue, 27 Jun 2023 17:38:40 -0400 (EDT) |
branch: scratch/hyperbole
commit 202a3f940481b537ab3b8273a166616d5e2b4bb9
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* hui-select.el: Fix a few warnings and improve some docstrings
(hui-select-initialize): Use `dolist`; let-bind
vars rather than just `setq`ing them; use closures.
(hui-select-goto-matching-tag): Fix markup.
(hui-select-indent-non-end-regexp-alist)
(hui-select-indent-end-regexp-alist): Use conventional markup for metavars.
---
hui-select.el | 56 +++++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/hui-select.el b/hui-select.el
index 4880e4626b..8624c332e0 100644
--- a/hui-select.el
+++ b/hui-select.el
@@ -366,33 +366,35 @@ Also, add language-specific syntax setups to aid in thing
selection."
;;
;; Make tag begin and end delimiters act like grouping characters,
;; for easy syntactical selection of tags.
- (let (hook-sym mode-str)
- (mapc (lambda (mode)
- (setq mode-str (symbol-name mode)
- hook-sym (intern (concat mode-str "-hook"))
- syntax-table-sym (intern (concat mode-str "-syntax-table"))
- keymap-sym (intern (concat mode-str "-map")))
- (var:add-and-run-hook hook-sym
- `(lambda ()
- (let ((syntax-table (symbol-value
',syntax-table-sym))
- (keymap (symbol-value
',keymap-sym)))
- (modify-syntax-entry ?\< "(>"
syntax-table)
- (modify-syntax-entry ?\> ")<"
syntax-table)
- (modify-syntax-entry ?\{ "(}"
syntax-table)
- (modify-syntax-entry ?\} "){"
syntax-table)
- (modify-syntax-entry ?\" "\""
syntax-table)
- (modify-syntax-entry ?= "."
syntax-table)
- (modify-syntax-entry ?. "_"
syntax-table)
- (setq sentence-end "\\([^
\t\n\r>]<\\|>\\(<[^>]*>\\)*\\|[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)\\)[ \t\n]*")
- (define-key keymap "\C-c."
'hui-select-goto-matching-tag))))
- (unless (eq mode 'web-mode)
- (var:add-and-run-hook
- hook-sym (lambda ()
- (make-local-variable 'comment-start)
- (make-local-variable 'comment-end)
- (setq comment-start "<!--" comment-end "-->")
- (make-local-variable 'sentence-end)))))
- hui-select-markup-modes)))
+ (dolist (mode hui-select-markup-modes)
+ (let* ((mode-str (symbol-name mode))
+ (hook-sym (intern (concat mode-str "-hook")))
+ (syntax-table-sym (intern (concat mode-str "-syntax-table")))
+ (keymap-sym (intern (concat mode-str "-map"))))
+ ;; FIXME: Don't add lambdas to hooks. Instead give names to
+ ;; those functions and add the symbol to the hook. Makes it
+ ;; easier/possible to remove/update the function on the hook.
+ (var:add-and-run-hook hook-sym
+ (lambda ()
+ (let ((syntax-table (symbol-value
syntax-table-sym))
+ (keymap (symbol-value keymap-sym)))
+ (modify-syntax-entry ?\< "(>" syntax-table)
+ (modify-syntax-entry ?\> ")<" syntax-table)
+ (modify-syntax-entry ?\{ "(}" syntax-table)
+ (modify-syntax-entry ?\} "){" syntax-table)
+ (modify-syntax-entry ?\" "\"" syntax-table)
+ (modify-syntax-entry ?= "." syntax-table)
+ (modify-syntax-entry ?. "_" syntax-table)
+ (setq sentence-end "\\([^
\t\n\r>]<\\|>\\(<[^>]*>\\)*\\|[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)\\)[ \t\n]*")
+ (define-key keymap "\C-c."
#'hui-select-goto-matching-tag))))
+ (unless (eq mode 'web-mode)
+ (var:add-and-run-hook
+ hook-sym (lambda ()
+ ;; FIXME: Why not rely on the major mode's own settings?
+ (make-local-variable 'comment-end) ;FIXME: Why?
+ (setq-local comment-start "<!--" comment-end "-->")
+ (make-local-variable 'sentence-end) ;FIXME: Why?
+ ))))))
(defun hui-select-get-region-boundaries ()
"Return the (START . END) boundaries of region for `hui-select-thing'."
- [elpa] branch scratch/hyperbole created (now a823391b89), Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 6865cd9499 03/12: Try and avoid using `hyperb:stack-frame`, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 4917563d26 05/12: (kview:char-invisible-p): Stop using function, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole f00a0feb2e 07/12: hyperbole-autoloads.el: Remove needless definitions, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 15c6dd1d49 02/12: * hversion.el (hyperb:path-being-loaded): Delete function, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole c40109f9b6 10/12: * hbut.el (defib): Remove redundant indent property, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 580e459502 04/12: Get rid of `hyperb:stack-frame`, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 557cf93559 06/12: * hyperbole.el: Preload `kotl-autoloads`, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 202a3f9404 08/12: * hui-select.el: Fix a few warnings and improve some docstrings,
Stefan Monnier <=
- [elpa] scratch/hyperbole fa47424e75 09/12: hactypes.el (rfc-toc): Remove redundant `buffer-read-only` let-binding, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole 16e0be430c 11/12: * hyrolo.el: A few cosmetic tweaks, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole f8f407a69f 01/12: * hload-path.el (hyperb:dir): Use `macroexp-file-name`, Stefan Monnier, 2023/06/27
- [elpa] scratch/hyperbole a823391b89 12/12: * hversion.el (hyperb:automount-prefixes): Remove unused var., Stefan Monnier, 2023/06/27