diff options
| author | Stefan Monnier | 2002-09-09 22:09:14 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-09-09 22:09:14 +0000 |
| commit | d99f84968173f9dc32b34cd6ff1dd1fa1e2080b1 (patch) | |
| tree | 0e1b26063ad505128b4d600394391f100f22a80d | |
| parent | f77a605054bbfbeb450701fdc5b4ed12acd3d9d5 (diff) | |
| download | emacs-d99f84968173f9dc32b34cd6ff1dd1fa1e2080b1.tar.gz emacs-d99f84968173f9dc32b34cd6ff1dd1fa1e2080b1.zip | |
(what-line): Don't hard-code 1.
(transient-mark-mode, line-number-mode, column-number-mode):
Use define-minor-mode.
(do-auto-fill): Only ignore prefix if it's really empty.
| -rw-r--r-- | lisp/simple.el | 60 |
1 files changed, 19 insertions, 41 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index d9ae114a2e0..79c3e561af6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -489,11 +489,11 @@ that uses or sets the mark." | |||
| 489 | (setq start (point)) | 489 | (setq start (point)) |
| 490 | (goto-char opoint) | 490 | (goto-char opoint) |
| 491 | (forward-line 0) | 491 | (forward-line 0) |
| 492 | (if (/= start 1) | 492 | (if (/= start (point-min)) |
| 493 | (message "line %d (narrowed line %d)" | 493 | (message "line %d (narrowed line %d)" |
| 494 | (1+ (count-lines 1 (point))) | 494 | (1+ (count-lines (point-min) (point))) |
| 495 | (1+ (count-lines start (point)))) | 495 | (1+ (count-lines start (point)))) |
| 496 | (message "Line %d" (1+ (count-lines 1 (point))))))))) | 496 | (message "Line %d" (1+ (count-lines (point-min) (point))))))))) |
| 497 | 497 | ||
| 498 | (defun count-lines (start end) | 498 | (defun count-lines (start end) |
| 499 | "Return number of lines between START and END. | 499 | "Return number of lines between START and END. |
| @@ -1958,7 +1958,7 @@ comes the newest one." | |||
| 1958 | "Reinsert the last stretch of killed text. | 1958 | "Reinsert the last stretch of killed text. |
| 1959 | More precisely, reinsert the stretch of killed text most recently | 1959 | More precisely, reinsert the stretch of killed text most recently |
| 1960 | killed OR yanked. Put point at end, and set mark at beginning. | 1960 | killed OR yanked. Put point at end, and set mark at beginning. |
| 1961 | With just C-u as argument, same but put point at beginning (and mark at end). | 1961 | With just \\[universal-argument] as argument, same but put point at beginning (and mark at end). |
| 1962 | With argument N, reinsert the Nth most recently killed stretch of killed | 1962 | With argument N, reinsert the Nth most recently killed stretch of killed |
| 1963 | text. | 1963 | text. |
| 1964 | See also the command \\[yank-pop]." | 1964 | See also the command \\[yank-pop]." |
| @@ -2484,7 +2484,7 @@ With prefix arg, `transient-mark-mode' is enabled temporarily." | |||
| 2484 | (goto-char omark) | 2484 | (goto-char omark) |
| 2485 | nil))) | 2485 | nil))) |
| 2486 | 2486 | ||
| 2487 | (defun transient-mark-mode (arg) | 2487 | (define-minor-mode transient-mark-mode |
| 2488 | "Toggle Transient Mark mode. | 2488 | "Toggle Transient Mark mode. |
| 2489 | With arg, turn Transient Mark mode on if arg is positive, off otherwise. | 2489 | With arg, turn Transient Mark mode on if arg is positive, off otherwise. |
| 2490 | 2490 | ||
| @@ -2505,15 +2505,7 @@ default part of the buffer's text. Examples of such commands include | |||
| 2505 | \\[apropos-documentation] and type \"transient\" or \"mark.*active\" at | 2505 | \\[apropos-documentation] and type \"transient\" or \"mark.*active\" at |
| 2506 | the prompt, to see the documentation of commands which are sensitive to | 2506 | the prompt, to see the documentation of commands which are sensitive to |
| 2507 | the Transient Mark mode." | 2507 | the Transient Mark mode." |
| 2508 | (interactive "P") | 2508 | :global t :group 'editing-basics) |
| 2509 | (setq transient-mark-mode | ||
| 2510 | (if (null arg) | ||
| 2511 | (not transient-mark-mode) | ||
| 2512 | (> (prefix-numeric-value arg) 0))) | ||
| 2513 | (if (interactive-p) | ||
| 2514 | (if transient-mark-mode | ||
| 2515 | (message "Transient Mark mode enabled") | ||
| 2516 | (message "Transient Mark mode disabled")))) | ||
| 2517 | 2509 | ||
| 2518 | (defun pop-global-mark () | 2510 | (defun pop-global-mark () |
| 2519 | "Pop off global mark ring and jump to the top location." | 2511 | "Pop off global mark ring and jump to the top location." |
| @@ -3092,8 +3084,8 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 3092 | (save-excursion (forward-paragraph 1) (point))))) | 3084 | (save-excursion (forward-paragraph 1) (point))))) |
| 3093 | (and prefix (not (equal prefix "")) | 3085 | (and prefix (not (equal prefix "")) |
| 3094 | ;; Use auto-indentation rather than a guessed empty prefix. | 3086 | ;; Use auto-indentation rather than a guessed empty prefix. |
| 3095 | (not (and fill-indent-according-to-mode | 3087 | (not (and (fill-indent-according-to-mode) |
| 3096 | (string-match "[ \t]*" prefix))) | 3088 | (string-match "\\`[ \t]*\\'" prefix))) |
| 3097 | (setq fill-prefix prefix)))) | 3089 | (setq fill-prefix prefix)))) |
| 3098 | 3090 | ||
| 3099 | (while (and (not give-up) (> (current-column) fc)) | 3091 | (while (and (not give-up) (> (current-column) fc)) |
| @@ -3160,6 +3152,8 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 3160 | "The function to use for `auto-fill-function' if Auto Fill mode is turned on. | 3152 | "The function to use for `auto-fill-function' if Auto Fill mode is turned on. |
| 3161 | Some major modes set this.") | 3153 | Some major modes set this.") |
| 3162 | 3154 | ||
| 3155 | ;; FIXME: turn into a proper minor mode. | ||
| 3156 | ;; Add a global minor mode version of it. | ||
| 3163 | (defun auto-fill-mode (&optional arg) | 3157 | (defun auto-fill-mode (&optional arg) |
| 3164 | "Toggle Auto Fill mode. | 3158 | "Toggle Auto Fill mode. |
| 3165 | With arg, turn Auto Fill mode on if and only if arg is positive. | 3159 | With arg, turn Auto Fill mode on if and only if arg is positive. |
| @@ -3282,12 +3276,7 @@ specialization of overwrite-mode, entered by setting the | |||
| 3282 | 'overwrite-mode-binary)) | 3276 | 'overwrite-mode-binary)) |
| 3283 | (force-mode-line-update)) | 3277 | (force-mode-line-update)) |
| 3284 | 3278 | ||
| 3285 | (defcustom line-number-mode t | 3279 | (define-minor-mode line-number-mode |
| 3286 | "*Non-nil means display line number in mode line." | ||
| 3287 | :type 'boolean | ||
| 3288 | :group 'editing-basics) | ||
| 3289 | |||
| 3290 | (defun line-number-mode (arg) | ||
| 3291 | "Toggle Line Number mode. | 3280 | "Toggle Line Number mode. |
| 3292 | With arg, turn Line Number mode on iff arg is positive. | 3281 | With arg, turn Line Number mode on iff arg is positive. |
| 3293 | When Line Number mode is enabled, the line number appears | 3282 | When Line Number mode is enabled, the line number appears |
| @@ -3296,27 +3285,14 @@ in the mode line. | |||
| 3296 | Line numbers do not appear for very large buffers and buffers | 3285 | Line numbers do not appear for very large buffers and buffers |
| 3297 | with very long lines; see variables `line-number-display-limit' | 3286 | with very long lines; see variables `line-number-display-limit' |
| 3298 | and `line-number-display-limit-width'." | 3287 | and `line-number-display-limit-width'." |
| 3299 | (interactive "P") | 3288 | :init-value t :global t :group 'editing-basics) |
| 3300 | (setq line-number-mode | ||
| 3301 | (if (null arg) (not line-number-mode) | ||
| 3302 | (> (prefix-numeric-value arg) 0))) | ||
| 3303 | (force-mode-line-update)) | ||
| 3304 | |||
| 3305 | (defcustom column-number-mode nil | ||
| 3306 | "*Non-nil means display column number in mode line." | ||
| 3307 | :type 'boolean | ||
| 3308 | :group 'editing-basics) | ||
| 3309 | 3289 | ||
| 3310 | (defun column-number-mode (arg) | 3290 | (define-minor-mode column-number-mode |
| 3311 | "Toggle Column Number mode. | 3291 | "Toggle Column Number mode. |
| 3312 | With arg, turn Column Number mode on iff arg is positive. | 3292 | With arg, turn Column Number mode on iff arg is positive. |
| 3313 | When Column Number mode is enabled, the column number appears | 3293 | When Column Number mode is enabled, the column number appears |
| 3314 | in the mode line." | 3294 | in the mode line." |
| 3315 | (interactive "P") | 3295 | :global t :group 'editing-basics) |
| 3316 | (setq column-number-mode | ||
| 3317 | (if (null arg) (not column-number-mode) | ||
| 3318 | (> (prefix-numeric-value arg) 0))) | ||
| 3319 | (force-mode-line-update)) | ||
| 3320 | 3296 | ||
| 3321 | (defgroup paren-blinking nil | 3297 | (defgroup paren-blinking nil |
| 3322 | "Blinking matching of parens and expressions." | 3298 | "Blinking matching of parens and expressions." |
| @@ -3880,7 +3856,8 @@ to decide what to delete." | |||
| 3880 | ;; or completion-no-auto-exit is non-nil. | 3856 | ;; or completion-no-auto-exit is non-nil. |
| 3881 | 3857 | ||
| 3882 | (let ((buffer (or buffer completion-reference-buffer)) | 3858 | (let ((buffer (or buffer completion-reference-buffer)) |
| 3883 | (mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)))) | 3859 | (mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" |
| 3860 | (buffer-name buffer)))) | ||
| 3884 | ;; If BUFFER is a minibuffer, barf unless it's the currently | 3861 | ;; If BUFFER is a minibuffer, barf unless it's the currently |
| 3885 | ;; active minibuffer. | 3862 | ;; active minibuffer. |
| 3886 | (if (and mini-p | 3863 | (if (and mini-p |
| @@ -3889,8 +3866,9 @@ to decide what to delete." | |||
| 3889 | (window-buffer (active-minibuffer-window)))))) | 3866 | (window-buffer (active-minibuffer-window)))))) |
| 3890 | (error "Minibuffer is not active for completion") | 3867 | (error "Minibuffer is not active for completion") |
| 3891 | (unless (run-hook-with-args-until-success | 3868 | (unless (run-hook-with-args-until-success |
| 3892 | 'choose-completion-string-functions choice buffer mini-p base-size) | 3869 | 'choose-completion-string-functions |
| 3893 | ;; Insert the completion into the buffer where completion was requested. | 3870 | choice buffer mini-p base-size) |
| 3871 | ;; Insert the completion into the buffer where it was requested. | ||
| 3894 | (set-buffer buffer) | 3872 | (set-buffer buffer) |
| 3895 | (if base-size | 3873 | (if base-size |
| 3896 | (delete-region (+ base-size (if mini-p | 3874 | (delete-region (+ base-size (if mini-p |