diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mouse-drag.el | 19 | ||||
-rw-r--r-- | lisp/progmodes/js.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/json-ts-mode.el | 6 | ||||
-rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 18 | ||||
-rw-r--r-- | lisp/textmodes/css-mode.el | 5 | ||||
-rw-r--r-- | lisp/treesit.el | 7 |
6 files changed, 36 insertions, 21 deletions
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el index f515cc8aacf..81b699c0202 100644 --- a/lisp/mouse-drag.el +++ b/lisp/mouse-drag.el @@ -275,6 +275,7 @@ To test this function, evaluate: have-scrolled window-last-row col window-last-col + switch-frame-p (scroll-col-delta 0) ;; be conservative about allowing horizontal scrolling (col-scrolling-p (mouse-drag-should-do-col-scrolling))) @@ -286,15 +287,21 @@ To test this function, evaluate: (setq track-mouse 'drag-dragging) (while (progn (setq event (read--potential-mouse-event) - end (event-end event) - row (cdr (posn-col-row end)) - col (car (posn-col-row end))) - (or (mouse-movement-p event) - (eq (car-safe event) 'switch-frame))) + switch-frame-p (eq (car-safe event) 'switch-frame)) + ;; We want to skip switch-frame events and treat then + ;; as moves over a different window. These events have + ;; no position spec, so all the posn-* accessor + ;; functions are likely to barf if passed such an + ;; event. + (or switch-frame-p + (setq end (event-end event) + row (cdr (posn-col-row end)) + col (car (posn-col-row end)))) + (or (mouse-movement-p event) switch-frame-p)) ;; Scroll if see if we're on the edge. ;; FIXME: should handle mouse-in-other window. (cond - ((not (eq start-window (posn-window end))) + ((or switch-frame-p (not (eq start-window (posn-window end)))) t) ; wait for return to original window ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0)) ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0)) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 90ab7cc924b..45dfef372cd 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3734,7 +3734,7 @@ definition*\"." (var-tree (treesit-induce-sparse-tree node "lexical_declaration" nil 1000))) `(("Class" . ,(js--treesit-imenu-1 class-tree)) - ("Varieable" . ,(js--treesit-imenu-1 var-tree)) + ("Variable" . ,(js--treesit-imenu-1 var-tree)) ("Function" . ,(js--treesit-imenu-1 func-tree))))) ;;; Main Function diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 101e873cf6e..8ea582ad8fa 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -93,6 +93,10 @@ :override t '((escape_sequence) @font-lock-escape-face) :language 'json + :feature 'pair + :override t ; Needed for overriding string face on keys. + '((pair key: (_) @font-lock-variable-name-face)) + :language 'json :feature 'error :override t '((ERROR) @font-lock-warning-face)) @@ -156,7 +160,7 @@ the subtrees." ;; Font-lock. (setq-local treesit-font-lock-settings json-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((constant number string) + '((constant number pair string) (escape-sequence) (bracket delimiter error))) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 48ac1169fe8..3da690567e2 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -213,7 +213,14 @@ Argument LANGUAGE is either `typescript' or `tsx'." parameters: [(_ (identifier) @font-lock-variable-name-face) (_ (_ (identifier) @font-lock-variable-name-face)) - (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) + (_ (_ (_ (identifier) @font-lock-variable-name-face)))]) + + (return_statement (identifier) @font-lock-variable-name-face) + + (binary_expression left: (identifier) @font-lock-variable-name-face) + (binary_expression right: (identifier) @font-lock-variable-name-face) + + (arguments (identifier) @font-lock-variable-name-face)) :language language :override t @@ -282,7 +289,14 @@ Argument LANGUAGE is either `typescript' or `tsx'." :language language :override t :feature 'property - `((pair value: (identifier) @font-lock-variable-name-face) + `((property_signature + name: (property_identifier) @font-lock-property-face) + (public_field_definition + name: (property_identifier) @font-lock-property-face) + + (pair key: (property_identifier) @font-lock-variable-name-face) + + (pair value: (identifier) @font-lock-variable-name-face) ((shorthand_property_identifier) @font-lock-property-face) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index b82886e3974..8a66986dc6f 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1839,11 +1839,6 @@ can also be used to fill comments. '((selector comment query keyword) (property constant string) (error variable function operator bracket))) - ;; Tree-sitter-css, for whatever reason, cannot reliably return - ;; the captured nodes in a given range (it instead returns the - ;; nodes preceding range). Before this is fixed in - ;; tree-sitter-css, use this heuristic as a temporary fix. - (setq-local treesit--font-lock-query-expand-range (cons 80 80)) (setq-local imenu-create-index-function #'css--treesit-imenu) (setq-local which-func-functions nil) (treesit-major-mode-setup))) diff --git a/lisp/treesit.el b/lisp/treesit.el index eee6eee0c7f..dbbf7ec18c3 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -545,12 +545,7 @@ This should be a cons cell (START . END). When fontifying a buffer, Emacs will move the start of the query range backward by START amount, and the end of the query range by END amount. Both START and END should be positive integers or 0. This doesn't -affect the fontified range. - -Sometimes, querying on some parser with a restricted range -returns nodes not in that range but before it, which breaks -fontification. Major modes can adjust this variable as a -temporarily fix.") +affect the fontified range.") (defvar-local treesit-font-lock-feature-list nil "A list of lists of feature symbols. |