489 |
(setq start (point)) |
(setq start (point)) |
490 |
(goto-char opoint) |
(goto-char opoint) |
491 |
(forward-line 0) |
(forward-line 0) |
492 |
(if (/= start 1) |
(if (/= start (point-min)) |
493 |
(message "line %d (narrowed line %d)" |
(message "line %d (narrowed line %d)" |
494 |
(1+ (count-lines 1 (point))) |
(1+ (count-lines (point-min) (point))) |
495 |
(1+ (count-lines start (point)))) |
(1+ (count-lines start (point)))) |
496 |
(message "Line %d" (1+ (count-lines 1 (point))))))))) |
(message "Line %d" (1+ (count-lines (point-min) (point))))))))) |
497 |
|
|
498 |
(defun count-lines (start end) |
(defun count-lines (start end) |
499 |
"Return number of lines between START and END. |
"Return number of lines between START and END. |
1958 |
"Reinsert the last stretch of killed text. |
"Reinsert the last stretch of killed text. |
1959 |
More precisely, reinsert the stretch of killed text most recently |
More precisely, reinsert the stretch of killed text most recently |
1960 |
killed OR yanked. Put point at end, and set mark at beginning. |
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). |
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 |
With argument N, reinsert the Nth most recently killed stretch of killed |
1963 |
text. |
text. |
1964 |
See also the command \\[yank-pop]." |
See also the command \\[yank-pop]." |
2484 |
(goto-char omark) |
(goto-char omark) |
2485 |
nil))) |
nil))) |
2486 |
|
|
2487 |
(defun transient-mark-mode (arg) |
(define-minor-mode transient-mark-mode |
2488 |
"Toggle Transient Mark mode. |
"Toggle Transient Mark mode. |
2489 |
With arg, turn Transient Mark mode on if arg is positive, off otherwise. |
With arg, turn Transient Mark mode on if arg is positive, off otherwise. |
2490 |
|
|
2505 |
\\[apropos-documentation] and type \"transient\" or \"mark.*active\" at |
\\[apropos-documentation] and type \"transient\" or \"mark.*active\" at |
2506 |
the prompt, to see the documentation of commands which are sensitive to |
the prompt, to see the documentation of commands which are sensitive to |
2507 |
the Transient Mark mode." |
the Transient Mark mode." |
2508 |
(interactive "P") |
:global t :group 'editing-basics) |
|
(setq transient-mark-mode |
|
|
(if (null arg) |
|
|
(not transient-mark-mode) |
|
|
(> (prefix-numeric-value arg) 0))) |
|
|
(if (interactive-p) |
|
|
(if transient-mark-mode |
|
|
(message "Transient Mark mode enabled") |
|
|
(message "Transient Mark mode disabled")))) |
|
2509 |
|
|
2510 |
(defun pop-global-mark () |
(defun pop-global-mark () |
2511 |
"Pop off global mark ring and jump to the top location." |
"Pop off global mark ring and jump to the top location." |
3084 |
(save-excursion (forward-paragraph 1) (point))))) |
(save-excursion (forward-paragraph 1) (point))))) |
3085 |
(and prefix (not (equal prefix "")) |
(and prefix (not (equal prefix "")) |
3086 |
;; Use auto-indentation rather than a guessed empty prefix. |
;; Use auto-indentation rather than a guessed empty prefix. |
3087 |
(not (and fill-indent-according-to-mode |
(not (and (fill-indent-according-to-mode) |
3088 |
(string-match "[ \t]*" prefix))) |
(string-match "\\`[ \t]*\\'" prefix))) |
3089 |
(setq fill-prefix prefix)))) |
(setq fill-prefix prefix)))) |
3090 |
|
|
3091 |
(while (and (not give-up) (> (current-column) fc)) |
(while (and (not give-up) (> (current-column) fc)) |
3152 |
"The function to use for `auto-fill-function' if Auto Fill mode is turned on. |
"The function to use for `auto-fill-function' if Auto Fill mode is turned on. |
3153 |
Some major modes set this.") |
Some major modes set this.") |
3154 |
|
|
3155 |
|
;; FIXME: turn into a proper minor mode. |
3156 |
|
;; Add a global minor mode version of it. |
3157 |
(defun auto-fill-mode (&optional arg) |
(defun auto-fill-mode (&optional arg) |
3158 |
"Toggle Auto Fill mode. |
"Toggle Auto Fill mode. |
3159 |
With arg, turn Auto Fill mode on if and only if arg is positive. |
With arg, turn Auto Fill mode on if and only if arg is positive. |
3276 |
'overwrite-mode-binary)) |
'overwrite-mode-binary)) |
3277 |
(force-mode-line-update)) |
(force-mode-line-update)) |
3278 |
|
|
3279 |
(defcustom line-number-mode t |
(define-minor-mode line-number-mode |
|
"*Non-nil means display line number in mode line." |
|
|
:type 'boolean |
|
|
:group 'editing-basics) |
|
|
|
|
|
(defun line-number-mode (arg) |
|
3280 |
"Toggle Line Number mode. |
"Toggle Line Number mode. |
3281 |
With arg, turn Line Number mode on iff arg is positive. |
With arg, turn Line Number mode on iff arg is positive. |
3282 |
When Line Number mode is enabled, the line number appears |
When Line Number mode is enabled, the line number appears |
3285 |
Line numbers do not appear for very large buffers and buffers |
Line numbers do not appear for very large buffers and buffers |
3286 |
with very long lines; see variables `line-number-display-limit' |
with very long lines; see variables `line-number-display-limit' |
3287 |
and `line-number-display-limit-width'." |
and `line-number-display-limit-width'." |
3288 |
(interactive "P") |
:init-value t :global t :group 'editing-basics) |
|
(setq line-number-mode |
|
|
(if (null arg) (not line-number-mode) |
|
|
(> (prefix-numeric-value arg) 0))) |
|
|
(force-mode-line-update)) |
|
|
|
|
|
(defcustom column-number-mode nil |
|
|
"*Non-nil means display column number in mode line." |
|
|
:type 'boolean |
|
|
:group 'editing-basics) |
|
3289 |
|
|
3290 |
(defun column-number-mode (arg) |
(define-minor-mode column-number-mode |
3291 |
"Toggle Column Number mode. |
"Toggle Column Number mode. |
3292 |
With arg, turn Column Number mode on iff arg is positive. |
With arg, turn Column Number mode on iff arg is positive. |
3293 |
When Column Number mode is enabled, the column number appears |
When Column Number mode is enabled, the column number appears |
3294 |
in the mode line." |
in the mode line." |
3295 |
(interactive "P") |
:global t :group 'editing-basics) |
|
(setq column-number-mode |
|
|
(if (null arg) (not column-number-mode) |
|
|
(> (prefix-numeric-value arg) 0))) |
|
|
(force-mode-line-update)) |
|
3296 |
|
|
3297 |
(defgroup paren-blinking nil |
(defgroup paren-blinking nil |
3298 |
"Blinking matching of parens and expressions." |
"Blinking matching of parens and expressions." |
3856 |
;; or completion-no-auto-exit is non-nil. |
;; or completion-no-auto-exit is non-nil. |
3857 |
|
|
3858 |
(let ((buffer (or buffer completion-reference-buffer)) |
(let ((buffer (or buffer completion-reference-buffer)) |
3859 |
(mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" (buffer-name buffer)))) |
(mini-p (string-match "\\` \\*Minibuf-[0-9]+\\*\\'" |
3860 |
|
(buffer-name buffer)))) |
3861 |
;; If BUFFER is a minibuffer, barf unless it's the currently |
;; If BUFFER is a minibuffer, barf unless it's the currently |
3862 |
;; active minibuffer. |
;; active minibuffer. |
3863 |
(if (and mini-p |
(if (and mini-p |
3866 |
(window-buffer (active-minibuffer-window)))))) |
(window-buffer (active-minibuffer-window)))))) |
3867 |
(error "Minibuffer is not active for completion") |
(error "Minibuffer is not active for completion") |
3868 |
(unless (run-hook-with-args-until-success |
(unless (run-hook-with-args-until-success |
3869 |
'choose-completion-string-functions choice buffer mini-p base-size) |
'choose-completion-string-functions |
3870 |
;; Insert the completion into the buffer where completion was requested. |
choice buffer mini-p base-size) |
3871 |
|
;; Insert the completion into the buffer where it was requested. |
3872 |
(set-buffer buffer) |
(set-buffer buffer) |
3873 |
(if base-size |
(if base-size |
3874 |
(delete-region (+ base-size (if mini-p |
(delete-region (+ base-size (if mini-p |