All Projects → DamienCassou → Beginend

DamienCassou / Beginend

Licence: gpl-3.0
Emacs package to redefine M-< and M-> for some modes

Labels

Projects that are alternatives of or similar to Beginend

Flutter.el
Flutter tools for Emacs
Stars: ✭ 72 (-12.2%)
Mutual labels:  emacs
Embrace.el
Add/Change/Delete pairs based on `expand-region', similar to `evil-surround'.
Stars: ✭ 76 (-7.32%)
Mutual labels:  emacs
Corral
Quickly surround text with delimiters in emacs
Stars: ✭ 80 (-2.44%)
Mutual labels:  emacs
Emacs Gif Screencast
[MOVED TO GITLAB] One-frame-per-action GIF recording for optimal quality/size ratio
Stars: ✭ 74 (-9.76%)
Mutual labels:  emacs
Solo Jazz Emacs Theme
An original Emacs theme inspired by the 1992 Solo Jazz cup design.
Stars: ✭ 76 (-7.32%)
Mutual labels:  emacs
Guess Language.el
Emacs minor mode that detects the language you're typing in. Automatically switches spell checker. Supports multiple languages per document.
Stars: ✭ 78 (-4.88%)
Mutual labels:  emacs
Jq Mode
Emacs major mode for editing jq queries.
Stars: ✭ 70 (-14.63%)
Mutual labels:  emacs
Clj Suitable
ClojureScript "IntelliSense" support for JS objects and their properties/methods. Via figwheel and Emacs CIDER.
Stars: ✭ 82 (+0%)
Mutual labels:  emacs
.emacs.d
My emacs configuration
Stars: ✭ 76 (-7.32%)
Mutual labels:  emacs
Awesome Spacemacs
A collection of awesome Spacemacs resources
Stars: ✭ 80 (-2.44%)
Mutual labels:  emacs
Dmacs
Emacs Literate Configuration with borg
Stars: ✭ 74 (-9.76%)
Mutual labels:  emacs
Eziam Theme Emacs
A mostly grayscale theme for Emacs, inspired by Tao and Leuven.
Stars: ✭ 74 (-9.76%)
Mutual labels:  emacs
Hexo.el
Use Hexo in Emacs elegantly
Stars: ✭ 78 (-4.88%)
Mutual labels:  emacs
Spacemacs Content
Content for the book - Clojure Development with Spacemacs
Stars: ✭ 72 (-12.2%)
Mutual labels:  emacs
Ripgrep.el
Emacs front-end for ripgrep, a command line search tool
Stars: ✭ 81 (-1.22%)
Mutual labels:  emacs
Dotfiles
💻 Dotfiles for zsh, vim, emacs, tmux, and bash. Tested on mac os.
Stars: ✭ 70 (-14.63%)
Mutual labels:  emacs
Org Zettelkasten
An opinionated setup for managing large collections of interlinked org files.
Stars: ✭ 77 (-6.1%)
Mutual labels:  emacs
Tide
Tide - TypeScript Interactive Development Environment for Emacs
Stars: ✭ 1,238 (+1409.76%)
Mutual labels:  emacs
Sensible Defaults.el
A simple, modular collection of better Emacs default settings.
Stars: ✭ 81 (-1.22%)
Mutual labels:  emacs
Emacs Sql Indent
Syntax based indentation for SQL files inside GNU Emacs
Stars: ✭ 78 (-4.88%)
Mutual labels:  emacs
  • Beginend #+BEGIN_HTML

    MELPA Stable

      <a href="https://melpa.org/#/beginend">
        <img alt="MELPA" src="https://melpa.org/packages/beginend-badge.svg"/>
      </a>
    
      <a href="https://github.com/DamienCassou/beginend/actions">
        <img alt="pipeline status" src="https://github.com/DamienCassou/beginend/actions/workflows/test.yml/badge.svg" />
      </a>
    </p>
    

    #+END_HTML

