I had started to use EMACS occasionally with version 20.7. Since 2016-11 I am using EMACS 25.1 and have been using it regularely. This folder contains documents where I share information about
The EMACS documentation, both built into EMACS and available online, is very complete and detailed. However I found myself jotting down things while I learned. I share these below. These might be useful to people who have similar requirements.
I appreciate EMACS supports well classical terminal operation by providing "windows" functionality. However I am using EMACS from a MS Windows desktop and I am used to working with native windows there, which are called "frames" in EMACS.
I have customised (download my init.el) EMACS
such that it uses "frames" by default (for example when it opens a
*help* window for you).
C-x C-+ increase font site, repeat
C-+ for more. Only affects current buffer
C-x C-- decrease font size
C-x C-0 go back to standard font size
C-x r SPC r saves to cursor position in "register"
r (one letter)
C-x r j r jumps back
Registers are volatile. Bookmarks are being saved.
In EMACS a paragraph is terminated by an empty line.
M-q "fill paragraph" aligns every line in a paragraph, breaking
lines that are too long. The variable
fill-column governs how long
the lines are, the length defaults to 70 characters (more precisely:
default right margin: 70).
However, to set the variable
non-nil did not have the effect, to align automatically
assembly language comments.
shows all lines in a buffer that contain the search string. They are shown in a separate frame/window, with hyperlinks you can follow/click. However, this works for one buffer only.
M-x occur-mode does, I still need to understand.
Often I need a serial terminal app. to connect to a microcontroller via RS232 for debug purposes. As I use Windows, there is no out-of-the box app. ever since Hyperterm was not any more delivered with Windows. Fortunately such functionality is built into EMACS and can be activated via
If you have a file open in a buffer (which sets the current directory) and then do
then EMACS tries to open a so called TAGS file in that directory. If the TAGS file is not in the same directory, then you could supply a relative or absolute path. Then EMACS asks you a search pattern.
looks for the next hit until all files have been processed.
does a query and replace.
To change the TAGS file that is being used, use
The current directory can be changed in
Menu, Files, Open Directory... .
The path separator seems to be
/ even under Windows.
To use the EMACS "TAGS" feature, you first got to generate a TAGS file specific to the project you are working. One possible procedure:
The script consists of two lines:
TYPE flist.txt | C:\Users\xyz\OneDrive\myPrograms\emacs-25.1\bin\etags.exe - PAUSE
This will generate the file "TAGS" in the same directory. Replace the path above with the path where you installed EMACS (see my approach under Windows).
By default search regexp treats upper and lower case the same. This is
set by the variable
In older EMACS versions, e.g. 20.7,
tags-case-fold-search was not
case-fold-search, but it seemed to have the same
To enter dired-mode do
C-x d directory <RET>
C-u C-SPCbrings the cursor back
Menu Regexp, Mark...allows to mark files by a regexp e.g.
\.vmc$selects file extension "vmc"
Menu Operate, Search Files...(dired-do-search) allows to search for content.
! find "redetho" *
When the files are all in the same directory or in not too many sub-directories:
\.ext$, which is a regexp to search for the file extension "ext"
Operate... > Query Replace in files
^moves up one directory
amoves down into a directory without opening a new buffer (in contrast to "f" oder RET)
Rmoves marked files into a directory
dired-listing-switches to "-Al")
-lalways has to be present.
On Windows, Dired is using a Lisp emulation of
ls. My preferences:
(quote ("%Y-%m-%d %H:%M:%S" "%Y-%m-%d %H:%M:%S")))
The following examples are source code changes. They also work with
i.e. to upper case
; one or twice or three-times according to hierarchy level.
M-j new line in a comment
M-; insert or re-align comment
I should also try
C-x RET f
C-x SPC then size the rectangle using the cursor keys, then
Open the file and then indent it by indenting the entire region:
M-x find-file /path/to/file RET
C-x h (
VC is enabled automatically whenever you visit a file governed by a
version control system. To disable VC entirely, set the customisable
vc-handled-backends to nil (see Customizing VC).
Change language using
M-x ispell-change-dictionary (
M-x isp-c-d will also do), then e.g. "deutsch"
If EMACS heuristics fails, which tries to guess a file's encoding, do:
C-x RET r or
See (info "(emacs) Specify Coding") for details.
Use the search regexp
The cursor will be set past the found character.
M-: (load user-init-file)
Either put in the
"Hack EMACS" Rick Dillon on Youtube
"Publishing a book using org-mode" from Lakshmi Narasimhan https://www.craftofcoding.com/publishing-book-using-org-mode/
Emacs org-mode examples and cookbook http://ehneilsen.net/notebook/orgExamples/org-examples.html