diff options
| author | Phil Sainty | 2025-02-19 01:02:22 +1300 |
|---|---|---|
| committer | Phil Sainty | 2025-03-15 23:05:18 +1300 |
| commit | 87f9c09ab5fbfa9652aabe2799df654456d5e04c (patch) | |
| tree | 2851f945dbce9107fe4b36b42321a2d1b1ac6d23 | |
| parent | 25eabcde0d6ec7d8c161c2e05a5600b1c22fa43d (diff) | |
| download | emacs-87f9c09ab5fbfa9652aabe2799df654456d5e04c.tar.gz emacs-87f9c09ab5fbfa9652aabe2799df654456d5e04c.zip | |
; * lisp/so-long.el: Documentation
| -rw-r--r-- | lisp/so-long.el | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/lisp/so-long.el b/lisp/so-long.el index b572fd46ca9..59a833d2c32 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el | |||
| @@ -383,6 +383,43 @@ | |||
| 383 | ;; Finally, the `so-long-predicate' user option enables the automated behavior | 383 | ;; Finally, the `so-long-predicate' user option enables the automated behavior |
| 384 | ;; to be determined by a custom function, if greater control is needed. | 384 | ;; to be determined by a custom function, if greater control is needed. |
| 385 | 385 | ||
| 386 | ;; * Non-file buffers | ||
| 387 | ;; ------------------ | ||
| 388 | ;; As noted in the introduction, `global-so-long-mode' only affects buffers | ||
| 389 | ;; visiting files, and only at the point in time that they are visited. The | ||
| 390 | ;; library does not automatically detect if long lines are inserted into an | ||
| 391 | ;; existing buffer, which means that non-file buffers are not processed at all | ||
| 392 | ;; by the global mode (although the `so-long' command can be invoked manually). | ||
| 393 | ;; To handle such buffers additional glue code will be required, and that code | ||
| 394 | ;; should likely be specific to the particular use-case to avoid unintended | ||
| 395 | ;; behaviours. | ||
| 396 | ;; | ||
| 397 | ;; An example to handle `compilation-mode' (and derivative) buffers follows: | ||
| 398 | ;; | ||
| 399 | ;; ;; Trigger `so-long-minor-mode' for long compile output. | ||
| 400 | ;; (with-eval-after-load 'compile | ||
| 401 | ;; (require 'so-long)) | ||
| 402 | ;; | ||
| 403 | ;; (add-hook 'compilation-mode-hook 'my-so-long-compilation-mode) | ||
| 404 | ;; | ||
| 405 | ;; (defun my-so-long-compilation-mode () | ||
| 406 | ;; "Add `my-so-long-compilation-filter' to local `compilation-filter-hook'." | ||
| 407 | ;; (add-hook 'compilation-filter-hook | ||
| 408 | ;; 'my-so-long-compilation-filter nil :local)) | ||
| 409 | ;; | ||
| 410 | ;; (defun my-so-long-compilation-filter () | ||
| 411 | ;; "Maybe call `so-long-minor-mode' during `compilation-filter-hook'." | ||
| 412 | ;; (let ((start (save-excursion (goto-char compilation-filter-start) | ||
| 413 | ;; (line-beginning-position)))) | ||
| 414 | ;; (when (> (- (point) start) so-long-threshold) | ||
| 415 | ;; (save-restriction | ||
| 416 | ;; (narrow-to-region start (point)) | ||
| 417 | ;; (when (let (so-long-max-lines so-long-skip-leading-comments) | ||
| 418 | ;; (funcall so-long-predicate)) | ||
| 419 | ;; (so-long-minor-mode 1) | ||
| 420 | ;; (remove-hook 'compilation-filter-hook | ||
| 421 | ;; 'my-so-long-compilation-filter :local)))))) | ||
| 422 | |||
| 386 | ;; * Implementation notes | 423 | ;; * Implementation notes |
| 387 | ;; ---------------------- | 424 | ;; ---------------------- |
| 388 | ;; This library advises `set-auto-mode' (in order to react after Emacs has | 425 | ;; This library advises `set-auto-mode' (in order to react after Emacs has |
| @@ -1517,14 +1554,14 @@ The variables are set in accordance with what was remembered in `so-long'." | |||
| 1517 | (kill-local-variable variable)))) | 1554 | (kill-local-variable variable)))) |
| 1518 | 1555 | ||
| 1519 | (defun so-long-mode-maintain-preserved-variables () | 1556 | (defun so-long-mode-maintain-preserved-variables () |
| 1520 | "Set any \"preserved\" variables. | 1557 | "Set variables listed in `so-long-mode-preserved-variables'. |
| 1521 | 1558 | ||
| 1522 | The variables are set in accordance with what was remembered in `so-long'." | 1559 | The variables are set in accordance with what was remembered in `so-long'." |
| 1523 | (dolist (var (so-long-original 'so-long-mode-preserved-variables)) | 1560 | (dolist (var (so-long-original 'so-long-mode-preserved-variables)) |
| 1524 | (so-long-restore-variable var))) | 1561 | (so-long-restore-variable var))) |
| 1525 | 1562 | ||
| 1526 | (defun so-long-mode-maintain-preserved-minor-modes () | 1563 | (defun so-long-mode-maintain-preserved-minor-modes () |
| 1527 | "Enable or disable \"preserved\" minor modes. | 1564 | "Enable or disable modes listed in `so-long-mode-preserved-minor-modes'. |
| 1528 | 1565 | ||
| 1529 | The modes are set in accordance with what was remembered in `so-long'." | 1566 | The modes are set in accordance with what was remembered in `so-long'." |
| 1530 | (dolist (mode (so-long-original 'so-long-mode-preserved-minor-modes)) | 1567 | (dolist (mode (so-long-original 'so-long-mode-preserved-minor-modes)) |