diff options
-rw-r--r-- | emacs.el | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/emacs.el b/emacs.el index 73e0e8b..0ec616c 100644 --- a/emacs.el +++ b/emacs.el | |||
@@ -1441,3 +1441,49 @@ NEW is passed to `eshell'." | |||
1441 | (wiki-abbrev-insinuate) | 1441 | (wiki-abbrev-insinuate) |
1442 | (add-hook 'text-mode-hook #'abbrev-mode)) | 1442 | (add-hook 'text-mode-hook #'abbrev-mode)) |
1443 | (put 'list-timers 'disabled nil) | 1443 | (put 'list-timers 'disabled nil) |
1444 | |||
1445 | ;;; Dinghie | ||
1446 | |||
1447 | (add-to-list 'mode-line-misc-info | ||
1448 | '(buffer-ding-cookie buffer-ding-cookie) | ||
1449 | :append) | ||
1450 | |||
1451 | (defvar buffer-ding-timer nil | ||
1452 | "Timer for `buffer-ding'.") | ||
1453 | (defvar buffer-ding-cookie nil | ||
1454 | "Variable to hold the `face-remap-add-relative' cookie.") | ||
1455 | (defcustom buffer-ding-timeout 0.25 | ||
1456 | "How long to ding the buffer for.") | ||
1457 | |||
1458 | (defun buffer-unding () | ||
1459 | "Unflash the buffer after done `ding'ing." | ||
1460 | ;; (face-remap-remove-relative buffer-ding-cookie) | ||
1461 | (setq buffer-ding-cookie nil) | ||
1462 | (force-mode-line-update)) | ||
1463 | |||
1464 | (defun buffer-ding () | ||
1465 | "Flash the buffer for `ding'." | ||
1466 | (cond | ||
1467 | ((timerp buffer-ding-timer) | ||
1468 | (cancel-timer buffer-ding-timer) | ||
1469 | (setq buffer-ding-timer nil) | ||
1470 | (buffer-ding)) | ||
1471 | ((and (null buffer-ding-timer) | ||
1472 | buffer-ding-cookie) | ||
1473 | (setq buffer-ding-cookie nil) | ||
1474 | (buffer-unding)) | ||
1475 | (t | ||
1476 | ;; (setq buffer-ding-cookie (face-remap-add-relative 'default 'error)) | ||
1477 | (setq buffer-ding-cookie " Ding!") | ||
1478 | (force-mode-line-update) | ||
1479 | (run-with-timer buffer-ding-timeout nil #'buffer-unding)))) | ||
1480 | |||
1481 | (setopt ring-bell-function #'buffer-ding) | ||
1482 | (add-hook 'isearch-mode-end-hook #'buffer-unding) | ||
1483 | |||
1484 | (defun mapc-buffers (fn &rest modes) | ||
1485 | (cl-loop for buf being the buffers | ||
1486 | do (with-current-buffer buf | ||
1487 | (when (or (null modes) | ||
1488 | (apply #'derived-mode-p modes)) | ||
1489 | (funcall fn))))) | ||