about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-04-02 13:58:17 -0500
committerCase Duckworth2022-04-02 13:58:17 -0500
commitf479cd9b30a8cd51042e7d4794bd8f86285c5130 (patch)
tree9c0b2f11d27f1603e038905932fc30b40765f006
parentExperiment: remove most font-lock faces (diff)
parentAdd +scratch-buffer (diff)
downloademacs-f479cd9b30a8cd51042e7d4794bd8f86285c5130.tar.gz
emacs-f479cd9b30a8cd51042e7d4794bd8f86285c5130.zip
Merge branch 'main' of tildegit.org:acdw/emacs
-rw-r--r--lisp/+tab-bar.el3
-rw-r--r--lisp/acdw.el25
2 files changed, 27 insertions, 1 deletions
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 5d018b5..1f4745d 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -52,7 +52,8 @@
52 52
53(defun +tab-bar-notmuch-count () 53(defun +tab-bar-notmuch-count ()
54 "Display a notmuch count in the tab-bar." 54 "Display a notmuch count in the tab-bar."
55 (when (featurep 'notmuch) 55 (when (and (executable-find "notmuch")
56 (featurep 'notmuch))
56 (let* ((counts (ignore-errors (notmuch-hello-query-counts notmuch-saved-searches))) 57 (let* ((counts (ignore-errors (notmuch-hello-query-counts notmuch-saved-searches)))
57 (next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal)) 58 (next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal))
58 (next-count (plist-get next :count))) 59 (next-count (plist-get next :count)))
diff --git a/lisp/acdw.el b/lisp/acdw.el index 764a246..e47770b 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -386,5 +386,30 @@ the `format' call in a list."
386 `(with-eval-after-load ',this 386 `(with-eval-after-load ',this
387 (+with-eval-after-loads ,rest ,@body))))) 387 (+with-eval-after-loads ,rest ,@body)))))
388 388
389(defun +scratch-buffer (&optional nomode)
390 "Create a new scratch buffer and switch to it.
391If the region is active, paste its contents into the scratch
392buffer. The scratch buffer inherits the mode of the current
393buffer unless NOMODE is non-nil. When called interactively,
394NOMODE will be set when called with \\[universal-argument]."
395 (interactive "P")
396 (let* ((mode major-mode)
397 (bufname (generate-new-buffer-name (format "*scratch (%s)*" mode)))
398 (paste (and (region-active-p)
399 (prog1
400 (buffer-substring (mark t) (point))
401 (deactivate-mark)))))
402 (when (and (not nomode)
403 (bound-and-true-p ess-dialect)) ; Not sure what `ess-dialect' is
404 (setq mode (intern-soft (concat ess-dialect "-mode"))))
405 ;; Set up buffer
406 (switch-to-buffer (get-buffer-create bufname))
407 (when (and (not nomode) mode)
408 (ignore-errors (funcall mode)))
409 (insert (format "%s Scratch buffer for %s%s\n\n"
410 comment-start mode comment-end))
411 (when paste (insert paste))
412 (get-buffer bufname)))
413
389(provide 'acdw) 414(provide 'acdw)
390;;; acdw.el ends here 415;;; acdw.el ends here