diff options
| author | Sam Steingold | 1999-11-15 16:11:14 +0000 |
|---|---|---|
| committer | Sam Steingold | 1999-11-15 16:11:14 +0000 |
| commit | 1e722f9f1861bc50b52baaa0e42c607de1f124c2 (patch) | |
| tree | 56d4b46d54ef0cf4f2acf2e661e825c53544ef09 | |
| parent | b787fc059e638aa08d18aa45ad30b77af50f5232 (diff) | |
| download | emacs-1e722f9f1861bc50b52baaa0e42c607de1f124c2.tar.gz emacs-1e722f9f1861bc50b52baaa0e42c607de1f124c2.zip | |
* simple.el (backward-delete-char-untabify):
backward-delete-char-untabify-method can be `all' now - to delete
hungrily including newlines.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/simple.el | 58 |
2 files changed, 37 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c542e098583..55214b1b408 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 1998-11-03 Sam Steingold <sds@goems.com> | ||
| 2 | |||
| 3 | * simple.el (backward-delete-char-untabify): | ||
| 4 | backward-delete-char-untabify-method can be `all' now - to delete | ||
| 5 | hungrily including newlines. | ||
| 6 | |||
| 1 | 1999-11-15 Sam Steingold <sds@ksp.com> | 7 | 1999-11-15 Sam Steingold <sds@ksp.com> |
| 2 | 8 | ||
| 3 | * mail/rnews.el, mail/mh-utils.el: Use the new backquote syntax. | 9 | * mail/rnews.el, mail/mh-utils.el: Use the new backquote syntax. |
diff --git a/lisp/simple.el b/lisp/simple.el index aa2ab25aa90..b65e8b2ff99 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -60,7 +60,7 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long." | |||
| 60 | ;; try_window_id than inserting at the beginning of a line, and the textual | 60 | ;; try_window_id than inserting at the beginning of a line, and the textual |
| 61 | ;; result is the same. So, if we're at beginning of line, pretend to be at | 61 | ;; result is the same. So, if we're at beginning of line, pretend to be at |
| 62 | ;; the end of the previous line. | 62 | ;; the end of the previous line. |
| 63 | (let ((flag (and (not (bobp)) | 63 | (let ((flag (and (not (bobp)) |
| 64 | (bolp) | 64 | (bolp) |
| 65 | ;; Make sure no functions want to be told about | 65 | ;; Make sure no functions want to be told about |
| 66 | ;; the range of the changes. | 66 | ;; the range of the changes. |
| @@ -85,7 +85,7 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long." | |||
| 85 | (not (get-char-property (1- (point)) 'invisible)) | 85 | (not (get-char-property (1- (point)) 'invisible)) |
| 86 | ;; Make sure the newline before point has the same | 86 | ;; Make sure the newline before point has the same |
| 87 | ;; properties as the char before it (if any). | 87 | ;; properties as the char before it (if any). |
| 88 | (< (or (previous-property-change (point)) -2) | 88 | (< (or (previous-property-change (point)) -2) |
| 89 | (- (point) 2)))) | 89 | (- (point) 2)))) |
| 90 | (was-page-start (and (bolp) | 90 | (was-page-start (and (bolp) |
| 91 | (looking-at page-delimiter))) | 91 | (looking-at page-delimiter))) |
| @@ -932,7 +932,7 @@ that apply to text between BEG and END are used; other undo elements | |||
| 932 | are ignored. If BEG and END are nil, all undo elements are used." | 932 | are ignored. If BEG and END are nil, all undo elements are used." |
| 933 | (if (eq buffer-undo-list t) | 933 | (if (eq buffer-undo-list t) |
| 934 | (error "No undo information in this buffer")) | 934 | (error "No undo information in this buffer")) |
| 935 | (setq pending-undo-list | 935 | (setq pending-undo-list |
| 936 | (if (and beg end (not (= beg end))) | 936 | (if (and beg end (not (= beg end))) |
| 937 | (undo-make-selective-list (min beg end) (max beg end)) | 937 | (undo-make-selective-list (min beg end) (max beg end)) |
| 938 | buffer-undo-list))) | 938 | buffer-undo-list))) |
| @@ -993,7 +993,7 @@ we stop and ignore all further elements." | |||
| 993 | (let ((text-pos (abs (cdr undo-elt))) | 993 | (let ((text-pos (abs (cdr undo-elt))) |
| 994 | (point-at-end (< (cdr undo-elt) 0 ))) | 994 | (point-at-end (< (cdr undo-elt) 0 ))) |
| 995 | (if (>= text-pos position) | 995 | (if (>= text-pos position) |
| 996 | (setcdr undo-elt (* (if point-at-end -1 1) | 996 | (setcdr undo-elt (* (if point-at-end -1 1) |
| 997 | (- text-pos offset)))))) | 997 | (- text-pos offset)))))) |
| 998 | ((integerp (car undo-elt)) | 998 | ((integerp (car undo-elt)) |
| 999 | ;; (BEGIN . END) | 999 | ;; (BEGIN . END) |
| @@ -1136,7 +1136,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1136 | (if (and output-buffer | 1136 | (if (and output-buffer |
| 1137 | (not (or (bufferp output-buffer) (stringp output-buffer)))) | 1137 | (not (or (bufferp output-buffer) (stringp output-buffer)))) |
| 1138 | (let ((error-file | 1138 | (let ((error-file |
| 1139 | (if error-buffer | 1139 | (if error-buffer |
| 1140 | (make-temp-file | 1140 | (make-temp-file |
| 1141 | (expand-file-name "scor" | 1141 | (expand-file-name "scor" |
| 1142 | (or small-temporary-file-directory | 1142 | (or small-temporary-file-directory |
| @@ -1149,7 +1149,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1149 | ;; "if ($?prompt) exit" before things which are not useful | 1149 | ;; "if ($?prompt) exit" before things which are not useful |
| 1150 | ;; non-interactively. Besides, if someone wants their other | 1150 | ;; non-interactively. Besides, if someone wants their other |
| 1151 | ;; aliases for shell commands then they can still have them. | 1151 | ;; aliases for shell commands then they can still have them. |
| 1152 | (call-process shell-file-name nil | 1152 | (call-process shell-file-name nil |
| 1153 | (if error-file | 1153 | (if error-file |
| 1154 | (list t error-file) | 1154 | (list t error-file) |
| 1155 | t) | 1155 | t) |
| @@ -1197,7 +1197,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1197 | (erase-buffer) | 1197 | (erase-buffer) |
| 1198 | (display-buffer buffer) | 1198 | (display-buffer buffer) |
| 1199 | (setq default-directory directory) | 1199 | (setq default-directory directory) |
| 1200 | (setq proc (start-process "Shell" buffer shell-file-name | 1200 | (setq proc (start-process "Shell" buffer shell-file-name |
| 1201 | shell-command-switch command)) | 1201 | shell-command-switch command)) |
| 1202 | (setq mode-line-process '(":%s")) | 1202 | (setq mode-line-process '(":%s")) |
| 1203 | (require 'shell) (shell-mode) | 1203 | (require 'shell) (shell-mode) |
| @@ -1210,7 +1210,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1210 | ;; in the buffer itself. | 1210 | ;; in the buffer itself. |
| 1211 | (defun shell-command-sentinel (process signal) | 1211 | (defun shell-command-sentinel (process signal) |
| 1212 | (if (memq (process-status process) '(exit signal)) | 1212 | (if (memq (process-status process) '(exit signal)) |
| 1213 | (message "%s: %s." | 1213 | (message "%s: %s." |
| 1214 | (car (cdr (cdr (process-command process)))) | 1214 | (car (cdr (cdr (process-command process)))) |
| 1215 | (substring signal 0 -1)))) | 1215 | (substring signal 0 -1)))) |
| 1216 | 1216 | ||
| @@ -1312,7 +1312,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1312 | (delete-region (point-min) (min start end)) | 1312 | (delete-region (point-min) (min start end)) |
| 1313 | (setq exit-status | 1313 | (setq exit-status |
| 1314 | (call-process-region (point-min) (point-max) | 1314 | (call-process-region (point-min) (point-max) |
| 1315 | shell-file-name t | 1315 | shell-file-name t |
| 1316 | (if error-file | 1316 | (if error-file |
| 1317 | (list t error-file) | 1317 | (list t error-file) |
| 1318 | t) | 1318 | t) |
| @@ -1356,7 +1356,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1356 | (goto-char (point-min)) | 1356 | (goto-char (point-min)) |
| 1357 | (buffer-substring (point) | 1357 | (buffer-substring (point) |
| 1358 | (progn (end-of-line) (point)))))) | 1358 | (progn (end-of-line) (point)))))) |
| 1359 | (t | 1359 | (t |
| 1360 | (save-excursion | 1360 | (save-excursion |
| 1361 | (set-buffer buffer) | 1361 | (set-buffer buffer) |
| 1362 | (goto-char (point-min))) | 1362 | (goto-char (point-min))) |
| @@ -1376,7 +1376,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1376 | (display-buffer (current-buffer)))) | 1376 | (display-buffer (current-buffer)))) |
| 1377 | (delete-file error-file)) | 1377 | (delete-file error-file)) |
| 1378 | exit-status)) | 1378 | exit-status)) |
| 1379 | 1379 | ||
| 1380 | (defun shell-command-to-string (command) | 1380 | (defun shell-command-to-string (command) |
| 1381 | "Execute shell command COMMAND and return its output as a string." | 1381 | "Execute shell command COMMAND and return its output as a string." |
| 1382 | (with-output-to-string | 1382 | (with-output-to-string |
| @@ -1576,7 +1576,7 @@ it." | |||
| 1576 | If N is zero, `interprogram-paste-function' is set, and calling it | 1576 | If N is zero, `interprogram-paste-function' is set, and calling it |
| 1577 | returns a string, then that string is added to the front of the | 1577 | returns a string, then that string is added to the front of the |
| 1578 | kill ring and returned as the latest kill. | 1578 | kill ring and returned as the latest kill. |
| 1579 | If optional arg DO-NOT-MOVE is non-nil, then don't actually move the | 1579 | If optional arg DO-NOT-MOVE is non-nil, then don't actually move the |
| 1580 | yanking point; just return the Nth kill forward." | 1580 | yanking point; just return the Nth kill forward." |
| 1581 | (let ((interprogram-paste (and (= n 0) | 1581 | (let ((interprogram-paste (and (= n 0) |
| 1582 | interprogram-paste-function | 1582 | interprogram-paste-function |
| @@ -1682,7 +1682,7 @@ system cut and paste." | |||
| 1682 | (if (eq last-command 'kill-region) | 1682 | (if (eq last-command 'kill-region) |
| 1683 | (kill-append (buffer-substring beg end) (< end beg)) | 1683 | (kill-append (buffer-substring beg end) (< end beg)) |
| 1684 | (kill-new (buffer-substring beg end))) | 1684 | (kill-new (buffer-substring beg end))) |
| 1685 | (if transient-mark-mode | 1685 | (if transient-mark-mode |
| 1686 | (setq deactivate-mark t)) | 1686 | (setq deactivate-mark t)) |
| 1687 | nil) | 1687 | nil) |
| 1688 | 1688 | ||
| @@ -1822,10 +1822,11 @@ With argument, rotate that many kills forward (or backward, if negative)." | |||
| 1822 | 1822 | ||
| 1823 | (defcustom backward-delete-char-untabify-method 'untabify | 1823 | (defcustom backward-delete-char-untabify-method 'untabify |
| 1824 | "*The method for untabifying when deleting backward. | 1824 | "*The method for untabifying when deleting backward. |
| 1825 | Can be `untabify' -- turn a tab to many spaces, then delete one space. | 1825 | Can be `untabify' -- turn a tab to many spaces, then delete one space; |
| 1826 | `hungry' -- delete all whitespace, both tabs and spaces. | 1826 | `hungry' -- delete all whitespace, both tabs and spaces; |
| 1827 | `all' -- delete all whitespace, including tabs, spaces and newlines; | ||
| 1827 | nil -- just delete one character." | 1828 | nil -- just delete one character." |
| 1828 | :type '(choice (const untabify) (const hungry) (const nil)) | 1829 | :type '(choice (const untabify) (const hungry) (const all) (const nil)) |
| 1829 | :group 'killing) | 1830 | :group 'killing) |
| 1830 | 1831 | ||
| 1831 | (defun backward-delete-char-untabify (arg &optional killp) | 1832 | (defun backward-delete-char-untabify (arg &optional killp) |
| @@ -1848,11 +1849,14 @@ and KILLP is t if a prefix arg was specified." | |||
| 1848 | (forward-char -1) | 1849 | (forward-char -1) |
| 1849 | (setq count (1- count)))))) | 1850 | (setq count (1- count)))))) |
| 1850 | (delete-backward-char | 1851 | (delete-backward-char |
| 1851 | (if (eq backward-delete-char-untabify-method 'hungry) | 1852 | (let ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t") |
| 1852 | (let ((wh (- (point) (save-excursion (skip-chars-backward " \t") | 1853 | ((eq backward-delete-char-untabify-method 'all) |
| 1854 | " \t\n\r")))) | ||
| 1855 | (if skip | ||
| 1856 | (let ((wh (- (point) (save-excursion (skip-chars-backward skip) | ||
| 1853 | (point))))) | 1857 | (point))))) |
| 1854 | (+ arg (if (zerop wh) 0 (1- wh)))) | 1858 | (+ arg (if (zerop wh) 0 (1- wh)))) |
| 1855 | arg) | 1859 | arg)) |
| 1856 | killp)) | 1860 | killp)) |
| 1857 | 1861 | ||
| 1858 | (defun zap-to-char (arg char) | 1862 | (defun zap-to-char (arg char) |
| @@ -2714,7 +2718,7 @@ If nil, use `comment-end' instead." | |||
| 2714 | (delete-region (point) begpos) | 2718 | (delete-region (point) begpos) |
| 2715 | (indent-to indent)) | 2719 | (indent-to indent)) |
| 2716 | ;; An existing comment? | 2720 | ;; An existing comment? |
| 2717 | (if cpos | 2721 | (if cpos |
| 2718 | (progn (goto-char cpos) | 2722 | (progn (goto-char cpos) |
| 2719 | (set-marker cpos nil)) | 2723 | (set-marker cpos nil)) |
| 2720 | ;; No, insert one. | 2724 | ;; No, insert one. |
| @@ -2973,7 +2977,7 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 2973 | (null (setq fc (current-fill-column))) | 2977 | (null (setq fc (current-fill-column))) |
| 2974 | (and (eq justify 'left) | 2978 | (and (eq justify 'left) |
| 2975 | (<= (current-column) fc)) | 2979 | (<= (current-column) fc)) |
| 2976 | (save-excursion (beginning-of-line) | 2980 | (save-excursion (beginning-of-line) |
| 2977 | (setq bol (point)) | 2981 | (setq bol (point)) |
| 2978 | (and auto-fill-inhibit-regexp | 2982 | (and auto-fill-inhibit-regexp |
| 2979 | (looking-at auto-fill-inhibit-regexp)))) | 2983 | (looking-at auto-fill-inhibit-regexp)))) |
| @@ -3087,7 +3091,7 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 3087 | (funcall comment-line-break-function t))) | 3091 | (funcall comment-line-break-function t))) |
| 3088 | ;; Now do justification, if required | 3092 | ;; Now do justification, if required |
| 3089 | (if (not (eq justify 'left)) | 3093 | (if (not (eq justify 'left)) |
| 3090 | (save-excursion | 3094 | (save-excursion |
| 3091 | (end-of-line 0) | 3095 | (end-of-line 0) |
| 3092 | (justify-current-line justify nil t))) | 3096 | (justify-current-line justify nil t))) |
| 3093 | ;; If making the new line didn't reduce the hpos of | 3097 | ;; If making the new line didn't reduce the hpos of |
| @@ -3099,7 +3103,7 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 3099 | (setq give-up t)))) | 3103 | (setq give-up t)))) |
| 3100 | ;; Justify last line. | 3104 | ;; Justify last line. |
| 3101 | (justify-current-line justify t t) | 3105 | (justify-current-line justify t t) |
| 3102 | t))) | 3106 | t))) |
| 3103 | 3107 | ||
| 3104 | (defvar normal-auto-fill-function 'do-auto-fill | 3108 | (defvar normal-auto-fill-function 'do-auto-fill |
| 3105 | "The function to use for `auto-fill-function' if Auto Fill mode is turned on. | 3109 | "The function to use for `auto-fill-function' if Auto Fill mode is turned on. |
| @@ -3164,7 +3168,7 @@ If you want to continue one comment across several lines, use \\[newline-and-ind | |||
| 3164 | If a fill column is specified, it overrides the use of the comment column | 3168 | If a fill column is specified, it overrides the use of the comment column |
| 3165 | or comment indentation. | 3169 | or comment indentation. |
| 3166 | 3170 | ||
| 3167 | The inserted newline is marked hard if `use-hard-newlines' is true, | 3171 | The inserted newline is marked hard if `use-hard-newlines' is true, |
| 3168 | unless optional argument SOFT is non-nil." | 3172 | unless optional argument SOFT is non-nil." |
| 3169 | (interactive) | 3173 | (interactive) |
| 3170 | (let (comcol comstart) | 3174 | (let (comcol comstart) |
| @@ -3698,7 +3702,7 @@ in the definition is used to check that VALUE is valid." | |||
| 3698 | (require 'wid-edit) | 3702 | (require 'wid-edit) |
| 3699 | (setq type (widget-convert type)) | 3703 | (setq type (widget-convert type)) |
| 3700 | (unless (widget-apply type :match val) | 3704 | (unless (widget-apply type :match val) |
| 3701 | (error "Value `%S' does not match type %S of %S" | 3705 | (error "Value `%S' does not match type %S of %S" |
| 3702 | val (car type) var)))) | 3706 | val (car type) var)))) |
| 3703 | (set var val)) | 3707 | (set var val)) |
| 3704 | 3708 | ||
| @@ -4031,9 +4035,9 @@ PREFIX is the string that represents this modifier in an event type symbol." | |||
| 4031 | (kp-divide ?/) | 4035 | (kp-divide ?/) |
| 4032 | (kp-equal ?=))) | 4036 | (kp-equal ?=))) |
| 4033 | 4037 | ||
| 4034 | ;;;; | 4038 | ;;;; |
| 4035 | ;;;; forking a twin copy of a buffer. | 4039 | ;;;; forking a twin copy of a buffer. |
| 4036 | ;;;; | 4040 | ;;;; |
| 4037 | 4041 | ||
| 4038 | (defvar clone-buffer-hook nil | 4042 | (defvar clone-buffer-hook nil |
| 4039 | "Normal hook to run in the new buffer at the end of `clone-buffer'.") | 4043 | "Normal hook to run in the new buffer at the end of `clone-buffer'.") |