Emacs

Emacs

January 24, 2024 | seedling, cs

Modes #

web-mode #

For HTML, CSS and JS editing and more

  • default query replace will not work `replace-match-maybe-edit: Match data clobbered by buffer modification hooks` use vr/replace in this mode.

follow-mode #

Documents can be viewed by splitting the frame vertically, document in the second frame follows the first continuously.

Debugging #

Workflows #

Search or find files #

in project (git or hg) use projectile to search for files #

  1. select project
  2. search the file

in a directory #

  1. in a directory use helm-find to search files recursively
  2. open file with default program select and hitting “Enter” will open file using external program configured in `openfile` configs
  3. non-default program using “shell-command”
    • C-SPC ! ! “google-<TAB> fileName <TAB>” <ENTER>

Hiding Details or Outline buffer in Emacs #

Evil folding #

z

Imenu #

Imenu is a feature that lets users select a definition or section in the buffer, from a menu which lists all of them, to go directly to that location in the buffer.

helm-imenu #

C-Space h i

helm-semantic #

C-Space h l

lsp imenu #

C-Space l l

Searching and Finding in Emacs #

Bookmarks #

Set important directory (or files) locations to get their fast.

helm-bookmarks #

prefix command C-SPC b

Find Files #

In Directory #

Search all files recursively inside a directory

  • helm-find-file

    C-SPC h f

In a projectile Project #

  • helm-projectile-find-file

Open Files #

  • Open in Emacs Text files
  • Open from Emacs
    • using “openwith” package
  • Open in “Finder” open-in-finder

Search words #

or lines containing the words using some time of grep search.

grep #

  • Inside a projectile project

    • helm-rg

      C-SPC h / C-SPC h r

    • helm-ag

      C-SPC h s s

  • Inside Directory

    • rgrep
    • find-dired-grep

NotDeft #

Help in Emacs #

Native #

C-h Feature Discovery and Documentation Youtube

shortdoc-display-group doc summary of functions in group. ref

info #

m-x: info c-h r info pages list all the manuals or documentation available in emacs

help #

c-h

function #

search function to describe it to learn more c-h f

variable #

c-h v

describe key binding #

c-h k can be used to know how keys should be used in configs.

describe mode #

c-h m

describe binding #

c-h b C-SPC h m helm binding

Where is (to which key a function is bound to) #

c-h w

See Example #

tldr #

C-SPC a t

Linux #

shift+k : woman

Browser #

Open browser C-SPC b

Completions #

C-SPC c

Documentation #

C-SPC d

Writing in Emacs #

Grammar #

Word #

C-SPC c s : spelling complete or check C-SPC c d : dictionary

Sentence #

C-SPC c r r : power thesaurus checking grammar error -, check.

Editing #

Replace #

Delete #

Notes #

Org Roam #

Math in Emacs #

Math prefix command: C-SPC i

Literate Programming in Emacs #

Literate Programming in Org Mode

Agenda in Emacs #

Passwords in Emacs #

password-store package

Evernote Web Link

Emacs on macOS #

From this Reddit’s discussion , emacs-mac - I used this one - is the best one.

Installing emacs-macosx #

I downloaded the dmg file and used this emacs. emacsclient worked with some extra configurations. daemon mode was because of the server-socket-dir location, after removing this it worked; But since it was not working for this reason, I moved on to use “emacs-plus”

Installing with Homebrew #

Default #

brew install emacs

emacs-plus #

https://github.com/d12frosted/homebrew-emacs-plus

# emacs 28
brew install emacs-plus@28 --with-no-frame-refocus --with-mailutils --with-debug --with-imagemagick --with-native-comp
# emaccs 29

brew install emacs-plus@29 --with-no-frame-refocus --with-mailutils --with-debug --with-imagemagick --with-native-comp
  • <2023-07-13 Thu>

    I installed with `–with-native-comp` but faced few problems with packages, used following command to install

    brew install emacs-plus@28 --with-no-frame-refocus --with-mailutils --with-debug --with-imagemagick
    

Installing with MacPorts #

Best suited to use generic UNIX based software on macOS, not necessarily optimized for macOS. sudo port install emacs

Keymaps #


Go to random page

Previous Next