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))) |       "e t" '("toggle flycheck"  . flycheck-mode))) | ||||||
| #+end_src | #+end_src | ||||||
| ** Documentation | ** 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 | #+begin_src emacs-lisp | ||||||
|   (use-package devdocs |   (use-package devdocs | ||||||
|     :general (:states 'normal |     :general (:states 'normal | ||||||
|                       "gD" '("devdocs" . devdocs-lookup)) |                       "gD" '("devdocs" . ha-devdocs-major-mode)) | ||||||
| 
 |  | ||||||
|     :config |     :config | ||||||
|     (major-mode-hydra-define emacs-lisp-mode nil |     (pretty-hydra-define hydra-devdocs (:color blue) | ||||||
|       ("Dev Docs" |       ("Dev Docs" | ||||||
|        (("e" eldoc "eldoc") |        (("d" ha-devdocs-major-mode "open") | ||||||
|         ("d" devdocs-lookup "open") |         ("p" devdocs-peruse "peruse")) | ||||||
|         ("p" devdocs-peruse "peruse") |        "Packages" | ||||||
|         ("i" devdocs-install "install") |        (("i" devdocs-install "install") | ||||||
|         ("u" devdocs-update-all "update") |         ("u" devdocs-update-all "update") | ||||||
|         ("x" devdocs-delete "uninstall") |         ("x" devdocs-delete "uninstall"))))) | ||||||
|         ("s" devdocs-search "search"))))) |  | ||||||
| #+end_src | #+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. | 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. | ||||||
| #+begin_src emacs-lisp :tangle no |  | ||||||
|   (use-package devdocs-browser |  | ||||||
|     :general (:states 'normal "gD" 'devdocs-browser-open) |  | ||||||
| 
 | 
 | ||||||
|     :config | #+begin_src emacs-lisp | ||||||
|     (ha-local-leader :keymaps 'prog-mode-map |   (defun ha-devdocs-major-mode () | ||||||
|       "d"  '(:ignore t :which-key "docs") |     "My mapping of major mode to Devdocs slug." | ||||||
|       "d d" '("open" . devdocs-browser-open) |     (interactive) | ||||||
|       "d D" '("open in" . devdocs-browser-open-in) |     (let ((devdocs-current-docs | ||||||
|       "d l" '("list" . devdocs-browser-list-docs) |            (cl-case major-mode | ||||||
|       "d u" '("update" . devdocs-browser-update-docs) |              ('emacs-lisp-mode '("elisp")) | ||||||
|       "d i" '("install" . devdocs-browser-install-doc) |              ('python-mode     '("python~.3.11")) | ||||||
|       "d x" '("uninstall" . devdocs-browser-uninstall-doc) |              ('yaml-ts-mode    '("ansible" "jinja-2.11"))))) | ||||||
|       "d U" '("upgrade" . devdocs-browser-upgrade-doc) |       (devdocs-lookup nil))) | ||||||
|       "d o" '("download" . devdocs-browser-download-offline-data) |  | ||||||
|       "d O" '("remove download" . devdocs-browser-remove-offline-data))) |  | ||||||
| #+end_src | #+end_src | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ** Code Folding | ** 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]]: | 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 | #+begin_src emacs-lisp :tangle no | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue