The filtering system is designed after ibuffer: every dired
buffer has associated "filter stack" where user can push
filters (predicates). These filters are by default
logically "anded", meaning, only the files satsifying all the
predicates are shown.
Some filters take additional input from the user such as part of
name, regexp or extension, other filters only use a predefined
predicate such as "show only directories" or "omit dot files".
In addition, there are two "metafilters", the or' filter and the
not' filter. These take other filters as arguments and change
their logical interpretation. The or' filter takes the two filters on top of the stack, pops them and pushes a filter that matches files satisfying one or the other (or both) filters. The
not' filter pops the top filter and pushes its logical negation.
To enable or disable the filters toggle minor mode
`dired-filter-mode'. Toggling this mode preserves the filter
stack, so you can use it to quickly hide/unhide files filtered by
the current filter setup.
All the provided interactive functions are available from
dired-filter-map'. You can customize
dired-filter-prefix' to set
a prefix for this map or bind it manually to a prefix of your
choice using:
(define-key dired-mode-map (kbd "some-key") dired-filter-map)
The bindings follow a convention where the filters are mapped on
lower-case letters or punctuation, operators are mapped on symbols
(such as !, |, * etc.) and group commands are mapped on upper-case
letters. The exception to this is p' which is bound to
dired-filter-pop', which is a very common operation and warrants a
quick binding.
In addition to filtering, you can also use the same predicates to
only mark files without removing the rest. All the filtering
functions of the form dired-filter-by-*' have their marking counterpart
dired-filter-mark-by-*'. These are available from
dired-filter-mark-map'. You can customize
dired-filter-mark-prefix' a prefix for this map or bind it
manually to a prefix of your choice using:
(define-key dired-mode-map (kbd "some-key") dired-filter-mark-map)
The marking operations are not placed on stack, instead, the marks
are immediately updated by "OR"-ing them together. To remove marks
that would otherwise be selected by a filter, use prefix argument
(usually bound to C-u'). To logically negate the meaning of the filter, you can call the function with a double prefix argument (usually
C-u' `C-u')
You can use saved filters to mark files by calling
`dired-filter-mark-by-saved-filters'.
Forge allows you to work with Git forges, such as Github and Gitlab, from the comfort of Magit and the rest of Emacs.
Forge fetches issues, pull-requests and other data using the forge’s API and stores that in a local database. Additionally it fetches the pull-request references using Git. Forge implements various features that use this data but the database and pull-request refs can also be used by third-party packages.
ρEmacs is a preconfigured distribution of GNU Emacs editor for Microsoft Windows. It offers nearly GNU/Linux Emacs experience in Windows with minimum configuration efforts. A set of additional GNU command-line and development tools is available through the network installer.
(flycheck-define-checker perl-project-libs
"A perl syntax checker."
:command ("perl"
"-MProject::Libs lib_dirs => [qw(local/lib/perl5)]"
"-wc"
source-inplace)
:error-patterns ((error line-start
(minimal-match (message))
" at " (file-name) " line " line
(or "." (and ", " (zero-or-more not-newline)))
line-end))
:modes (cperl-mode))
(add-hook 'cperl-mode-hook
(lambda ()
(flycheck-mode t)
(setq flycheck-checker 'perl-project-libs)))
'(flycheck-perl-include-path
(quote
("your path to your perl libraries")))
'(flycheck-perl-executable "path to your perl executable")
The doom-modeline
was designed for minimalism, and offers:
anzu
, iedit
, multiple-cursors
, symbol-overlay
,evil-search
and evil-substitute
)python
, ruby
, go
, etc.) in the major-modedoom-modeline-height
)minions
flymake
/flycheck
eyebrowse
persp-mode
ace-window
, winum
and window-numbering
evil
stategod
stateryo-modal
statexah-fly-keys
statelsp-mode
or eglot
mu4e-alert
circe
nyan-mode
fancy-battery
projectile
and project
Use magit-ediff or 'e' on an unmerged item to resolve merge conflicts with ediff. Magit will set up an ediff with three buffers A, B and C. A and B are the original (conflicting) files, and C is the conflicted merge.
These notes summarize some of my discoveries (re-)learning GNU Emacs. Since these are my personal notes, it may help to briefly describe my background. I used Emacs on Unix from somewhere around 1990 until 1995. Then in 1995 I began using Windows as my primary operating system and stopped using Emacs. In 2010 I decided to give Emacs on Windows another try. I may not mention some basic things just because I remember them from my initial experience.
Try query-replace
enter
[ space ]
enter
M-j
enter
!
enter
The built-in js-mode in Emacs does not provide many features for working with js framework beside js editing and syntax highlighting. The tips in this post will help you transform your Emacs into a powerful Javascript IDE.
Emacs support library for PDF files.
PDF Tools is, among other things, a replacement of DocView for PDF files. The key difference is, that pages are not pre-rendered by e.g. ghostscript and stored in the file-system, but rather created on-demand and stored in memory.
This rendering is performed by a special library named, for whatever reason, poppler, running inside a server program. This program is called epdfinfo and its job is it to successively read requests from Emacs and produce the proper results, i.e. the PNG image of a PDF page.
Actually, displaying PDF files is just one part of PDF Tools. Since poppler can provide us with all kinds of information about a document and is also able to modify it, there is a lot more we can do with it.
CharMap is unicode table viewer for Emacs. With CharMap you can see the unicode table based on The Unicode Standard 6.2.
;;; It is the opposite of fill-paragraph
(defun unfill-paragraph ()
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
And to bind it to a key:
;; Handy key definition
(define-key global-map "\M-Q" 'unfill-paragraph)
Very useful for stuff like whitespace-mode
or auto-fill-mode
:
(hook 'c-mode-hook (lambda () (xxxxxxxx-mode -1)))
(add-hook 'js-mode-hook (lambda () (xxxxxxxx-mode -1)))
A per-user emacs daemon service for systemd
Use the desktop library to save the state of Emacs from one session to another. Once you save the Emacs desktop—the buffers, their file names, major modes, buffer positions, and so on—then subsequent Emacs sessions reload the saved desktop. By default, the desktop also tries to save the frame and window configuration. To disable this, set desktop-restore-frames to nil. (See that variable’s documentation for some related options that you can customize to fine-tune this behavior.)
A dark theme for Atom, Alfred, Emacs, iTerm, Mintty, Slack, Sequel Pro, Sublime Text, Textmate, Terminal.app, Vim, Visual Studio Code, Xcode, and Zsh
Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs, intended as replacement for the older Flymake extension which is part of GNU Emacs. For a detailed comparison to Flymake see Flycheck versus Flymake.
It uses various syntax checking and linting tools to automatically check the contents of buffers while you type, and reports warnings and errors directly in the buffer, or in an optional error list.
Out of the box Flycheck supports over 40 different programming languages with more than 80 different syntax checking tools, and comes with a simple interface to define new syntax checkers.
Many 3rd party extensions provide new syntax checkers and other features like alternative error displays or mode line indicators.
Magit is an interface to the version control system Git, implemented as an Emacs package. Magit aspires to be a complete Git porcelain. While we cannot (yet) claim that Magit wraps and improves upon each and every Git command, it is complete enough to allow even experienced Git users to perform almost all of their daily version control tasks directly from within Emacs. While many fine Git clients exist, only Magit and Git itself deserve to be called porcelains.
web-beautify is a formatting package of HTML, CSS and JavaScript/JSON for Emacs. It uses the command-line/node.js javascript formatter from http://jsbeautifier.org/ to format whole html, css, js or json files, or region.
You absolutely need to try installing multiple cursors:
https://github.com/magnars/multiple-cursors.el
It's in marmalade and melpa so just:
<pre>
M-x package-install multiple-cursors
</pre>
This document describes a set of features that can interactively do things with buffers and files. All the features are described here in detail.
The Ido package can let you switch between buffers and visit files and directories with a minimum of keystrokes. It is a superset of Iswitchb, the interactive buffer switching package by Stephen Eglen.
Emacs’s built-in ispell package handles spell-checking and correction, while flyspell provides on-the-fly checking and highlighting of misspellings.
One way to reduce repetitive-strain injury from Emacs is to avoid pressing two keys simultaneously with the same hand. That is, avoid using modifier keys. For C-KEY, use one hand for KEY and the other for Ctrl. For M-KEY, do similarly as for C-KEY, or press and release Esc and then press KEY. And of course, take advantage of the automatic indenting and other features of Emacs that save keystrokes.
Most of the GNU Emacs integrated environment is written in the programming language called Emacs Lisp. The code written in this programming language is the software—the sets of instructions—that tell the computer what to do when you give it commands. Emacs is designed so that you can write new code in Emacs Lisp and easily install it as an extension to the editor.
(GNU Emacs is sometimes called an “extensible editor”, but it does much more than provide editing capabilities. It is better to refer to Emacs as an “extensible computing environment”. However, that phrase is quite a mouthful. It is easier to refer to Emacs simply as an editor. Moreover, everything you do in Emacs—find the Mayan date and phases of the moon, simplify polynomials, debug code, manage files, read letters, write books—all these activities are kinds of editing in the most general sense of the word.)
This page contains snippets of code that demonstrate basic EmacsLisp programming operations in the spirit of the O’Reilly cookbook series of books. For every task addressed, a worked-out solution is presented as a short, focused, directly usable piece of code.
All this stuff can be found elsewhere, but it is scattered about in libraries, manuals, etc. It would be helpful to have here in one spot.
These recipes should be pastable into the scratch buffer so that users can hit ‘C-j’ and evaluate them step by step.
Why Study Emacs Lisp?
Although Emacs Lisp is usually thought of in association only with Emacs, it is a full computer programming language. You can use Emacs Lisp as you would any other programming language.
Perhaps you want to understand programming; perhaps you want to extend Emacs; or perhaps you want to become a programmer. This introduction to Emacs Lisp is designed to get you started: to guide you in learning the fundamentals of programming, and more importantly, to show you how you can teach yourself to go further.
This page contains snippets of code that demonstrate basic EmacsLisp programming operations in the spirit of the O’Reilly cookbook series of books. For every task addressed, a worked-out solution is presented as a short, focused, directly usable piece of code.
All this stuff can be found elsewhere, but it is scattered about in libraries, manuals, etc. It would be helpful to have here in one spot.
These recipes should be pastable into the scratch buffer so that users can hit ‘C-j’ and evaluate them step by step.
There’s going to be some overlap with CategoryCode, obviously. Just link to more elaborate pages when appropriate. Should this page grow too large, we’ll split it up later.
Emacs makes frequent use of the Control key. On a conventional keyboard, the Control Key is at the lower left corner of the keyboard, usually not very large and is pressed by the pinky finger. For those who use emacs all day, this will result in Repetitive Strain Injury. This page lists some tips on avoiding this pinky problem.
All i wanted, is to make Space and Tab and Newline chars visible.
However, the emacs whitespace-mode does much more than that. It is designed for tech geeking control freaks to tune every aspect of white space in his source code. The mode is filled with bells and whistles. It distinguishes tabs mixed with spaces, EOLs mixed with spaces, EOLs at beginning of file, EOLs at end of file, run on spaces at end of line, lines that has nothing to do with white spaces but is simply longer than 80 chars, etc. Each of these is rendered with different foreground, background, colors, so that they cannot possibly escape the notices of control freaks.
This page tells you how to setup emacs's whitespace-mode
(in emacs 23 or later), and how to use it.
whitespace-mode
renders {spaces, tabs, newlines} characters with a visible glyph. This feature is useful for working with “tab separated values” (TSV) that's commonly used format for importing/exporting address books or spreadsheets. It's also useful in whitespace-significant languages such as Python.
To use it, call:
whitespace-mode
→ toggle on/off, for current file.global-whitespace-mode
→ toggle on/off globally for current emacs session.There is also whitespace-newline-mode
and global-whitespace-newline-mode
. They only show newline chars.
Emacs has a spell checking feature (flyspell-mode), that check spelling errors while you type, much like all other modern editors, word processors, email programs, or text box in browsers. However, emacs's spell checking feature is much worse than the spell checker in browsers or any commercial editor.
Why another e-mail client?
I (the author) spend a lot of time dealing with e-mail, both professionally and privately. Having an efficient e-mail client is essential. Since none of the existing ones worked the way I wanted, I created my own.
emacs is an integral part of my workflow, so it made a lot of sense to use it for e-mail as well. And as I had already written an e-mail search engine (mu), it seemed only logical to use that as a basis.
(with-eval-after-load 'company
(define-key company-active-map (kbd "M-n") nil)
(define-key company-active-map (kbd "M-p") nil)
(define-key company-active-map (kbd "C-n") #'company-select-next)
(define-key company-active-map (kbd "C-p") #'company-select-previous))
Smex is a M-x enhancement for Emacs. Built on top of Ido, it provides a convenient interface to your recently and most frequently used commands. And to all the other commands, too.
Company is a text completion framework for Emacs. The name stands for "complete anything". It uses pluggable back-ends and front-ends to retrieve and display completion candidates.
This mode teaches you to use the proper Emacs movement keys in a
rather harsh manner.
No-easy-keys disables arrow, end, home and delete keys, as well as
their control and meta prefixes. When using any of these keys, you
instead get a message informing you of the proper Emacs shortcut
you should use instead (e.g. pressing down informs you to use C-n).
A fat and quality reference for Emacs, keyboarding and Elisp.
You can customize nXML mode so that / automatically inserts the rest of the end-tag when it occurs after ‘<’, by doing
M-x customize-variable RET nxml-slash-auto-complete-flag RET
and then following the instructions in the displayed buffer.
A very useful list off all the Emacs functions and variables accessible from the web or you mobile. It is also possible to access to this from Emacs itself by invoking describe-function
or describe-variable
.
So while in a dired buffer
C-u s
you can now change switches used by ls. Add h do get a human readable file sizes
You can add other switches too, for example I changed it to -alsh and it now sorts by file size
Also see cutomize-mode and edit "Dired Listing Switches" to -alh
How to achieve to remove rectangles on a region in the same way than in Sublime Text using emacs...
Here's a example of how to use it.
..............
..1xxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxxx..oooo..
..xxx2..oooo..
..............
* Put your cursor before the “1”
* call set-mark-command 【Ctrl+Space】
* move cursor to end of “2”
* call kill-rectangle (Ctrl+x r k) or replace-rectangle (Ctrl+x r t)
Speedbar is an Emacs Lisp program which allows you to create a special skinny frame with a specialized directory listing in it. This listing will have both directories and filtered files in it. You can then load files into your emacs frame, or expand the files to display all the tags that are in them and jump to those tags. You can also expand multiple directories into your speedbar frame.
Using Shift with the mouse is considered a "power click" which will ignore any cached data that might be related to the navigation desired. When loading a file, a power click will pull that file into a new frame.
For PC users with two button mice, a button1 double click acts as the mouse-2 click most emacs users are familiar with.
Additional keyboard commands are available for friendly file IO functions such as Rename/Copy/Delete, Loading lisp files, and compiling lisp files.
speedbar-multi-2.jpg
Different Modes for Speedbar
Speedbar is more than just file browsing, however. Speedbar is a generalized browser. Speedbar supports:
Très pratique function à rajouter dans ton .emacs pour éditer des fichiers nécessitant des droits de super-utilisateur depuis un buffer Dired. Il suffit ensuite de demander M-x sudo