Integrate the built-in view-mode
with Meow
#368
Replies: 4 comments 5 replies
-
All integrations located in this file: https://github.com/meow-edit/meow/blob/master/meow-shims.el. |
Beta Was this translation helpful? Give feedback.
-
What about using |
Beta Was this translation helpful? Give feedback.
-
In case anyone's interested, here's what I came up with. It puts the main After entering this faux "view-mode", the bindings will keep working for moving around the buffer until you press a key that isn't listed. ;; In order for the bindings in this prefix to remain active until you
;; press ESC (or some other key not bound under the prefix), you must
;; have `repeat-mode' enabled. Note that `repeat-mode' is only
;; available in Emacs 28+.
(when (version< "28" emacs-version)
(repeat-mode 1))
(defvar my-view-prefix)
(define-prefix-command 'my-view-prefix)
(define-key mode-specific-map (kbd "v") 'my-view-prefix)
(defvar my-view-rep-map (make-sparse-keymap))
(dolist (kb '(("@" . View-back-to-mark)
("%" . View-goto-percent)
("G" . View-goto-line-last)
("g" . View-goto-line)
("F" . View-revert-buffer-scroll-page-forward)
("k" . View-scroll-line-backward)
("j" . View-scroll-line-forward)
("u" . View-scroll-half-page-backward)
("d" . View-scroll-half-page-forward)
("z" . View-scroll-page-forward-set-page-size)
("w" . View-scroll-page-backward-set-page-size)
("b" . View-scroll-page-backward)
("f" . View-scroll-page-forward)
("o" . View-scroll-to-buffer-end)))
(define-key my-view-prefix (kbd (car kb)) (cdr kb))
(define-key my-view-rep-map (kbd (car kb)) (cdr kb))
(put (cdr kb) 'repeat-map my-view-rep-map)
(autoload (cdr kb) "view" nil 'interactive)) |
Beta Was this translation helpful? Give feedback.
-
I was ruminating on this issue a lot yesterday, and then I saw #543. This A fix for the That said, I know that changing the behavior of |
Beta Was this translation helpful? Give feedback.
-
Sometimes I like to use
view-mode
, which provides a great environment for reviewing a file without accidentally making any changes to it. (Though honestly, my primary use is for the SPC and DEL bindings for page-up and page-down.)In general, it coexists ok with Meow, but it is a bit cumbersome.
I'd like to use the
meow-keypad
space-bar leader to enterview-mode
. However, after startingview-mode
, I need to switch tomeow-insert-mode
, because otherwise the space-bar continues to bring up themeow-leader
map.So I'm wondering if there are any suggestions for configuring
view-mode
to work more seamlessly with Meow, so that I can enterview-mode
almost as if it were its own Meow-mode, without having to separately switch tomeow-insert-mode
when startingview-mode
and then back tomeow-normal-mode
when exitingview-mode
. Ideally, it would remember the previous Meow-mode when enteringview-mode
and return to it when exiting.Also, this seems (to me) like something that would fit with Meow's philosophy of cooperating with existing Emacs features and conventions. So would it be worth doing a pull-request if we can think of the right way to do it?
Beta Was this translation helpful? Give feedback.
All reactions