Mercurial > emacs
annotate lisp/scroll-lock.el @ 67969:3ca8b2234237
* mh-customize.el: Sync docstrings with manual for faces and sort them
alphabetically.
(mh-faces): Move below mh-hooks. (mh-folder-faces, mh-index-faces,
mh-letter-faces)
(mh-show-faces, mh-speed-faces): Delete. Organize faces like hooks.
(mh-speed-update-interval): Fix group (mh-speedbar, not mh-speed).
(facemenu-unlisted-faces): Might as well ignore all MH-E faces.
(mh-folder-body-face, mh-folder-cur-msg-face)
(mh-folder-cur-msg-number-face, mh-folder-date-face)
(mh-folder-followup-face, mh-folder-msg-number-face)
(mh-folder-deleted-face, mh-folder-refiled-face)
(mh-folder-subject-face, mh-folder-address-face)
(mh-folder-scan-format-face, mh-folder-to-face) (mh-index-folder-face,
mh-show-cc-face, mh-show-date-face) (mh-show-header-face,
mh-show-pgg-good-face) (mh-show-pgg-unknown-face,
mh-show-pgg-bad-face)
(mh-show-to-face, mh-show-from-face, mh-show-subject-face): Delete.
(mh-folder-cur-msg): Unused. Delete.
(mh-folder-address): Use defface; inherit from mh-folder-subject.
(mh-folder-body, mh-folder-cur-msg-number, mh-folder-date): Inherit
from mh-folder-msg-number.
(mh-folder-deleted): Use defface. Inherit from mh-folder-msg-number.
(mh-folder-sent-to-me-hint): New face. Inherit from mh-folder-date.
(mh-folder-sent-to-me-sender): Rename from mh-folder-scan-format. Use
defface. Inherit from mh-folder-followup.
(mh-show-xface): Inherit from mh-show-from and highlight.
(bw-face-generation, bw-toggle-faces)
(bw-new-face-to-old, bw-old-face-to-new): New (tempoarary) variables,
functions for toggling between old and new faces.
* mh-e.el (font-lock-auto-fontify, font-lock-defaults): Hide in
eval-when-compile. We should probably do this throughout.
(mh-scan-good-msg-regexp, mh-scan-deleted-msg-regexp)
(mh-scan-refiled-msg-regexp, mh-scan-cur-msg-number-regexp)
(mh-scan-date-regexp, mh-scan-rcpt-regexp, mh-scan-body-regexp)
(mh-scan-subject-regexp): Sync docstrings with manual
(mh-scan-format-regexp): Rename to mh-scan-sent-to-me-sender-regexp.
Drop date parenthesized expression. Make expression more like the
others (anchored at the beginning of line). Sync docstrings with
manual.
(mh-folder-font-lock-keywords): Use faces directly rather than -face
variables. Use mh-scan-sent-to-me-sender-regexp instead of
mh-scan-format-regexp, and within that expression, use faces
mh-folder-sent-to-me-hint and mh-folder-sent-to-me-sender instead of
mh-folder-date-face and mh-folder-scan-format-face which were
misleading.
* mh-mime.el (mh-mime-security-button-face): Use faces directly rather
than -face variables.
* mh-utils.el (mh-show-font-lock-keywords): Use faces directly rather
than -face variables.
(mh-face-foreground-compat, mh-face-background-compat): New macros.
(mh-face-display-function): Use mh-face-foreground-compat and
mh-face-background-compat to use inherited attributes of mh-show-xface
on Emacs 22 while still working on Emacs 21.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Sun, 01 Jan 2006 18:51:18 +0000 |
parents | bb897fec166c |
children | 3bd95f4f2941 |
rev | line source |
---|---|
65035 | 1 ;;; scroll-lock.el --- Scroll lock scrolling. |
2 | |
3 ;; Copyright (C) 2005 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de> | |
6 ;; Maintainer: FSF | |
7 ;; Created: 2005-06-18 | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with this program; see the file COPYING. If not, write to | |
23 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
24 ;; Boston, MA 02110-1301, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; By activating Scroll Lock mode, keys for moving point by line or | |
29 ;; paragraph will scroll the buffer by the respective amount of lines | |
30 ;; instead. Point will be kept vertically fixed relative to window | |
31 ;; boundaries. | |
32 | |
33 ;;; Code: | |
34 | |
35 (defvar scroll-lock-mode-map | |
36 (let ((map (make-sparse-keymap))) | |
37 (define-key map [remap next-line] 'scroll-lock-next-line) | |
38 (define-key map [remap previous-line] 'scroll-lock-previous-line) | |
65038
588913d78aaf
Fix errors due to incorrect line wrapping.
Kim F. Storm <storm@cua.dk>
parents:
65035
diff
changeset
|
39 (define-key map [remap forward-paragraph] 'scroll-lock-forward-paragraph) |
588913d78aaf
Fix errors due to incorrect line wrapping.
Kim F. Storm <storm@cua.dk>
parents:
65035
diff
changeset
|
40 (define-key map [remap backward-paragraph] 'scroll-lock-backward-paragraph) |
65035 | 41 map) |
42 "Keymap for Scroll Lock mode.") | |
43 | |
44 (defvar scroll-lock-preserve-screen-pos-save scroll-preserve-screen-position | |
45 "Used for saving the state of `scroll-preserve-screen-position'.") | |
46 (make-variable-buffer-local 'scroll-lock-preserve-screen-pos-save) | |
47 | |
48 (defvar scroll-lock-temporary-goal-column 0 | |
49 "Like `temporary-goal-column' but for scroll-lock-* commands.") | |
50 | |
51 ;;;###autoload | |
52 (define-minor-mode scroll-lock-mode | |
53 "Minor mode for pager-like scrolling. | |
54 Keys which normally move point by line or paragraph will scroll | |
55 the buffer by the respective amount of lines instead and point | |
56 will be kept vertically fixed relative to window boundaries | |
57 during scrolling." | |
58 :lighter " ScrLck" | |
59 :keymap scroll-lock-mode-map | |
60 (if scroll-lock-mode | |
61 (progn | |
62 (setq scroll-lock-preserve-screen-pos-save | |
63 scroll-preserve-screen-position) | |
64 (set (make-local-variable 'scroll-preserve-screen-position) 'always)) | |
65 (setq scroll-preserve-screen-position | |
66 scroll-lock-preserve-screen-pos-save))) | |
67 | |
68 (defun scroll-lock-update-goal-column () | |
69 "Update `scroll-lock-temporary-goal-column' if necessary." | |
70 (unless (memq last-command '(scroll-lock-next-line | |
71 scroll-lock-previous-line | |
72 scroll-lock-forward-paragraph | |
73 scroll-lock-backward-paragraph)) | |
74 (setq scroll-lock-temporary-goal-column (current-column)))) | |
75 | |
76 (defun scroll-lock-move-to-column (column) | |
77 "Like `move-to-column' but cater for wrapped lines." | |
78 (if (or (bolp) | |
79 ;; Start of a screen line. | |
80 (not (zerop (mod (- (point) (line-beginning-position)) | |
81 (window-width))))) | |
82 (move-to-column column) | |
83 (forward-char (min column (- (line-end-position) (point)))))) | |
84 | |
85 (defun scroll-lock-next-line (&optional arg) | |
86 "Scroll up ARG lines keeping point fixed." | |
87 (interactive "p") | |
88 (or arg (setq arg 1)) | |
89 (scroll-lock-update-goal-column) | |
90 (if (pos-visible-in-window-p (point-max)) | |
91 (next-line arg) | |
92 (scroll-up arg)) | |
93 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
94 | |
95 (defun scroll-lock-previous-line (&optional arg) | |
96 "Scroll up ARG lines keeping point fixed." | |
97 (interactive "p") | |
98 (or arg (setq arg 1)) | |
99 (scroll-lock-update-goal-column) | |
100 (condition-case nil | |
101 (scroll-down arg) | |
102 (beginning-of-buffer (previous-line arg))) | |
103 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
104 | |
105 (defun scroll-lock-forward-paragraph (&optional arg) | |
106 "Scroll down ARG paragraphs keeping point fixed." | |
107 (interactive "p") | |
108 (or arg (setq arg 1)) | |
109 (scroll-lock-update-goal-column) | |
110 (scroll-up (count-screen-lines (point) (save-excursion | |
111 (forward-paragraph arg) | |
112 (point)))) | |
113 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
114 | |
115 (defun scroll-lock-backward-paragraph (&optional arg) | |
116 "Scroll up ARG paragraphs keeping point fixed." | |
117 (interactive "p") | |
118 (or arg (setq arg 1)) | |
119 (scroll-lock-update-goal-column) | |
120 (let ((goal (save-excursion (backward-paragraph arg) (point)))) | |
121 (condition-case nil | |
122 (scroll-down (count-screen-lines goal (point))) | |
123 (beginning-of-buffer (goto-char goal)))) | |
124 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
125 | |
126 (provide 'scroll-lock) | |
127 | |
65125 | 128 ;; arch-tag: 148fc8e8-67e0-4638-bb34-3291595ab7e1 |
65035 | 129 ;;; scroll-lock.el ends here |