Skip to main content
added 317 characters in body
Source Link
Hi-Angel
  • 878
  • 10
  • 19

Not being satisfied with side-effects of evil-symbol-word-search or having to applyhardcode (modify-syntax-entry) explicitly tofor every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That meansSo you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless;; (orI (memberwant majorunderscore be part of word syntax table, but not in regexp-replace buffer
  ;; where I'm more comfortable having more verbose navigation with underscore not
  ;; being a part of a word. To achieve this I check if current mode has a syntax
  ;; table different from the global one. The `(eq)' is a lightweight test of whether
  ;; the args point to the same object.
  (special-modeunless fundamental-mode(eq lisp(standard-interactionsyntax-mode)table) (minibufferpsyntax-table))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (member major-mode '(special-mode fundamental-mode lisp-interaction-mode)) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

Not being satisfied with side-effects of evil-symbol-word-search or having to hardcode (modify-syntax-entry) for every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. So you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  ;; I want underscore be part of word syntax table, but not in regexp-replace buffer
  ;; where I'm more comfortable having more verbose navigation with underscore not
  ;; being a part of a word. To achieve this I check if current mode has a syntax
  ;; table different from the global one. The `(eq)' is a lightweight test of whether
  ;; the args point to the same object.
  (unless (eq (standard-syntax-table) (syntax-table))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

exclude more modes from the underscore hack
Source Link
Hi-Angel
  • 878
  • 10
  • 19

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (eqmember major-mode 'special'(special-mode fundamental-mode lisp-interaction-mode)) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (eq major-mode 'special-mode) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (member major-mode '(special-mode fundamental-mode lisp-interaction-mode)) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

added 4 characters in body
Source Link
Hi-Angel
  • 878
  • 10
  • 19

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (eq major-mode 'special-mode) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines tableparagraph that was modifying syntax table of every possible mode I got to work with.

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (eq major-mode 'special-mode) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines table that was modifying syntax table of every possible mode I got to work with.

Not being satisfied with side-effects of evil-symbol-word-search or having to apply (modify-syntax-entry) explicitly to every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That means you can add a hook to modify syntax table to evil-mode hook and it should just work.

(defun myhook-evil-mode ()
  (unless (or (eq major-mode 'special-mode) (minibufferp))
    ;; make underscore part of a word
    (modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)

Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.

Source Link
Hi-Angel
  • 878
  • 10
  • 19
Loading