emacs

-
Open in Logseq
    • Paren checking You'd think Emacs would be world-class great at this, but things are surprisingly sucky M-x check-parens (but it sucks) Better: (use-package rainbow-delimiters) M-x rainbow-delimiters-mode
    • Multifile query-replace This should be A LOT easier! https://stackoverflow.com/questions/270930/using-emacs-to-recursively-find-and-replace-in-text-files-not-already-open 1. M-x find-name-dired: you will be prompted for a root directory and a filename pattern. 2. Press t to "toggle mark" for all files found. 3. Press Q for "Query-Replace in Files...": you will be prompted for query/substitution regexps. 4. Proceed as with query-replace-regexp: SPACE to replace and move to next match, n to skip a match, etc. 5. Press C-x s to save buffers. (You can then press y, n or ! to save all at once)
    • Themes Can never remember this one: =M-x customize-themes= gets to a number of useful features. =M-x load-theme=
    • Fonts
    • Using root privedge https://emacsredux.com/blog/2013/04/21/edit-files-as-root/ (actually none of these tricks works very well, unless you are able and willing to login as root) This is on pici laptop, where I guess I don՚t really have full permissions. Phuck, there seems to be no way to read this disk unless I attach it to a different machine...the whole idea was to avoid that...better put my files somewhere saner.
    • Unicode
      • M-x xub-mode (in ~/emacs.d/xub-mode Arrow keys on unicode chars will reveal properties
      • M-x ucs-insert
      • C-x 8 Allows input of some common symbols. C-x C-h for a list. Key translations Starting With C-x 8: key binding


        - C-x 8 SPC   C-x 8 ! ¡ C-x 8 " Prefix Command C-x 8 $ ¤ C-x 8 ' Prefix Command C-x 8 * Prefix Command C-x 8 + ± C-x 8 , Prefix Command C-x 8 - ­ C-x 8 . · C-x 8 / Prefix Command C-x 8 1 Prefix Command C-x 8 3 Prefix Command C-x 8 < « C-x 8 = ¯ C-x 8 > » C-x 8 ? ¿ C-x 8 C © C-x 8 L £ C-x 8 P ¶ C-x 8 R ® C-x 8 S § C-x 8 Y ¥ C-x 8 ^ Prefix Command C-x 8 _ Prefix Command C-x 8 ` Prefix Command C-x 8 c ¢ C-x 8 m µ C-x 8 o ° C-x 8 u µ C-x 8 x × C-x 8 | ¦ C-x 8 ~ Prefix Command C-x 8 ~ SPC ~ C-x 8 ~ A Ã C-x 8 ~ D Ð C-x 8 ~ N Ñ C-x 8 ~ O Õ C-x 8 ~ T Þ C-x 8 ~ a ã C-x 8 ~ d ð C-x 8 ~ n ñ C-x 8 ~ o õ C-x 8 ~ t þ C-x 8 ~ ~ ¬ C-x 8 SPC C-x 8 ` A À C-x 8 ` E È C-x 8 ` I Ì C-x 8 ` O Ò C-x 8 ` U Ù C-x 8 ` a à C-x 8 ` e è C-x 8 ` i ì C-x 8 ` o ò C-x 8 ` u ù C-x 8 a ª C-x 8 o º C-x 8 ^ SPC ^ C-x 8 ^ 1 ¹ C-x 8 ^ 2 ² C-x 8 ^ 3 ³ C-x 8 ^ A Â C-x 8 ^ E Ê C-x 8 ^ I Î C-x 8 ^ O Ô C-x 8 ^ U Û C-x 8 ^ a â C-x 8 ^ e ê C-x 8 ^ i î C-x 8 ^ o ô C-x 8 ^ u û C-x 8 3 / Prefix Command C-x 8 1 / Prefix Command C-x 8 / / ÷ C-x 8 / A Å C-x 8 / E Æ C-x 8 / O Ø C-x 8 / a å C-x 8 / e æ C-x 8 / o ø C-x 8 , , ¸ C-x 8 , C Ç C-x 8 , c ç C-x 8 ' SPC ' C-x 8 ' ' ´ C-x 8 ' A Á C-x 8 ' E É C-x 8 ' I Í C-x 8 ' O Ó C-x 8 ' U Ú C-x 8 ' Y Ý C-x 8 ' a á C-x 8 ' e é C-x 8 ' i í C-x 8 ' o ó C-x 8 ' u ú C-x 8 ' y ý C-x 8 " SPC " C-x 8 " " ¨ C-x 8 " A Ä C-x 8 " E Ë C-x 8 " I Ï C-x 8 " O Ö C-x 8 " U Ü C-x 8 " a ä C-x 8 " e ë C-x 8 " i ï C-x 8 " o ö C-x 8 " s ß C-x 8 " u ü C-x 8 " y ÿ C-x 8 * SPC   C-x 8 * ! ¡ C-x 8 * $ ¤ C-x 8 * + ± C-x 8 * - ­ C-x 8 * . · C-x 8 * < « C-x 8 * = ¯ C-x 8 * > » C-x 8 * ? ¿ C-x 8 * C © C-x 8 * L £ C-x 8 * P ¶ C-x 8 * R ® C-x 8 * S § C-x 8 * Y ¥ C-x 8 * c ¢ C-x 8 m µ C-x 8 o ° C-x 8 u µ C-x 8 x × C-x 8 * | ¦ C-x 8 3 / 4 ¾ C-x 8 1 / 2 ½ C-x 8 1 / 4 ¼ Global Bindings Starting With C-x 8: key binding


        - C-x 8 RET ucs-insert [back]
    • Unnarrow M-x widen (of course)
    • Shell
      • Clear buffer C-c M-o aka comint-clear-buffer (lots of other interesting commands under comint- that might be worth learning)
    • Magit ??? how have I never had a set of magit notes before?
      • WANT a command to stage all untracked files
      • ??? From log, how do you checkout a commit??!?!?!? =b b= in commit buffer, of course!
      • WANT to have it not get fucked up by woke repos (master → main issue) Seems to be a problem for magit-todos Hm it is already set to main: Hide Magit Todos Branch List Merge Base Ref: String: main State : SAVED and set. Commit ref passed to command "git merge-base HEAD". More
      • WANT easy way to browse earlier versions (without checkout) Might not be possble?
      • logs that show actual dates l L ll (l toggles through a variety of styles)
        • WANT change the default
    • Automatically compile a .org file (or other) At top of file: # -*- compile-command: "cd ..;bin/build-guide-pandoc.sh" ; after-save-hook: (recompile) -*-
    • Markdown
      • Org export to Markdown > (require 'ox-md) C-c C-e m m in org mode
    • .rar files in Dired (use-package 'arc-mode) Install https://theunarchiver.com/command-line lsar and unar have to be moved to somewhere on (exec-path) and run once from finder to be given exec permission
    • Org to GDocs (Google Docs) Turn off TOC, numbering, super/subscripts #+OPTIONS: html-postamble:nil num:nil toc:nil ^:nil C-c C-e h o export to HTML and open copy and paste
    • Don't force file newlines (setq require-final-newline nil) Vital for AWS Procfiles because brain damage
    • Access to unix env variables (getenv <name>) Apparently no way to see list, so just use shell
    • Clickable URLs (can't believe this wasn't the default or I hadn't turned it on years ago, well, better late than never) M-x goto-address-mode
    • Open file in fundamental mode M-x find-file-literally a stupid name, I also have find-file-fundamental defined
    • Getting rid of side windew M-x window-toggle-side-windows
    • Use terminal-dependent shell commands (eg gh) M-x term C-c b to switch to a different buffer