0

So I have modified syntax table for moving with C-<left>.

 (defvar my-wacky-syntax-table
      (let ((table (make-syntax-table)))
        (modify-syntax-entry ?\( "w" table)
        (modify-syntax-entry ?\) "w" table)
        table))

(defun Pfedj/my-backward-word()
  (interactive)
  (with-syntax-table my-wacky-syntax-table
          (backward-char)))

(global-set-key (kbd "C-<left>") 'Pfedj/my-backward-word)

It works fine for moving, but S-C-<left> for selecting with control does not work now. How can I fixed it?

Pfedj
  • 308
  • 2
  • 11

1 Answers1

1

You need to say that this command is a navigation command, by replacing your

(interactive)

with

(interactive "^")

C-h o interactive RET explains that:

[...]
If the string begins with ^ and shift-select-mode is non-nil,
Emacs first calls the function handle-shift-selection.
[...]

Stefan
  • 26,154
  • 3
  • 46
  • 84