Last active
August 20, 2021 14:13
-
-
Save erikmd/35251ac083e7433f3e780f7eb8856782 to your computer and use it in GitHub Desktop.
Revisions
-
erikmd revised this gist
Aug 20, 2021 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,10 +33,11 @@ Then, add the following elisp snippet in your `~/.emacs`, in order to install: (global-set-key (kbd "C-h f") #'helpful-callable) (global-set-key (kbd "C-h v") #'helpful-variable) (global-set-key (kbd "C-h k") #'helpful-key) ;;; Look up Functions (excludes macros). ;; (global-set-key (kbd "C-h F") #'helpful-function) ;;; Look up Commands (= keybindings). ;; (global-set-key (kbd "C-h K") #'helpful-command) ;;; COMMENTED-OUT as "Info-goto-emacs[-key]-command-node" are more useful. (add-hook 'emacs-lisp-mode-hook #'(lambda () (local-set-key (kbd "C-c C-.") #'helpful-at-point)))) -
erikmd revised this gist
Jul 27, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,7 +70,7 @@ To add a breakpoint on a function, say, `learn-ocaml-mode`: * Type <kbd>C-h f learn-ocaml-mode RET</kbd> then <kbd>TAB</kbd>… and <kbd>RET</kbd> on <code>learn-ocaml<b>.el</b></code>. * On line `(def… learn-ocaml-mode`, type <kbd>C-x SPC</kbd>. * Run the command at stake (in the running example: <kbd>M-x learn-ocaml-mode RET</kbd>). * You're now in `edebug-mode`, try typing <kbd>e</kbd>, <kbd>i</kbd> or <kbd>SPC</kbd> for example (or <kbd>C-h m</kbd> for other keybindings details). ## Tutorials and further documentation -
erikmd revised this gist
Jun 19, 2021 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,6 +48,11 @@ Then, add the following elisp snippet in your `~/.emacs`, in order to install: Finally, run <kbd>M-x package-refresh-contents RET</kbd> and restart Emacs. ## A must-have: [Magit](https://magit.vc) * Assuming you have [Git](https://git-scm.com) (otherwise you have to [install it](https://git-scm.com/download)): * Setup Magit in your `~/.emacs` by folllowing [this Gist](https://gist.github.com/erikmd/82c4b2a50a77c98e8fe6318530c531b7). ## Tips and tricks to debug code To run the debugger automatically: @@ -62,7 +67,7 @@ To cancel, replace `t` with `nil`: To add a breakpoint on a function, say, `learn-ocaml-mode`: * Open the Elisp code directly or indirectly: * Type <kbd>C-h f learn-ocaml-mode RET</kbd> then <kbd>TAB</kbd>… and <kbd>RET</kbd> on <code>learn-ocaml<b>.el</b></code>. * On line `(def… learn-ocaml-mode`, type <kbd>C-x SPC</kbd>. * Run the command at stake (in the running example: <kbd>M-x learn-ocaml-mode RET</kbd>). * You're now in `edebug-mode`, try typing <kbd>SPC</kbd> for example (or <kbd>C-h m</kbd> for other keybindings details). -
erikmd revised this gist
May 11, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,10 +70,10 @@ To add a breakpoint on a function, say, `learn-ocaml-mode`: ## Tutorials and further documentation * First, read this tiny tutorial <https://learnxinyminutes.com/docs/elisp/> (if you never wrote code in Elisp) * Then, read and experiment with at least these three pages from [ergoemacs.org](http://ergoemacs.org): * <http://ergoemacs.org/emacs/elisp_basics.html> * <http://ergoemacs.org/emacs/elisp_editing_basics.html> * <http://ergoemacs.org/emacs/elisp_list.html> * Read the [Appendix D.1 Emacs Lisp Coding Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html). * For the record, further conventions are available in [Appendix D Tips and Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html) & [The Emacs Lisp Style Guide](https://github.com/bbatsov/emacs-lisp-style-guide). * Bookmark the URL of [the official introductory doc](https://www.gnu.org/software/emacs/manual/eintr.html) (270+ pages) and the [GNU Emacs manuals from the official website](https://www.gnu.org/software/emacs/manual/). -
erikmd revised this gist
May 11, 2021 . 1 changed file with 14 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -62,7 +62,18 @@ To cancel, replace `t` with `nil`: To add a breakpoint on a function, say, `learn-ocaml-mode`: * Open the Elisp code directly or indirectly: * Type <kbd>C-h f learn-ocaml-mode RET</kbd> then <kbd>TAB</kbd>… and <kbd>RET</kbd> on `learn-ocaml`**`.el`**. * On line `(def… learn-ocaml-mode`, type <kbd>C-x SPC</kbd>. * Run the command at stake (in the running example: <kbd>M-x learn-ocaml-mode RET</kbd>). * You're now in `edebug-mode`, try typing <kbd>SPC</kbd> for example (or <kbd>C-h m</kbd> for other keybindings details). ## Tutorials and further documentation * First, read this tiny tutorial <https://learnxinyminutes.com/docs/elisp/> (if you never wrote code in Elisp) * The read and experiment with at least these three pages from [ergoemacs.org](http://ergoemacs.org): * <http://ergoemacs.org/emacs/elisp_basics.html> * <http://ergoemacs.org/emacs/elisp_editing_basics.html> * <http://ergoemacs.org/emacs/elisp_list.html> * Read the [Appendix D.1 Emacs Lisp Coding Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html). * For the record, further conventions are available in the [Appendix D Tips and Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html) and in [The Emacs Lisp Style Guide](https://github.com/bbatsov/emacs-lisp-style-guide). * Finally note the URL of [the official introductory documentation](https://www.gnu.org/software/emacs/manual/eintr.html) (just bookmark it; it has 270+ pages) and bookmark the URL of [GNU Emacs manuals from the official website](https://www.gnu.org/software/emacs/manual/). -
erikmd revised this gist
May 11, 2021 . 1 changed file with 25 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,8 @@ Then, add the following elisp snippet in your `~/.emacs`, in order to install: (global-set-key (kbd "C-h C-m") #'discover-my-major) (global-set-key (kbd "C-h M-m") #'discover-my-mode)) ;; Recall we also have the standard keybinding "C-h m". (use-package helpful :ensure t :config @@ -36,10 +38,31 @@ Then, add the following elisp snippet in your `~/.emacs`, in order to install: ;; Look up Commands (= keybindings). (global-set-key (kbd "C-h K") #'helpful-command) (add-hook 'emacs-lisp-mode-hook #'(lambda () (local-set-key (kbd "C-c C-.") #'helpful-at-point)))) ;; Note we can also type "C-h" after a prefix to list its expansions. (use-package edebug-x :ensure t) ``` Finally, run <kbd>M-x package-refresh-contents RET</kbd> and restart Emacs. ## Tips and tricks to debug code To run the debugger automatically: * <kbd>M-: (setq debug-on-error t) RET</kbd> → in case of error * <kbd>M-: (setq debug-on-quit t) RET</kbd> → when typing <kbd>C-g</kbd> (to debug infinite loops or so) To cancel, replace `t` with `nil`: * <kbd>M-: (setq debug-on-quit nil) RET</kbd>. To add a breakpoint on a function, say, `learn-ocaml-mode`: * Open the Elisp code directly or indirectly: * Typing <kbd>C-h f learn-ocaml-mode RET</kbd> then <kbd>TAB</kbd>… and <kbd>RET</kbd> on `learn-ocaml`**`.el`**. * In the line `(def… learn-ocaml-mode`, type <kbd>C-x SPC</kbd>. * Run the command at stake (in the running example: <kbd>M-x learn-ocaml-mode RET</kbd>). * You're now in `edebug-mode`, try typing <kbd>SPC</kbd> for example (or <kbd>C-h m</kbd> for details). -
erikmd revised this gist
May 11, 2021 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,21 +25,21 @@ Then, add the following elisp snippet in your `~/.emacs`, in order to install: (global-set-key (kbd "C-h C-m") #'discover-my-major) (global-set-key (kbd "C-h M-m") #'discover-my-mode)) (use-package helpful :ensure t :config (global-set-key (kbd "C-h f") #'helpful-callable) (global-set-key (kbd "C-h v") #'helpful-variable) (global-set-key (kbd "C-h k") #'helpful-key) ;; Look up Functions (excludes macros). (global-set-key (kbd "C-h F") #'helpful-function) ;; Look up Commands (= keybindings). (global-set-key (kbd "C-h K") #'helpful-command) (add-hook 'emacs-lisp-mode-hook #'(lambda () (local-set-key (kbd "C-c C-d") #'helpful-at-point)))) (use-package edebug-x :ensure t) ``` Finally, run <kbd>M-x package-refresh-contents RET</kbd> and restart Emacs. -
erikmd created this gist
May 11, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ # Resources for elisp dev ## How to improve emacs features discoverability & elisp debugging UX We assume you already configured [MELPA](https://melpa.org/#/) and [use-package](https://github.com/jwiegley/use-package). Otherwise, see e.g. [this `~/.emacs` template](https://github.com/erikmd/tapfa-init.el/blob/master/.emacs). Then, add the following elisp snippet in your `~/.emacs`, in order to install: * [which-key](https://github.com/justbur/emacs-which-key) * [discover-my-major](https://framagit.org/steckerhalter/discover-my-major) * [Helpful](https://github.com/Wilfred/helpful) * [edebug-x](https://github.com/ScottyB/edebug-x) ```elisp (use-package which-key :ensure t :config (which-key-mode)) (use-package discover-my-major :ensure t :config (global-set-key (kbd "C-h C-m") #'discover-my-major) (global-set-key (kbd "C-h M-m") #'discover-my-mode)) (use-package edebug-x :ensure t) (use-package helpful :ensure t :config (add-hook 'emacs-lisp-mode-hook #'(lambda () (local-set-key (kbd "C-c C-d") #'helpful-at-point))) (global-set-key (kbd "C-h f") #'helpful-callable) (global-set-key (kbd "C-h v") #'helpful-variable) (global-set-key (kbd "C-h k") #'helpful-key) ;; Look up Functions (excludes macros). (global-set-key (kbd "C-h F") #'helpful-function) ;; Look up Commands (= keybindings). (global-set-key (kbd "C-h K") #'helpful-command)) ``` Finally, run <kbd>M-x package-refresh-contents RET</kbd> and restart Emacs.