- Most online meetups focus on Emacs usage
- I will be presenter of last resort
- straight.el
- for running and monitoring the compilation
- for identifying errors and file locations
- for setting the “face” of e.g. compilation command lines, line and column numbers, etc.
- for highlighting errors
- for cancelling temporary effects (chiefly highlighting)
- grep, linters, unit tests…
- differences seem to be related to backtracking and “greedy” constructs
(string-match "[a-z_]+p$" "eolp") ;; is this a predicate?
(with-current-buffer "test.cpp"
;; temporarily move point to end of match
(re-search-forward "\\(int\\|float\\|double\\|void\\)[[:blank:]]+[[:word:]_]+("))
(with-current-buffer "test.cpp"
;; highlight matched region instead (from font-lock)
(highlight-regexp "\\(int\\|float\\|double\\|void\\)[[:blank:]]+[[:word:]_]+("))
- forward/backword-word/sexp/symbol/whitespace etc.
- types of messages (info, warning, error)
- references to file locations
- maxxcan recommends a nice tutorial here
(setq my-process
(make-process
:name "my-process"
:buffer "my-process-buffer"
:command '("tail" "-f" "/var/log/auth.log")))
(defun my-process-filter (proc string)
(with-current-buffer (process-buffer proc)
(let ((filtered
(if (string-match "dbus-daemon\\[[[:digit:]]+\\]: \\[system\\] Would reject" string)
"dbus is unhappy again\n"
string)))
(save-excursion
(goto-char (process-mark proc))
(insert filtered)
(set-marker (process-mark proc) (point))))))
(set-process-filter my-process #'my-process-filter)
- Emacs is still basically single-threaded
Output from a subprocess can arrive only while Emacs is waiting: when reading terminal input (see the function waiting-for-user-input-p), in sit-for and sleep-for (see Waiting), in accept-process-output (see Accepting Output), and in functions which send data to processes (see Input to Processes). This minimizes the problem of timing errors that usually plague parallel programming.
- allows you to rewrite compilation output, apply overlays, etc.
also used to do async code block execution in org-mode via this recent commit
A sentinel runs only while Emacs is waiting (e.g., for terminal input, or for time to elapse, or for process output). This avoids the timing errors that could result from running sentinels at random places in the middle of other Lisp programs.
- it’s the single-threaded event loop model
- Mike suggests looking at
list-timers
andlist-threads
to see what asynchronous stuff is running in your Emacs
(defun my-process-sentinel (process event)
(message (format "Process %s had event '%s'" process event)))
(set-process-sentinel my-process #'my-process-sentinel)
- you can even have text properties in a string outside of a buffer
Most common use is for faces but there are many
- read-only
- pointer for the mouse when hovering
- keymap to be used when point is there
- and on and on
- things reflecting attributes of the text itself, e.g. for font-lock (demo face-at-point)
- navigate on mouse click
- info/warning/error counts in modeline
- coloring warnings and errors in the process output
- do not affect search results, for example
- mainly affect appearance
- defined on regions
- easy to find and delete (no change to text)
- therefore used more for dynamic properties
- temporary highlighting of error regions
- little arrow showing line of error
…timers can run within a Lisp program only when the program calls a primitive that can wait…
- i.e. to make the highlighting temporary
(run-with-timer 3 nil
(lambda () (message "3 seconds have passed")))
- special-mode is typically for formatted display of read-only data e.g. bart-mode (demo)
(define-compilation-mode hs-lint-mode "HLint"
"Mode for check Haskell source code."
(set (make-local-variable 'compilation-process-setup-function)
'hs-lint-process-setup)
(set (make-local-variable 'compilation-disable-input) t)
(set (make-local-variable 'compilation-scroll-output) nil)
(set (make-local-variable 'compilation-finish-functions)
(list 'hs-lint-finish-hook))
)
- grep-mode, elisp byte compilation
- Emacs-SF member and Scheme RFI editor Arthur Gleckler validates HTML this way
- his lightning talk on the subject is here
- Yisrael Dov suggests (face-remap-add-relative ‘default :height 2.0 ) to increase default font size for presentations (to fix small minibuffer font)
- R Primus suggests this post by Xah Lee for the same purpose
- Discussion re: Emacs security
- uses GitHub
- Howard Abrams: it supplies version pinning, which is nice
- someone noted this is a Git commit, not a “version” per se
- Quelpa is kind of similar though hews more to the ELPA/MELPA infrastructure
- Mike W. used to profile startup using ESUP
- You can use Guix to manage Emacs packages
- this is the approach David Wilson (of System Crafters) uses - see for example this video
- maxxcan uses it for everything
- does a hydra that calls
shell-command
, which runsxrandr
- Howard: are you switching from
hydra
totransient
?- Mike W: doing my own (!!!), a Haskell based backend with an SVG GUI and Emacs keybindings
- Also using it to make an open source CAD thing
- Mike W: doing my own (!!!), a Haskell based backend with an SVG GUI and Emacs keybindings