For instance, to play an alarm when the battery power dips below
10%, you could use a function like the following:
-(defvar my-prev-battery nil)
-(defun my-battery-alarm (data)
- (when (and my-prev-battery
- (equal (alist-get ?L data) \"off-line\")
- (< (string-to-number (alist-get ?p data)) 10)
- (>= (string-to-number (alist-get ?p my-prev-battery)) 10))
- (play-sound-file \"~/alarm.wav\" 5))
- (setq my-prev-battery data))"
+ (defvar my-prev-battery nil)
+ (defun my-battery-alarm (data)
+ (when (and my-prev-battery
+ (equal (alist-get ?L data) \"off-line\")
+ (< (string-to-number (alist-get ?p data)) 10)
+ (>= (string-to-number (alist-get ?p my-prev-battery)) 10))
+ (play-sound-file \"~/alarm.wav\" 5))
+ (setq my-prev-battery data))"
:version "29.1"
:type '(repeat function))
(defun cl--optimize (f _args &rest qualities)
"Serve `cl-optimize' in function declarations.
Example:
-(defun foo (x)
- (declare (cl-optimize (speed 3) (safety 0)))
- x)"
+ (defun foo (x)
+ (declare (cl-optimize (speed 3) (safety 0)))
+ x)"
;; FIXME this should make use of `cl--declare-stack' but I suspect
;; this mechanism should be reviewed first.
(cl-loop for (qly val) in qualities
latex source block to a sha1 of its contents. We could achieve
this with:
-(defun org-src-sha ()
- (let ((elem (org-element-at-point)))
- (concat (sha1 (org-element-property :value elem)) \".svg\")))
+ (defun org-src-sha ()
+ (let ((elem (org-element-at-point)))
+ (concat (sha1 (org-element-property :value elem)) \".svg\")))
-(setq org-babel-default-header-args:latex
- `((:results . \"file link replace\")
- (:file . (lambda () (org-src-sha)))))
+ (setq org-babel-default-header-args:latex
+ `((:results . \"file link replace\")
+ (:file . (lambda () (org-src-sha)))))
Because the closure is evaluated with point at the source block,
the call to `org-element-at-point' above will always retrieve
is a list of strings. For example the current implementation for
post-forward-angle-brackets could be:
-(defun my-post-forward-angle-brackets (base extra-string)
- (concat base \"<\" (mapconcat #\\='identity extra-string \"/\") \">\"))
+ (defun my-post-forward-angle-brackets (base extra-string)
+ (concat base \"<\" (mapconcat #\\='identity extra-string \"/\") \">\"))
The \"mumble\" part may be stripped as well, depending on the
setting of `uniquify-strip-common-suffix'. For more options that