Skip to content

Instantly share code, notes, and snippets.

@riicchhaarrd
Created March 26, 2022 18:10
Show Gist options
  • Select an option

  • Save riicchhaarrd/d3ec3c36d5d4329a034b7a44a90a214a to your computer and use it in GitHub Desktop.

Select an option

Save riicchhaarrd/d3ec3c36d5d4329a034b7a44a90a214a to your computer and use it in GitHub Desktop.
emacs CTRL-A select all and cursor keys
(defun custom-select-all ()
(interactive)
;; (message "test %s" (key-description (string (read-event nil nil 2))))
(mark-whole-buffer)
(setq tmp (read-event nil nil 0.3))
(if tmp
(progn
(when (string= "left" tmp)
(deactivate-mark)
)
(when (string= "right" tmp)
(goto-char (region-end))
(deactivate-mark)
)
(when (string= "down" tmp)
(deactivate-mark)
(next-line)
)
(when (string= "up" tmp)
(deactivate-mark)
(previous-line)
)
;; (message "event %s" tmp)
)
)
)
(global-set-key [(control a)] 'custom-select-all)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment