Fixed the devdocs with a pretty-hydra
Much more useful.
This commit is contained in:
		
							parent
							
								
									7eb35e2eb2
								
							
						
					
					
						commit
						bb21ab656e
					
				
					 1 changed files with 24 additions and 26 deletions
				
			
		|  | @ -157,42 +157,40 @@ Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Spe | |||
|       "e t" '("toggle flycheck"  . flycheck-mode))) | ||||
| #+end_src | ||||
| ** Documentation | ||||
| I’m interested in using [[https://devdocs.io/][devdocs]] instead, which is similar, but keeps it all /inside/ Emacs (and works on my Linux system). Two Emacs projects compete for this position. The Emacs [[https://github.com/astoff/devdocs.el][devdocs]] project is active, and seems to work well. Its advantage is a special mode for moving around the documentation. | ||||
| Used to use the Dash project for searching documentation associated with a programming language, but that hardly worked on my Linux systems. | ||||
| 
 | ||||
| I’m interested in using [[https://devdocs.io/][devdocs.io]] instead, which is similar, but displays it in simple HTML. This can keep it all /inside/ Emacs. Two Emacs projects compete for this position. The Emacs [[https://github.com/astoff/devdocs.el][devdocs]] project is active, and seems to work well. Its advantage is a special mode for moving around the documentation. | ||||
| 
 | ||||
| #+begin_src emacs-lisp | ||||
|   (use-package devdocs | ||||
|     :general (:states 'normal | ||||
|                       "gD" '("devdocs" . devdocs-lookup)) | ||||
| 
 | ||||
|                       "gD" '("devdocs" . ha-devdocs-major-mode)) | ||||
|     :config | ||||
|     (major-mode-hydra-define emacs-lisp-mode nil | ||||
|     (pretty-hydra-define hydra-devdocs (:color blue) | ||||
|       ("Dev Docs" | ||||
|        (("e" eldoc "eldoc") | ||||
|         ("d" devdocs-lookup "open") | ||||
|         ("p" devdocs-peruse "peruse") | ||||
|         ("i" devdocs-install "install") | ||||
|        (("d" ha-devdocs-major-mode "open") | ||||
|         ("p" devdocs-peruse "peruse")) | ||||
|        "Packages" | ||||
|        (("i" devdocs-install "install") | ||||
|         ("u" devdocs-update-all "update") | ||||
|         ("x" devdocs-delete "uninstall") | ||||
|         ("s" devdocs-search "search"))))) | ||||
|         ("x" devdocs-delete "uninstall"))))) | ||||
| #+end_src | ||||
| 
 | ||||
| The [[https://github.com/blahgeek/emacs-devdocs-browser][devdocs-browser]] project acts similar, but with slightly different command names. Its advantage is that it allows for downloading docs and having it available offline, in fact, you can’t search for a function, until you download its pack. This is slightly faster because of this. | ||||
| #+begin_src emacs-lisp :tangle no | ||||
|   (use-package devdocs-browser | ||||
|     :general (:states 'normal "gD" 'devdocs-browser-open) | ||||
| The =devdocs-lookup= command attempts to guess which documentation it should display based on the mode, but if I’m editing YAML files, I actually want to pull up the Ansible documentation, and probably the Jinja ones too. | ||||
| 
 | ||||
|     :config | ||||
|     (ha-local-leader :keymaps 'prog-mode-map | ||||
|       "d"  '(:ignore t :which-key "docs") | ||||
|       "d d" '("open" . devdocs-browser-open) | ||||
|       "d D" '("open in" . devdocs-browser-open-in) | ||||
|       "d l" '("list" . devdocs-browser-list-docs) | ||||
|       "d u" '("update" . devdocs-browser-update-docs) | ||||
|       "d i" '("install" . devdocs-browser-install-doc) | ||||
|       "d x" '("uninstall" . devdocs-browser-uninstall-doc) | ||||
|       "d U" '("upgrade" . devdocs-browser-upgrade-doc) | ||||
|       "d o" '("download" . devdocs-browser-download-offline-data) | ||||
|       "d O" '("remove download" . devdocs-browser-remove-offline-data))) | ||||
| #+begin_src emacs-lisp | ||||
|   (defun ha-devdocs-major-mode () | ||||
|     "My mapping of major mode to Devdocs slug." | ||||
|     (interactive) | ||||
|     (let ((devdocs-current-docs | ||||
|            (cl-case major-mode | ||||
|              ('emacs-lisp-mode '("elisp")) | ||||
|              ('python-mode     '("python~.3.11")) | ||||
|              ('yaml-ts-mode    '("ansible" "jinja-2.11"))))) | ||||
|       (devdocs-lookup nil))) | ||||
| #+end_src | ||||
| 
 | ||||
| 
 | ||||
| ** Code Folding | ||||
| While Emacs has options for viewing and moving around code, sometimes, we could /collapse/ all functions, and then start to expand them one at a time. For this, we could enable the built-in [[https://www.emacswiki.org/emacs/HideShow][hide-show feature]]: | ||||
| #+begin_src emacs-lisp :tangle no | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue