This post covers the following sections from my init.
Elnode
Editor Hydra
Preamble
Emacs is old school. You're either new to it - which means you wouldn't be here unless it was your type of thing - or you know what you're looking for. In either case, go to the side bar of this page and click on the 'Emacs' tag. Then read the posts y date from oldest to newest.
In the last emacs post I covered lines 2188 - 2379. This post covers lines 2407 - 2558. I include the lines for anyone that wants to patch together the entire init from start to finish. The lines won't always match up because I take stuff out when I'm in the init.
Elnode
Elnode is a nifty little package that starts an emacs server. Basically, you set up a public folder with a shortcut and you jump there and make html files when you want to mess around with html without bothering with a third party dev server (Xampp in my case). It's quick and easy. I've put some short-cuts to the elnode functions in my web development hydra, which I'll get to later. Here's the Elnode config. Btw, the eldoc code is in there too. Eldoc has nothing to do with Elnode. It shows function arguments in the minibuffer. If you want to run a lean emacs, just cut that code out.
(use-package elnode
:commands elnode elnode-start elnode-make-webserver
:config
(require 'elnode)
(setq elnode-webserver-docroot "c:/emacs/.emacs.d/public_html/")
);specify any port, try 8028, on localhost:
; Using Eldo To Inform Function Arguments
(use-package eldoc
:defer t
:diminish eldoc-mode)
Here are some notes for Elnode
1. Put web files in your ~public_html/ directory.
2. M-x elnode make webserver (select directory of files, port and host for this one server)
3. Navigate to host and port from browser to serve files
4. M-x list-elnode-servers, kill server by hitting k on it
5. M-x elnode-start and M-x elnode-stop also work
6. make a handler function:
(defun my-test-handler (httpcon)
"Demonstration function"
(elnode-http-start httpcon 200 '("Content-type" . "text/html"))
(elnode-http-return httpcon "
Then elnode-start 'my-test-handler :port 8010 :host "localhost"
Here's an image of the web dev hydra. Look at the lower section of Action to see the Elnode stuff. There's also a jump to the server root, which makes it easy to use.
Here is the Editor Hydra Stuff
;writegood-mode
(use-package writegood-mode
:commands writegood-mode
:config
(add-to-list 'load-path "path/to/writegood-mode")
(require 'writegood-mode)
;set usability test
(global-set-key "\C-c\C-gg" 'writegood-grade-level)
(global-set-key "\C-c\C-ge" 'writegood-reading-ease)
;edit faces
;Weasel words (writegood-weasels-face)
;Passive voice (writegood-passive-voice-face)
;Duplicate words (writegood-duplicates-face)
:bind
("\C-cg" . writegood-mode)
;(global-set-key "\C-cg" 'writegood-mode)
);end package writegood-mode
;artbollocks-mode
(add-to-list 'load-path "~/emax/elpa/artbollocks-mode/artbollocks-mode.el")
;(require 'artbollocks-mode)
;art-bollocks mode
;font-lock-fontify-buffer
;(define-key artbollocks-mode-keymap (kbd "C-c [") 'artbollocks-word-count)
;(define-key artbollocks-mode-keymap (kbd "C-c ]") 'artbollocks-sentence-count)
;(define-key artbollocks-mode-keymap (kbd "C-c \\") 'artbollocks-readability-index)
;(define-key artbollocks-mode-keymap (kbd "C-c /") 'artbollocks-reading-ease)
;(define-key artbollocks-mode-keymap (kbd "C-c =") 'artbollocks-grade-level)
;flyspell
;underline mispelled word. On point helm-flyspell-correct
(use-package flyspell
:diminish
:commands (flyspell-prog-mode flyspell-mode helm-flyspell-correct)
:config
(setq-default ispell-program-name ispell-program-name-p)
(setq ispell-local-dictionary "english")
(setq ispell-dictionary "en_CA")
(setq ispell-alternate-dictionary comp-ispell-dic-p)
;(setq ispell-local-dictionary "en_CA")
(setq ispell-really-hunspell t)
(setenv "DICTIONARY" "en_CA")
;(setq ispell-dictionary "english")
;:custom-face
;(flyspell-incorrect ((t (:underline (:color "#f1fa8c" :style wave)))))
;(flyspell-duplicate ((t (:underline (:color "#50fa7b" :style wave)))))
:hook
((org-mode yaml-mode markdown-mode git-commit-mode text-mode elisp-mode) . flyspell-mode )
(prog-mode . flyspell-prog-mode)
);end flyspell use-package
;interface for flyspell (you can also use flyspell-popup and flyspell-correct)
(use-package helm-flyspell
:commands (helm-flyspell-correct)
:bind
("C-c f" . helm-flyspell-correct)
);end helm-flyspell
;flyspell-popup
(use-package flyspell-popup
:commands (flyspell-mode flyspell-popup-correct)
;:config
;(setq flyspell-popup-delay 0)
:bind
("C-c g" . flyspell-popup-correct)
);flyspell pop-up
;synorous thesaurus with wordnet backend
; http://wordnetcode.princeton.edu/2.1/WordNet-2.1.exe
(use-package synosaurus
:commands (synosaurus-lookup synosaurus-choose-and-replace synosaurus-choose-and-insert)
:config
;(defvar synosaurus-wordnet--command "wn")
(setq synosaurus-choose-method 'popup)
(add-to-list 'load-path wordnet-p)
(setq synosaurus-wordnet--command wordnet-command-p)
);end synosaurus
;use wordnut as a dictionary also
(use-package wordnut
:commands (wordnut-lookup-current-word wordnut-search )
:init
(require 'adaptive-wrap)
(if (eq 'windows-nt system-type)
(progn
(add-to-list 'load-path wordnet-dictionary-p)
(setq wordnut-cmd wordnet-command-p)
(require 'wordnut)))
);end wordnut
;academic phrases
(use-package academic-phrases
:commands (academic-phrases academic-phrases-by-section)
);end academic phrases
Writegood mode and Artbollocks mode are grammar checkers. They give suggestions by underlining words much like Word does in a sidebar when you run the spell check. I haven't explored either of these much. As I recall Artbollocks mode was a little more interesting, but still for me anyway mostly unnecessary (well...they probably are necessary 😏 , let me say instead I'm too lazy to use them.)
Flyspell is mandatory. I use it with Hunspell. You can find a Hunspell executable on line. Aspell was the go-to spell checker, but it's not frequently compiled for Windows 10. I ended up switching to Hunspell, then found an Aspell executable compiled for Windows 10, but never bothered to switch back. The flyspell popup allows you to spellcheck words with a drop down. Flyspell helm pops up in the helm interface and gives some extra functions. I use the popup through the editor hydra when I spell check word. Spell check region and buffer underlined misspelled words and offer replacements in the top of the page. You select a letter to choose your replacement and use the space bar to move through the page. Standard.
The trick with the spell checkers is to get the dictionary configuration optimized. You only need to ensure the words are spelled correctly. I built my dictionaries from google data of the 10,000 most commonly googled words. You can build (or just find) dictionaries in any language and there are several functions on line for switching dictionaries on the fly if you need to do that. Here's a link to the page where I built my own dictionary (rather than using the one included in Hunspell) Build a Spellcheck Dictionary
Wordnut and Synosaurus are probably the coolest packages on this page. As an everyday writer, I use them all the time. Synosaurus gives a drop down of synonyms, or if you type out an easy to think of antonym and use it on that a drop down of antonyms. I have it set to replace the word, which saves cut/paste action. Wordnut is a program built at Princeton that gives definitions. The emacs Wordnut package opens up the definitions, senses, and examples in a buffer. I still use google often, but I always check wordnut first.
The Academic phrases package is not what I expected. It just gives suggestions for possible actions to take in any academic paper. Great if you have to write any reports, but not what I wanted which was a database of possible dependent and independent clauses.