GitHub - DamienCassou/beginend: Emacs package to redefine M-< and M-> for...
source link: https://github.com/DamienCassou/beginend
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.org
Beginend
Summary
You might want to read the introductory blog post.
Redefine M-<
and M->
(or any key bound to beginning-of-buffer
or
end-of-buffer
) for some modes so that point moves to meaningful
locations. The real beginning and end of buffers (i.e., point-min
and point-max
) are still accessible by pressing the same key again.
In particular, these modes are supported:
ModeM-<
M->
dired-modefirst filelast filemagit-status-modefirst sectionlast sectionmessage-modefirst body linelast line before signatureprog-modeafter initial commentsbefore final commentsoccur-modefirst matchlast matchibuffer-modefirst bufferlast bufferbs-modefirst bufferlast buffervc-dir-modefirst interesting filelast interesting filerecentf-dialog-modefirst most recent filelast most recent fileorg-agenda-modefirst agenda itemlast agenda itemcompilation-modefirst compilation errorlast compilation errornotmuch-search-modefirst threadlast threadelfeed-modefirst feedlast feedprodigy-modefirst servicelast servicedeft-modefirst matchlast matchFinally, beginend does what you expect when your buffer is narrowed.
Installing
Use melpa.
You can activate beginend for all modes it supports by customizing the
variable beginend-global-mode
(M-x customize-variable RET
beginend-global-mode RET
) or by adding this line to your
configuration file:
(beginend-global-mode)
You can also decide to only activate beginend for some of its
supported major modes (e.g., through beginend-dired-mode
).
Using
At this point, newly opened supported buffers will get improved
versions of M-<
and M->
(or any key bound to beginning-of-buffer
or end-of-buffer
).
The following shows some screencasts. In each screencast, the cursor is moved to the meaningful beginning and end and to the real beginning and end.
Dired mode
Magit status mode
Message mode
Programming mode
Occur mode
Contributing
Yes, please do! See CONTRIBUTING for guidelines.
Adding new modes is a matter of a few lines of code. For example,
these five lines (already included) define the behavior of beginend in
org-agenda-mode
:
(beginend-define-mode org-agenda-mode (progn (org-agenda-next-item 1)) (progn (org-agenda-previous-item 1)))
The first progn
is responsible for moving point to the meaningful
beginning of buffer. Before being executed, point is at the real
beginning of the buffer (i.e., point-min
). The expression
(org-agenda-next-item 1)
thus moves to the first agenda item.
Similarly, the second progn
is responsible for moving point to the
meaningful end of buffer starting from real end (i.e., point-max
).
License
See COPYING. Copyright (c) 2017 Damien Cassou and Matus Goljer.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK