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?

1 Answer 1

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.
[...]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.