** Summary

You might want to read the [[https://emacs.cafe/emacs/package/2017/08/01/beginend.html][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:

| Mode | M-< | M-> | |-----------------------+-------------------------+----------------------------| | LaTeX-mode | =\begin{document}= | =\end{document}= | | bs-mode | first buffer | last buffer | | compilation-mode | first compilation error | last compilation error | | deft-mode | first match | last match | | dired-mode | first file | last file | | elfeed-search-mode | first feed | last feed | | epa-key-list-mode | first key | last key | | ibuffer-mode | first buffer | last buffer | | laTeX-mode | =\begin{document}= | =\end{document}= | | magit-status-mode | first section | last section | | magit-revision-mode | first file | end of buffer | | message-mode | first body line | last line before signature | | notmuch-search-mode | first thread | last thread | | occur-mode | first match | last match | | org-agenda-mode | first agenda item | last agenda item | | org-mode | first heading | end of buffer | | outline-mode | first heading | end of buffer | | prodigy-mode | first service | last service | | prog-mode | after initial comments | before final comments | | recentf-dialog-mode | first most recent file | last most recent file | | rg-mode | first match | last match | | vc-dir-mode | first interesting file | last interesting file |

Finally, beginend does what you expect when your buffer is narrowed.

** Installing

Use [[http://melpa.org/][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:

#+BEGIN_SRC emacs-lisp (beginend-global-mode) #+END_SRC

You can also decide to only activate beginend for some of its supported major modes (e.g., through beginend-dired-mode).

*** init.el example configuration

Vanilla Emacs init.el:

#+BEGIN_SRC emacs-lisp (require 'beginend) (beginend-global-mode) #+END_SRC

Configuration with the popular [[https://github.com/jwiegley/use-package][use-package]] macro:

#+BEGIN_SRC emacs-lisp (use-package beginend :ensure t :demand t :config
(beginend-global-mode)) #+END_SRC

** Cleaning up the modeline

By default, beginend adds the be lighter to the modeline.

You can use [[https://github.com/myrjola/diminish.el][diminish.el]] or [[https://savannah.nongnu.org/projects/delight][delight.el]] to turn this off for every minor mode beginend defines by looping over the beginend-modes variable. Note that you will /also/ need to "turn off the lights" for beginend-global-mode, which is not part of this list.

If you usually diminish all minor modes, I recommend using [[https://melpa.org/#/minions][minions.el]].

In the following snippets, you can replace delight with diminish for similar results.

Adapting the vanilla Emacs init.el:

#+BEGIN_SRC emacs-lisp (require 'beginend) (dolist (mode (cons 'beginend-global-mode (mapcar #'cdr beginend-modes))) (diminish mode)) (beginend-global-mode) #+END_SRC

Adapting the [[https://github.com/jwiegley/use-package][use-package]] macro configuration:

#+BEGIN_SRC emacs-lisp (use-package beginend :ensure t :demand t :config
(dolist (mode (cons 'beginend-global-mode (mapcar #'cdr beginend-modes))) (diminish mode)) (beginend-global-mode)) #+END_SRC

** 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 [[file:media/beginend-dired-mode.gif]] *** Magit status mode [[file:media/beginend-magit-mode.gif]] *** Message mode [[file:media/beginend-message-mode.gif]] *** Programming mode [[file:media/beginend-prog-mode.gif]] *** Occur mode [[file:media/beginend-occur-mode.gif]]

** Contributing

Yes, please do! See [[file:CONTRIBUTING.md][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:

#+BEGIN_SRC emacs-lisp (beginend-define-mode org-agenda-mode (progn (org-agenda-next-item 1)) (progn (org-agenda-previous-item 1))) #+END_SRC

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 [[file:COPYING][COPYING]]. Copyright (c) 2017-2021 [[mailto:[email protected]][Damien Cassou]] and [[mailto:[email protected]][Matus Goljer]].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].