Mercurial > emacs
annotate lisp/scroll-lock.el @ 99602:c94ec53df9d8
* net/ange-ftp.el (ange-ftp-multi-msgs, ange-ftp-good-msgs)
(ange-ftp-try-passive-mode, ange-ftp-data-buffer-name)
(ange-ftp-account-hashtable, ange-ftp-ls-cache-lsargs)
(ange-ftp-ls-cache-file, ange-ftp-ls-cache-res, ange-ftp-get-user)
(ange-ftp-ftp-name-component, ange-ftp-kill-ftp-process)
(ange-ftp-quote-string, ange-ftp-process-handle-line)
(ange-ftp-start-process, ange-ftp-send-cmd, ange-ftp-add-dumb-unix-host)
(ange-ftp-before-parse-ls-hook, ange-ftp-after-parse-ls-hook)
(ange-ftp-ls, ange-ftp-add-dl-dir, ange-ftp-get-file-entry)
(ange-ftp-set-binary-mode, ange-ftp-set-ascii-mode, ange-ftp-get-pwd)
(ange-ftp-file-name-as-directory-alist, ange-ftp-reread-dir)
(ange-ftp-vms-filename-regexp, ange-ftp-bs2000-fix-name-regexp-reverse)
(ange-ftp-bs2000-fix-name-regexp): Fix typos in docstrings.
(ange-ftp-name-format, ange-ftp-gateway-fatal-msgs)
(ange-ftp-xfer-size-msgs, ange-ftp-tmp-name-template)
(ange-ftp-netrc-filename, ange-ftp-disable-netrc-security-check)
(ange-ftp-default-user, ange-ftp-default-password)
(ange-ftp-default-account, ange-ftp-netrc-default-password)
(ange-ftp-netrc-default-account, ange-ftp-dumb-unix-host-regexp)
(ange-ftp-binary-file-name-regexp, ange-ftp-gateway-host)
(ange-ftp-gateway-prompt-pattern, ange-ftp-smart-gateway-port)
(ange-ftp-send-hash, ange-ftp-binary-hash-mark-size)
(ange-ftp-ascii-hash-mark-size, ange-ftp-process-verbose)
(ange-ftp-ftp-program-name, ange-ftp-gateway-ftp-program-name)
(ange-ftp-ftp-program-args, ange-ftp-nslookup-program)
(ange-ftp-make-backup-files, ange-ftp-retry-time)
(ange-ftp-bs2000-special-prefix): Remove * from defcustom docstrings.
(ange-ftp-skip-msgs, ange-ftp-potential-error-msgs)
(ange-ftp-gateway-tmp-name-template)
(ange-ftp-generate-anonymous-password, ange-ftp-local-host-regexp)
(ange-ftp-gateway-program-interactive, ange-ftp-smart-gateway)
(ange-ftp-raw-login): Remove * from defcustom docstrings; fix typos.
(ange-ftp-fatal-msgs): Remove * from defcustom docstring; doc fix.
(ange-ftp-gateway-program): Remove * from docstring and reflow.
(ange-ftp-hash-entry-exists-p, ange-ftp-hash-table-keys)
(ange-ftp-raw-send-cmd, ange-ftp-get-files, ange-ftp-canonize-filename)
(ange-ftp-file-name-as-directory, ange-ftp-directory-file-name):
(ange-ftp-copy-files-async, ange-ftp-rename-remote-to-remote):
(ange-ftp-rename-local-to-remote): Doc fixes.
(ange-ftp-set-xfer-size, ange-ftp-call-cont, ange-ftp-process-filter):
Use `when', `unless'.
(ange-ftp-set-passwd): Rename arg PASSWD to PASSWORD.
(ange-ftp-process-handle-hash): Rename arg STR to STRING.
(ange-ftp-nslookup-host): Rename arg HOST to HOSTNAME.
(ange-ftp-smart-login): Rename arg PASS to PASSWORD.
(ange-ftp-normal-login): Rename arg PASS to PASSWORD. Fix typo.
(ange-ftp-process-sentinel): Use `when'. Fix typo.
(ange-ftp-gwp-start): Use `let', not `let*'; use `when'. Fix typo.
(ange-ftp-fix-name-func-alist, ange-ftp-fix-dir-name-func-alist)
(ange-ftp-parse-list-func-alist, ange-ftp-add-file-entry-alist)
(ange-ftp-delete-file-entry-alist): Fix typos and reflow docstring.
(ange-ftp-dumb-unix-host, ange-ftp-binary-file)
(ange-ftp-directory-files, ange-ftp-file-modtime, ange-ftp-vms-host)
(ange-ftp-mts-host, ange-ftp-cms-host, ange-ftp-bs2000-host)
(ange-ftp-bs2000-posix-host): Use `string-match-p' instead of
`(save-match-data (string-match ...))'.
(ange-ftp-use-gateway-p, ange-ftp-use-smart-gateway-p)
(ange-ftp-file-name-directory, ange-ftp-file-name-nondirectory):
Use `string-match-p' instead of `(save-match-data (string-match ...))'.
Doc fixes.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sun, 16 Nov 2008 05:50:23 +0000 |
parents | ee5932bf781d |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
65035 | 1 ;;; scroll-lock.el --- Scroll lock scrolling. |
2 | |
79721 | 3 ;; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
65035 | 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 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
65035 | 12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
14 ;; (at your option) any later version. |
65035 | 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 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
65035 | 23 |
24 ;;; Commentary: | |
25 | |
26 ;; By activating Scroll Lock mode, keys for moving point by line or | |
27 ;; paragraph will scroll the buffer by the respective amount of lines | |
28 ;; instead. Point will be kept vertically fixed relative to window | |
29 ;; boundaries. | |
30 | |
31 ;;; Code: | |
32 | |
33 (defvar scroll-lock-mode-map | |
34 (let ((map (make-sparse-keymap))) | |
35 (define-key map [remap next-line] 'scroll-lock-next-line) | |
36 (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
|
37 (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
|
38 (define-key map [remap backward-paragraph] 'scroll-lock-backward-paragraph) |
65035 | 39 map) |
40 "Keymap for Scroll Lock mode.") | |
41 | |
42 (defvar scroll-lock-preserve-screen-pos-save scroll-preserve-screen-position | |
43 "Used for saving the state of `scroll-preserve-screen-position'.") | |
44 (make-variable-buffer-local 'scroll-lock-preserve-screen-pos-save) | |
45 | |
46 (defvar scroll-lock-temporary-goal-column 0 | |
47 "Like `temporary-goal-column' but for scroll-lock-* commands.") | |
48 | |
49 ;;;###autoload | |
50 (define-minor-mode scroll-lock-mode | |
78002
a55abbc28a7f
(scroll-lock-mode): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
75347
diff
changeset
|
51 "Buffer-local minor mode for pager-like scrolling. |
65035 | 52 Keys which normally move point by line or paragraph will scroll |
53 the buffer by the respective amount of lines instead and point | |
54 will be kept vertically fixed relative to window boundaries | |
55 during scrolling." | |
56 :lighter " ScrLck" | |
57 :keymap scroll-lock-mode-map | |
58 (if scroll-lock-mode | |
59 (progn | |
60 (setq scroll-lock-preserve-screen-pos-save | |
61 scroll-preserve-screen-position) | |
62 (set (make-local-variable 'scroll-preserve-screen-position) 'always)) | |
63 (setq scroll-preserve-screen-position | |
64 scroll-lock-preserve-screen-pos-save))) | |
65 | |
66 (defun scroll-lock-update-goal-column () | |
67 "Update `scroll-lock-temporary-goal-column' if necessary." | |
68 (unless (memq last-command '(scroll-lock-next-line | |
69 scroll-lock-previous-line | |
70 scroll-lock-forward-paragraph | |
71 scroll-lock-backward-paragraph)) | |
72 (setq scroll-lock-temporary-goal-column (current-column)))) | |
73 | |
74 (defun scroll-lock-move-to-column (column) | |
75 "Like `move-to-column' but cater for wrapped lines." | |
76 (if (or (bolp) | |
77 ;; Start of a screen line. | |
78 (not (zerop (mod (- (point) (line-beginning-position)) | |
79 (window-width))))) | |
80 (move-to-column column) | |
81 (forward-char (min column (- (line-end-position) (point)))))) | |
82 | |
83 (defun scroll-lock-next-line (&optional arg) | |
84 "Scroll up ARG lines keeping point fixed." | |
85 (interactive "p") | |
86 (or arg (setq arg 1)) | |
87 (scroll-lock-update-goal-column) | |
88 (if (pos-visible-in-window-p (point-max)) | |
85478
786d3a985758
* term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
89 (forward-line arg) |
65035 | 90 (scroll-up arg)) |
91 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
92 | |
93 (defun scroll-lock-previous-line (&optional arg) | |
94 "Scroll up ARG lines keeping point fixed." | |
95 (interactive "p") | |
96 (or arg (setq arg 1)) | |
97 (scroll-lock-update-goal-column) | |
98 (condition-case nil | |
99 (scroll-down arg) | |
85478
786d3a985758
* term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
100 (beginning-of-buffer (forward-line (- arg)))) |
65035 | 101 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) |
102 | |
103 (defun scroll-lock-forward-paragraph (&optional arg) | |
104 "Scroll down ARG paragraphs keeping point fixed." | |
105 (interactive "p") | |
106 (or arg (setq arg 1)) | |
107 (scroll-lock-update-goal-column) | |
108 (scroll-up (count-screen-lines (point) (save-excursion | |
109 (forward-paragraph arg) | |
110 (point)))) | |
111 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
112 | |
113 (defun scroll-lock-backward-paragraph (&optional arg) | |
114 "Scroll up ARG paragraphs keeping point fixed." | |
115 (interactive "p") | |
116 (or arg (setq arg 1)) | |
117 (scroll-lock-update-goal-column) | |
118 (let ((goal (save-excursion (backward-paragraph arg) (point)))) | |
119 (condition-case nil | |
120 (scroll-down (count-screen-lines goal (point))) | |
121 (beginning-of-buffer (goto-char goal)))) | |
122 (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) | |
123 | |
124 (provide 'scroll-lock) | |
125 | |
65125 | 126 ;; arch-tag: 148fc8e8-67e0-4638-bb34-3291595ab7e1 |
65035 | 127 ;;; scroll-lock.el ends here |