X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/b35f288d478ef137a4d9e8e5a6a5f368a86b01f5..4d1d41073faaee4a693520b82506801829fd0646:/lisp/simple.el diff --git a/lisp/simple.el b/lisp/simple.el index 885e2d5c97..20165ea7f3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -391,6 +391,25 @@ Other major modes are defined by comparison with this one." (unless delay-mode-hooks (run-hooks 'after-change-major-mode-hook))) +;; Special major modes to view specially formatted data rather than files. + +(defvar special-mode-map + (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (define-key map "q" 'quit-window) + (define-key map " " 'scroll-up) + (define-key map "\C-?" 'scroll-down) + (define-key map "?" 'describe-mode) + (define-key map ">" 'end-of-buffer) + (define-key map "<" 'beginning-of-buffer) + (define-key map "g" 'revert-buffer) + map)) + +(put 'special-mode 'mode-class 'special) +(define-derived-mode special-mode nil "Special" + "Parent major mode from which special major modes should inherit." + (setq buffer-read-only t)) + ;; Making and deleting lines. (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))) @@ -2818,7 +2837,7 @@ move the yanking point; just return the Nth kill forward." "Kill (\"cut\") text between point and mark. This deletes the text from the buffer and saves it in the kill ring. The command \\[yank] can retrieve it from there. -\(If you want to kill and then yank immediately, use \\[kill-ring-save].) +\(If you want to save the region without killing it, use \\[kill-ring-save].) If you want to append the killed region to the last killed text, use \\[append-next-kill] before \\[kill-region]. @@ -4059,13 +4078,20 @@ Outline mode sets this." (= arg 0)) (cond ((> arg 0) - ;; If we did not move down as far as desired, - ;; at least go to end of line. - (end-of-line)) + ;; If we did not move down as far as desired, at least go + ;; to end of line. Be sure to call point-entered and + ;; point-left-hooks. + (let* ((npoint (prog1 (line-end-position) + (goto-char opoint))) + (inhibit-point-motion-hooks nil)) + (goto-char npoint))) ((< arg 0) ;; If we did not move up as far as desired, ;; at least go to beginning of line. - (beginning-of-line)) + (let* ((npoint (prog1 (line-beginning-position) + (goto-char opoint))) + (inhibit-point-motion-hooks nil)) + (goto-char npoint))) (t (line-move-finish (or goal-column temporary-goal-column) opoint (> orig-arg 0)))))))