aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey2004-08-31 16:31:03 +0000
committerKaroly Lorentey2004-08-31 16:31:03 +0000
commit8328a03d0cf23b4851e22e3c45d4d24106916766 (patch)
tree8c8f6f0a95f6fbc5b677193e936c31834e800bef /lisp
parentbfe3b03c6a537ffbdfa25e3b16acd40ae6a833ef (diff)
parent2aa2f8b8c979787390f8ebf6ebe22fa81bbe7c06 (diff)
downloademacs-8328a03d0cf23b4851e22e3c45d4d24106916766.tar.gz
emacs-8328a03d0cf23b4851e22e3c45d4d24106916766.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-509 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-510 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-511 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-512 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-513 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-514 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-515 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-516 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-517 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-518 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-239
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog96
-rw-r--r--lisp/calendar/time-date.el1
-rw-r--r--lisp/emacs-lisp/lisp-mode.el48
-rw-r--r--lisp/emulation/cua-base.el91
-rw-r--r--lisp/emulation/cua-rect.el388
-rw-r--r--lisp/ielm.el6
-rw-r--r--lisp/indent.el4
-rw-r--r--lisp/international/utf-8.el6
-rw-r--r--lisp/mh-e/ChangeLog35
-rw-r--r--lisp/mh-e/mh-acros.el13
-rw-r--r--lisp/mh-e/mh-customize.el7
-rw-r--r--lisp/mh-e/mh-e.el5
-rw-r--r--lisp/mh-e/mh-init.el4
-rw-r--r--lisp/mh-e/mh-loaddefs.el28
-rw-r--r--lisp/mh-e/mh-mime.el4
-rw-r--r--lisp/progmodes/etags.el20
-rw-r--r--lisp/progmodes/grep.el23
-rw-r--r--lisp/subr.el21
-rw-r--r--lisp/textmodes/tex-mode.el16
19 files changed, 537 insertions, 279 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a0dcde78786..e6b3e1f60a7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,92 @@
12004-08-30 John Paul Wallington <jpw@gnu.org>
2
3 * textmodes/tex-mode.el (tex-validate-buffer): Use distinct
4 strings rather than programatically constructing message.
5
62004-08-30 Richard M. Stallman <rms@gnu.org>
7
8 * emacs-lisp/lisp-mode.el (prin1-char): Don't turn S-a into A.
9 Don't return a string that would read as the wrong character code.
10
112004-08-29 Kim F. Storm <storm@cua.dk>
12
13 * emulation/cua-base.el (cua-auto-expand-rectangles): Remove
14 automatic rectangle padding feature; replace by non-destructive
15 virtual rectangle edges feature.
16 (cua-virtual-rectangle-edges): New defcustom.
17 (cua-auto-tabify-rectangles): New defcustom.
18 (cua-paste): If paste into a marked rectangle, insert rectangle at
19 current column, even if virtual; also paste exactly as many lines
20 as has been marked (ignore additional lines or add empty lines),
21 but paste whole source if only one line is marked.
22 (cua--update-indications): No longer use overwrite-cursor to
23 indicate rectangle padding
24
25 * emulation/cua-rect.el (cua--rectangle-padding): Remove.
26 (cua--rectangle-virtual-edges): New defun.
27 (cua--rectangle-get-corners): Remove optional PAD arg.
28 (cua--rectangle-set-corners): Never do padding.
29 (cua--forward-line): Remove optional PAD arg. Simplify.
30 (cua-resize-rectangle-right, cua-resize-rectangle-left)
31 (cua-resize-rectangle-down, cua-resize-rectangle-up):
32 (cua-resize-rectangle-bot, cua-resize-rectangle-top)
33 (cua-resize-rectangle-page-up, cua-resize-rectangle-page-down)
34 (cua--rectangle-move): Never do padding. Simplify.
35 (cua--tabify-start): New defun.
36 (cua--rectangle-operation): Add tabify arg. All callers changed.
37 (cua--pad-rectangle): Remove.
38 (cua--delete-rectangle): Handle delete with virtual edges.
39 (cua--extract-rectangle): Add spaces if rectangle has virtual edges.
40 (cua--insert-rectangle): Handle insert at virtual column.
41 Perform auto-tabify if necessary.
42 (cua--activate-rectangle): Remove optional FORCE arg.
43 Never do padding. Simplify.
44 (cua--highlight-rectangle): Enhance for virtual edges.
45 (cua-toggle-rectangle-padding): Remove command.
46 (cua-toggle-rectangle-virtual-edges): New command.
47 (cua-sequence-rectangle): Add optional TABIFY arg. Callers changed.
48 (cua--rectangle-post-command): Don't force rectangle padding.
49 (cua--init-rectangles): Bind M-p to cua-toggle-rectangle-virtual-edges.
50
512004-08-28 Luc Teirlinck <teirllm@auburn.edu>
52
53 * indent.el (edit-tab-stops-buffer): Doc fix.
54
552004-08-28 Richard M. Stallman <rms@gnu.org>
56
57 * progmodes/grep.el (grep-default-command): Use find-tag-default.
58 (grep-tag-default): Function deleted.
59
60 * subr.el (find-tag-default): Moved from etags.el.
61
62 * progmodes/etags.el (find-tag-default): Moved to subr.el.
63
64 * emacs-lisp/lisp-mode.el (prin1-char): Put `shift' modifier
65 into the basic character if it has an uppercase form.
66
672004-08-27 Kenichi Handa <handa@m17n.org>
68
69 * international/utf-8.el (utf-8-post-read-conversion): If the
70 buffer is unibyte, temporarily make it multibyte.
71
722004-08-27 Masatake YAMATO <jet@gyve.org>
73
74 * calendar/time-date.el (time-to-seconds): Add autoload cookies.
75
762004-08-25 John Paul Wallington <jpw@gnu.org>
77
78 * textmodes/tex-mode.el (tex-validate-buffer): Distinguish between
79 0, 1, and many mismatches in message.
80 (tex-start-shell): Use `set-process-query-on-exit-flag'.
81
82 * ielm.el (ielm-tab, ielm-complete-symbol): Doc fix.
83 (inferior-emacs-lisp-mode): Use `set-process-query-on-exit-flag'.
84
852004-08-23 Stefan Monnier <monnier@iro.umontreal.ca>
86
87 * vc-svn.el (vc-svn-diff): Treat options from vc-svn-diff-switches and
88 vc-diff-switches differently.
89
12004-08-22 Luc Teirlinck <teirllm@auburn.edu> 902004-08-22 Luc Teirlinck <teirllm@auburn.edu>
2 91
3 * speedbar.el (speedbar-file-regexp): Give it a phony defvar 92 * speedbar.el (speedbar-file-regexp): Give it a phony defvar
@@ -7,8 +96,8 @@
7 96
82004-08-22 Richard M. Stallman <rms@gnu.org> 972004-08-22 Richard M. Stallman <rms@gnu.org>
9 98
10 * textmodes/flyspell.el (flyspell-word): Use 99 * textmodes/flyspell.el (flyspell-word):
11 set-process-query-on-exit-flag. 100 Use set-process-query-on-exit-flag.
12 (flyspell-highlight-duplicate-region): Take POSS as arg. 101 (flyspell-highlight-duplicate-region): Take POSS as arg.
13 (flyspell-word): Pass POSS as arg. 102 (flyspell-word): Pass POSS as arg.
14 103
@@ -51,8 +140,7 @@
51 140
522004-08-22 Andreas Schwab <schwab@suse.de> 1412004-08-22 Andreas Schwab <schwab@suse.de>
53 142
54 * cvs-status.el: Require pcvs during byte-compiling for 143 * cvs-status.el: Require pcvs during byte-compiling for defun-cvs-mode.
55 defun-cvs-mode.
56 144
572004-08-22 Masatake YAMATO <jet@gyve.org> 1452004-08-22 Masatake YAMATO <jet@gyve.org>
58 146
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 846231befe6..6439089273a 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -45,6 +45,7 @@
45 (timezone-make-date-arpa-standard date))) 45 (timezone-make-date-arpa-standard date)))
46 (error (error "Invalid date: %s" date)))) 46 (error (error "Invalid date: %s" date))))
47 47
48;;;###autoload
48(defun time-to-seconds (time) 49(defun time-to-seconds (time)
49 "Convert time value TIME to a floating point number. 50 "Convert time value TIME to a floating point number.
50You can use `float-time' instead." 51You can use `float-time' instead."
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index df05555ae7b..e2aac327ddc 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -363,7 +363,7 @@ if that value is non-nil."
363 (when (stringp default) 363 (when (stringp default)
364 (if (string-match ":+" default) 364 (if (string-match ":+" default)
365 (substring default (match-end 0)) 365 (substring default (match-end 0))
366 default)))) 366 default))))
367 367
368;; Used in old LispM code. 368;; Used in old LispM code.
369(defalias 'common-lisp-mode 'lisp-mode) 369(defalias 'common-lisp-mode 'lisp-mode)
@@ -459,21 +459,37 @@ alternative printed representations that can be displayed."
459If CHAR is not a character, return nil." 459If CHAR is not a character, return nil."
460 (and (integerp char) 460 (and (integerp char)
461 (eventp char) 461 (eventp char)
462 (let ((c (event-basic-type char))) 462 (let ((c (event-basic-type char))
463 (concat 463 (mods (event-modifiers char))
464 "?" 464 string)
465 (mapconcat 465 ;; Prevent ?A from turning into ?\S-a.
466 (lambda (modif) 466 (if (and (memq 'shift mods)
467 (cond ((eq modif 'super) "\\s-") 467 (zerop (logand char ?\S-\^@))
468 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) 468 (not (let ((case-fold-search nil))
469 (event-modifiers char) "") 469 (char-equal c (upcase c)))))
470 (cond 470 (setq c (upcase c) mods nil))
471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) 471 ;; What string are we considering using?
472 ((eq c 127) "\\C-?") 472 (condition-case nil
473 (t 473 (setq string
474 (condition-case nil 474 (concat
475 (string c) 475 "?"
476 (error nil)))))))) 476 (mapconcat
477 (lambda (modif)
478 (cond ((eq modif 'super) "\\s-")
479 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-))))
480 mods "")
481 (cond
482 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
483 ((eq c 127) "\\C-?")
484 (t
485 (string c)))))
486 (error nil))
487 ;; Verify the string reads a CHAR, not to some other character.
488 ;; If it doesn't, return nil instead.
489 (and string
490 (= (car (read-from-string string)) char)
491 string))))
492
477 493
478(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) 494(defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
479 "Evaluate sexp before point; print value in minibuffer. 495 "Evaluate sexp before point; print value in minibuffer.
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index b39945c7712..fb3c537936f 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -141,30 +141,39 @@
141;; completely separate set of "rectangle commands" [C-x r ...] on the 141;; completely separate set of "rectangle commands" [C-x r ...] on the
142;; region to copy, kill, fill a.s.o. the virtual rectangle. 142;; region to copy, kill, fill a.s.o. the virtual rectangle.
143;; 143;;
144;; cua-mode's superior rectangle support is based on using a true visual 144;; cua-mode's superior rectangle support uses a true visual
145;; representation of the selected rectangle. To start a rectangle, use 145;; representation of the selected rectangle, i.e. it highlights the
146;; [S-return] and extend it using the normal movement keys (up, down, 146;; actual part of the buffer that is currently selected as part of the
147;; left, right, home, end, C-home, C-end). Once the rectangle has the 147;; rectangle. Unlike emacs' traditional rectangle commands, the
148;; desired size, you can cut or copy it using C-x and C-c (or C-w and M-w), 148;; selected rectangle always as straight left and right edges, even
149;; and you can subsequently insert it - as a rectangle - using C-v (or 149;; when those are in the middle of a TAB character or beyond the end
150;; C-y). So the only new command you need to know to work with 150;; of the current line. And it does this without actually modifying
151;; cua-mode rectangles is S-return! 151;; the buffer contents (it uses display overlays to visualize the
152;; virtual dimensions of the rectangle).
153;;
154;; This means that cua-mode's rectangles are not limited to the actual
155;; contents of the buffer, so if the cursor is currently at the end of a
156;; short line, you can still extend the rectangle to include more columns
157;; of longer lines in the same rectangle. And you can also have the
158;; left edge of a rectangle start in the middle of a TAB character.
159;; Sounds strange? Try it!
160;;
161;; To start a rectangle, use [S-return] and extend it using the normal
162;; movement keys (up, down, left, right, home, end, C-home,
163;; C-end). Once the rectangle has the desired size, you can cut or
164;; copy it using C-x and C-c (or C-w and M-w), and you can
165;; subsequently insert it - as a rectangle - using C-v (or C-y). So
166;; the only new command you need to know to work with cua-mode
167;; rectangles is S-return!
152;; 168;;
153;; Normally, when you paste a rectangle using C-v (C-y), each line of 169;; Normally, when you paste a rectangle using C-v (C-y), each line of
154;; the rectangle is inserted into the existing lines in the buffer. 170;; the rectangle is inserted into the existing lines in the buffer.
155;; If overwrite-mode is active when you paste a rectangle, it is 171;; If overwrite-mode is active when you paste a rectangle, it is
156;; inserted as normal (multi-line) text. 172;; inserted as normal (multi-line) text.
157;; 173;;
158;; Furthermore, cua-mode's rectangles are not limited to the actual 174;; If you prefer the traditional rectangle marking (i.e. don't want
159;; contents of the buffer, so if the cursor is currently at the end of a 175;; straight edges), [M-p] toggles this for the current rectangle,
160;; short line, you can still extend the rectangle to include more columns 176;; or you can customize cua-virtual-rectangle-edges.
161;; of longer lines in the same rectangle. Sounds strange? Try it!
162;;
163;; You can enable padding for just this rectangle by pressing [M-p];
164;; this works like entering `picture-mode' where the tabs and spaces
165;; are automatically converted/inserted to make the rectangle truly
166;; rectangular. Or you can do it for all rectangles by setting the
167;; `cua-auto-expand-rectangles' variable.
168 177
169;; And there's more: If you want to extend or reduce the size of the 178;; And there's more: If you want to extend or reduce the size of the
170;; rectangle in one of the other corners of the rectangle, just use 179;; rectangle in one of the other corners of the rectangle, just use
@@ -204,8 +213,8 @@
204;; a supplied format string (prompt) 213;; a supplied format string (prompt)
205;; [M-o] opens the rectangle by moving the highlighted text to the 214;; [M-o] opens the rectangle by moving the highlighted text to the
206;; right of the rectangle and filling the rectangle with blanks. 215;; right of the rectangle and filling the rectangle with blanks.
207;; [M-p] toggles rectangle padding, i.e. insert tabs and spaces to 216;; [M-p] toggles virtual straight rectangle edges
208;; make rectangles truly rectangular 217;; [M-P] inserts tabs and spaces (padding) to make real straight edges
209;; [M-q] performs text filling on the rectangle 218;; [M-q] performs text filling on the rectangle
210;; [M-r] replaces REGEXP (prompt) by STRING (prompt) in rectangle 219;; [M-r] replaces REGEXP (prompt) by STRING (prompt) in rectangle
211;; [M-R] reverse the lines in the rectangle 220;; [M-R] reverse the lines in the rectangle
@@ -347,14 +356,27 @@ managers, so try setting this to nil, if prefix override doesn't work."
347 356
348;;; Rectangle Customization 357;;; Rectangle Customization
349 358
350(defcustom cua-auto-expand-rectangles nil 359(defcustom cua-virtual-rectangle-edges t
351 "*If non-nil, rectangles are padded with spaces to make straight edges. 360 "*If non-nil, rectangles have virtual straight edges.
352This implies modifying buffer contents by expanding tabs and inserting spaces. 361Note that although rectangles are always DISPLAYED with straight edges, the
353Consequently, this is inhibited in read-only buffers. 362buffer is NOT modified, until you execute a command that actually modifies it.
354Can be toggled by [M-p] while the rectangle is active," 363\[M-p] toggles this feature when a rectangle is active."
355 :type 'boolean 364 :type 'boolean
356 :group 'cua) 365 :group 'cua)
357 366
367(defcustom cua-auto-tabify-rectangles 1000
368 "*If non-nil, automatically tabify after rectangle commands.
369This basically means that `tabify' is applied to all lines that
370are modified by inserting or deleting a rectangle. If value is
371an integer, cua will look for existing tabs in a region around
372the rectangle, and only do the conversion if any tabs are already
373present. The number specifies then number of characters before
374and after the region marked by the rectangle to search."
375 :type '(choice (number :tag "Auto detect (limit)")
376 (const :tag "Disabled" nil)
377 (other :tag "Enabled" t))
378 :group 'cua)
379
358(defcustom cua-enable-rectangle-auto-help t 380(defcustom cua-enable-rectangle-auto-help t
359 "*If non-nil, automatically show help for region, rectangle and global mark." 381 "*If non-nil, automatically show help for region, rectangle and global mark."
360 :type 'boolean 382 :type 'boolean
@@ -412,7 +434,6 @@ Can be toggled by [M-p] while the rectangle is active,"
412 (frame-parameter nil 'cursor-color) 434 (frame-parameter nil 'cursor-color)
413 "red") 435 "red")
414 "Normal (non-overwrite) cursor color. 436 "Normal (non-overwrite) cursor color.
415Also used to indicate that rectangle padding is not in effect.
416Default is to load cursor color from initial or default frame parameters. 437Default is to load cursor color from initial or default frame parameters.
417 438
418If the value is a COLOR name, then only the `cursor-color' attribute will be 439If the value is a COLOR name, then only the `cursor-color' attribute will be
@@ -462,7 +483,6 @@ a cons (TYPE . COLOR), then both properties are affected."
462 483
463(defcustom cua-overwrite-cursor-color "yellow" 484(defcustom cua-overwrite-cursor-color "yellow"
464 "*Cursor color used when overwrite mode is set, if non-nil. 485 "*Cursor color used when overwrite mode is set, if non-nil.
465Also used to indicate that rectangle padding is in effect.
466Only used when `cua-enable-cursor-indications' is non-nil. 486Only used when `cua-enable-cursor-indications' is non-nil.
467 487
468If the value is a COLOR name, then only the `cursor-color' attribute will be 488If the value is a COLOR name, then only the `cursor-color' attribute will be
@@ -806,7 +826,8 @@ If global mark is active, copy from register or one character."
806 (interactive "P") 826 (interactive "P")
807 (setq arg (cua--prefix-arg arg)) 827 (setq arg (cua--prefix-arg arg))
808 (let ((regtxt (and cua--register (get-register cua--register))) 828 (let ((regtxt (and cua--register (get-register cua--register)))
809 (count (prefix-numeric-value arg))) 829 (count (prefix-numeric-value arg))
830 paste-column paste-lines)
810 (cond 831 (cond
811 ((and cua--register (not regtxt)) 832 ((and cua--register (not regtxt))
812 (message "Nothing in register %c" cua--register)) 833 (message "Nothing in register %c" cua--register))
@@ -825,7 +846,12 @@ If global mark is active, copy from register or one character."
825 ;; the same region that we are going to delete. 846 ;; the same region that we are going to delete.
826 ;; That would make yank a no-op. 847 ;; That would make yank a no-op.
827 (if cua--rectangle 848 (if cua--rectangle
828 (cua--delete-rectangle) 849 (progn
850 (goto-char (min (mark) (point)))
851 (setq paste-column (cua--rectangle-left))
852 (setq paste-lines (cua--delete-rectangle))
853 (if (= paste-lines 1)
854 (setq paste-lines nil))) ;; paste all
829 (if (string= (buffer-substring (point) (mark)) 855 (if (string= (buffer-substring (point) (mark))
830 (car kill-ring)) 856 (car kill-ring))
831 (current-kill 1)) 857 (current-kill 1))
@@ -843,7 +869,8 @@ If global mark is active, copy from register or one character."
843 (setq this-command 'cua--paste-rectangle) 869 (setq this-command 'cua--paste-rectangle)
844 (undo-boundary) 870 (undo-boundary)
845 (setq buffer-undo-list (cons pt buffer-undo-list))) 871 (setq buffer-undo-list (cons pt buffer-undo-list)))
846 (cua--insert-rectangle (cdr cua--last-killed-rectangle)) 872 (cua--insert-rectangle (cdr cua--last-killed-rectangle)
873 nil paste-column paste-lines)
847 (if arg (goto-char pt)))) 874 (if arg (goto-char pt))))
848 (t (yank arg))))))) 875 (t (yank arg)))))))
849 876
@@ -1033,9 +1060,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1033 ((and buffer-read-only 1060 ((and buffer-read-only
1034 cua-read-only-cursor-color) 1061 cua-read-only-cursor-color)
1035 cua-read-only-cursor-color) 1062 cua-read-only-cursor-color)
1036 ((and cua-overwrite-cursor-color 1063 ((and cua-overwrite-cursor-color overwrite-mode)
1037 (or overwrite-mode
1038 (and cua--rectangle (cua--rectangle-padding))))
1039 cua-overwrite-cursor-color) 1064 cua-overwrite-cursor-color)
1040 (t cua-normal-cursor-color))) 1065 (t cua-normal-cursor-color)))
1041 (color (if (consp cursor) (cdr cursor) cursor)) 1066 (color (if (consp cursor) (cdr cursor) cursor))
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 965fe63bced..626ef22cf2d 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -44,10 +44,10 @@
44(require 'rect) 44(require 'rect)
45 45
46;; If non-nil, restrict current region to this rectangle. 46;; If non-nil, restrict current region to this rectangle.
47;; Value is a vector [top bot left right corner ins pad select]. 47;; Value is a vector [top bot left right corner ins virt select].
48;; CORNER specifies currently active corner 0=t/l 1=t/r 2=b/l 3=b/r. 48;; CORNER specifies currently active corner 0=t/l 1=t/r 2=b/l 3=b/r.
49;; INS specifies whether to insert on left(nil) or right(t) side. 49;; INS specifies whether to insert on left(nil) or right(t) side.
50;; If PAD is non-nil, tabs are converted to spaces when necessary. 50;; If VIRT is non-nil, virtual straight edges are enabled.
51;; If SELECT is a regexp, only lines starting with that regexp are affected.") 51;; If SELECT is a regexp, only lines starting with that regexp are affected.")
52(defvar cua--rectangle nil) 52(defvar cua--rectangle nil)
53(make-variable-buffer-local 'cua--rectangle) 53(make-variable-buffer-local 'cua--rectangle)
@@ -65,6 +65,8 @@
65(defvar cua--rectangle-overlays nil) 65(defvar cua--rectangle-overlays nil)
66(make-variable-buffer-local 'cua--rectangle-overlays) 66(make-variable-buffer-local 'cua--rectangle-overlays)
67 67
68(defvar cua--virtual-edges-debug nil)
69
68;; Per-buffer CUA mode undo list. 70;; Per-buffer CUA mode undo list.
69(defvar cua--undo-list nil) 71(defvar cua--undo-list nil)
70(make-variable-buffer-local 'cua--undo-list) 72(make-variable-buffer-local 'cua--undo-list)
@@ -97,7 +99,7 @@ Knows about CUA rectangle highlighting in addition to standard undo."
97(defvar cua--tidy-undo-counter 0 99(defvar cua--tidy-undo-counter 0
98 "Number of times `cua--tidy-undo-lists' have run successfully.") 100 "Number of times `cua--tidy-undo-lists' have run successfully.")
99 101
100;; Clean out danling entries from cua's undo list. 102;; Clean out dangling entries from cua's undo list.
101;; Since this list contains pointers into the standard undo list, 103;; Since this list contains pointers into the standard undo list,
102;; such references are only meningful as undo information if the 104;; such references are only meningful as undo information if the
103;; corresponding entry is still on the standard undo list. 105;; corresponding entry is still on the standard undo list.
@@ -203,11 +205,11 @@ Knows about CUA rectangle highlighting in addition to standard undo."
203 (aref cua--rectangle 5)) 205 (aref cua--rectangle 5))
204 (cua--rectangle-left)))) 206 (cua--rectangle-left))))
205 207
206(defun cua--rectangle-padding (&optional set val) 208(defun cua--rectangle-virtual-edges (&optional set val)
207 ;; Current setting of rectangle padding 209 ;; Current setting of rectangle virtual-edges
208 (if set 210 (if set
209 (aset cua--rectangle 6 val)) 211 (aset cua--rectangle 6 val))
210 (and (not buffer-read-only) 212 (and ;(not buffer-read-only)
211 (aref cua--rectangle 6))) 213 (aref cua--rectangle 6)))
212 214
213(defun cua--rectangle-restriction (&optional val bounded negated) 215(defun cua--rectangle-restriction (&optional val bounded negated)
@@ -226,7 +228,7 @@ Knows about CUA rectangle highlighting in addition to standard undo."
226 (if (< (cua--rectangle-bot) (cua--rectangle-top)) 228 (if (< (cua--rectangle-bot) (cua--rectangle-top))
227 (message "rectangle bot < top"))) 229 (message "rectangle bot < top")))
228 230
229(defun cua--rectangle-get-corners (&optional pad) 231(defun cua--rectangle-get-corners ()
230 ;; Calculate the rectangular region represented by point and mark, 232 ;; Calculate the rectangular region represented by point and mark,
231 ;; putting start in the upper left corner and end in the 233 ;; putting start in the upper left corner and end in the
232 ;; bottom right corner. 234 ;; bottom right corner.
@@ -245,12 +247,12 @@ Knows about CUA rectangle highlighting in addition to standard undo."
245 (setq r (1- r))) 247 (setq r (1- r)))
246 (setq l (prog1 r (setq r l))) 248 (setq l (prog1 r (setq r l)))
247 (goto-char top) 249 (goto-char top)
248 (move-to-column l pad) 250 (move-to-column l)
249 (setq top (point)) 251 (setq top (point))
250 (goto-char bot) 252 (goto-char bot)
251 (move-to-column r pad) 253 (move-to-column r)
252 (setq bot (point)))) 254 (setq bot (point))))
253 (vector top bot l r corner 0 pad nil))) 255 (vector top bot l r corner 0 cua-virtual-rectangle-edges nil)))
254 256
255(defun cua--rectangle-set-corners () 257(defun cua--rectangle-set-corners ()
256 ;; Set mark and point in opposite corners of current rectangle. 258 ;; Set mark and point in opposite corners of current rectangle.
@@ -269,24 +271,21 @@ Knows about CUA rectangle highlighting in addition to standard undo."
269 (setq pp (cua--rectangle-bot) pc (cua--rectangle-right) 271 (setq pp (cua--rectangle-bot) pc (cua--rectangle-right)
270 mp (cua--rectangle-top) mc (cua--rectangle-left)))) 272 mp (cua--rectangle-top) mc (cua--rectangle-left))))
271 (goto-char mp) 273 (goto-char mp)
272 (move-to-column mc (cua--rectangle-padding)) 274 (move-to-column mc)
273 (set-mark (point)) 275 (set-mark (point))
274 (goto-char pp) 276 (goto-char pp)
275 (move-to-column pc (cua--rectangle-padding)))) 277 (move-to-column pc)
278 ))
276 279
277;;; Rectangle resizing 280;;; Rectangle resizing
278 281
279(defun cua--forward-line (n pad) 282(defun cua--forward-line (n)
280 ;; Move forward/backward one line. Returns t if movement. 283 ;; Move forward/backward one line. Returns t if movement.
281 (if (or (not pad) (< n 0)) 284 (= (forward-line n) 0))
282 (= (forward-line n) 0)
283 (next-line 1)
284 t))
285 285
286(defun cua--rectangle-resized () 286(defun cua--rectangle-resized ()
287 ;; Refresh state after resizing rectangle 287 ;; Refresh state after resizing rectangle
288 (setq cua--buffer-and-point-before-command nil) 288 (setq cua--buffer-and-point-before-command nil)
289 (cua--pad-rectangle)
290 (cua--rectangle-insert-col 0) 289 (cua--rectangle-insert-col 0)
291 (cua--rectangle-set-corners) 290 (cua--rectangle-set-corners)
292 (cua--keep-active)) 291 (cua--keep-active))
@@ -294,47 +293,35 @@ Knows about CUA rectangle highlighting in addition to standard undo."
294(defun cua-resize-rectangle-right (n) 293(defun cua-resize-rectangle-right (n)
295 "Resize rectangle to the right." 294 "Resize rectangle to the right."
296 (interactive "p") 295 (interactive "p")
297 (let ((pad (cua--rectangle-padding)) (resized (> n 0))) 296 (let ((resized (> n 0)))
298 (while (> n 0) 297 (while (> n 0)
299 (setq n (1- n)) 298 (setq n (1- n))
300 (cond 299 (cond
301 ((and (cua--rectangle-right-side) (or pad (eolp)))
302 (cua--rectangle-right (1+ (cua--rectangle-right)))
303 (move-to-column (cua--rectangle-right) pad))
304 ((cua--rectangle-right-side) 300 ((cua--rectangle-right-side)
305 (forward-char 1) 301 (cua--rectangle-right (1+ (cua--rectangle-right)))
306 (cua--rectangle-right (current-column))) 302 (move-to-column (cua--rectangle-right)))
307 ((or pad (eolp))
308 (cua--rectangle-left (1+ (cua--rectangle-left)))
309 (move-to-column (cua--rectangle-right) pad))
310 (t 303 (t
311 (forward-char 1) 304 (cua--rectangle-left (1+ (cua--rectangle-left)))
312 (cua--rectangle-left (current-column))))) 305 (move-to-column (cua--rectangle-right)))))
313 (if resized 306 (if resized
314 (cua--rectangle-resized)))) 307 (cua--rectangle-resized))))
315 308
316(defun cua-resize-rectangle-left (n) 309(defun cua-resize-rectangle-left (n)
317 "Resize rectangle to the left." 310 "Resize rectangle to the left."
318 (interactive "p") 311 (interactive "p")
319 (let ((pad (cua--rectangle-padding)) resized) 312 (let (resized)
320 (while (> n 0) 313 (while (> n 0)
321 (setq n (1- n)) 314 (setq n (1- n))
322 (if (or (= (cua--rectangle-right) 0) 315 (if (or (= (cua--rectangle-right) 0)
323 (and (not (cua--rectangle-right-side)) (= (cua--rectangle-left) 0))) 316 (and (not (cua--rectangle-right-side)) (= (cua--rectangle-left) 0)))
324 (setq n 0) 317 (setq n 0)
325 (cond 318 (cond
326 ((and (cua--rectangle-right-side) (or pad (eolp) (bolp)))
327 (cua--rectangle-right (1- (cua--rectangle-right)))
328 (move-to-column (cua--rectangle-right) pad))
329 ((cua--rectangle-right-side) 319 ((cua--rectangle-right-side)
330 (backward-char 1) 320 (cua--rectangle-right (1- (cua--rectangle-right)))
331 (cua--rectangle-right (current-column))) 321 (move-to-column (cua--rectangle-right)))
332 ((or pad (eolp) (bolp))
333 (cua--rectangle-left (1- (cua--rectangle-left)))
334 (move-to-column (cua--rectangle-right) pad))
335 (t 322 (t
336 (backward-char 1) 323 (cua--rectangle-left (1- (cua--rectangle-left)))
337 (cua--rectangle-left (current-column)))) 324 (move-to-column (cua--rectangle-right))))
338 (setq resized t))) 325 (setq resized t)))
339 (if resized 326 (if resized
340 (cua--rectangle-resized)))) 327 (cua--rectangle-resized))))
@@ -342,20 +329,20 @@ Knows about CUA rectangle highlighting in addition to standard undo."
342(defun cua-resize-rectangle-down (n) 329(defun cua-resize-rectangle-down (n)
343 "Resize rectangle downwards." 330 "Resize rectangle downwards."
344 (interactive "p") 331 (interactive "p")
345 (let ((pad (cua--rectangle-padding)) resized) 332 (let (resized)
346 (while (> n 0) 333 (while (> n 0)
347 (setq n (1- n)) 334 (setq n (1- n))
348 (cond 335 (cond
349 ((>= (cua--rectangle-corner) 2) 336 ((>= (cua--rectangle-corner) 2)
350 (goto-char (cua--rectangle-bot)) 337 (goto-char (cua--rectangle-bot))
351 (when (cua--forward-line 1 pad) 338 (when (cua--forward-line 1)
352 (move-to-column (cua--rectangle-column) pad) 339 (move-to-column (cua--rectangle-column))
353 (cua--rectangle-bot t) 340 (cua--rectangle-bot t)
354 (setq resized t))) 341 (setq resized t)))
355 (t 342 (t
356 (goto-char (cua--rectangle-top)) 343 (goto-char (cua--rectangle-top))
357 (when (cua--forward-line 1 pad) 344 (when (cua--forward-line 1)
358 (move-to-column (cua--rectangle-column) pad) 345 (move-to-column (cua--rectangle-column))
359 (cua--rectangle-top t) 346 (cua--rectangle-top t)
360 (setq resized t))))) 347 (setq resized t)))))
361 (if resized 348 (if resized
@@ -364,20 +351,20 @@ Knows about CUA rectangle highlighting in addition to standard undo."
364(defun cua-resize-rectangle-up (n) 351(defun cua-resize-rectangle-up (n)
365 "Resize rectangle upwards." 352 "Resize rectangle upwards."
366 (interactive "p") 353 (interactive "p")
367 (let ((pad (cua--rectangle-padding)) resized) 354 (let (resized)
368 (while (> n 0) 355 (while (> n 0)
369 (setq n (1- n)) 356 (setq n (1- n))
370 (cond 357 (cond
371 ((>= (cua--rectangle-corner) 2) 358 ((>= (cua--rectangle-corner) 2)
372 (goto-char (cua--rectangle-bot)) 359 (goto-char (cua--rectangle-bot))
373 (when (cua--forward-line -1 pad) 360 (when (cua--forward-line -1)
374 (move-to-column (cua--rectangle-column) pad) 361 (move-to-column (cua--rectangle-column))
375 (cua--rectangle-bot t) 362 (cua--rectangle-bot t)
376 (setq resized t))) 363 (setq resized t)))
377 (t 364 (t
378 (goto-char (cua--rectangle-top)) 365 (goto-char (cua--rectangle-top))
379 (when (cua--forward-line -1 pad) 366 (when (cua--forward-line -1)
380 (move-to-column (cua--rectangle-column) pad) 367 (move-to-column (cua--rectangle-column))
381 (cua--rectangle-top t) 368 (cua--rectangle-top t)
382 (setq resized t))))) 369 (setq resized t)))))
383 (if resized 370 (if resized
@@ -408,7 +395,7 @@ Knows about CUA rectangle highlighting in addition to standard undo."
408 "Resize rectangle to bottom of buffer." 395 "Resize rectangle to bottom of buffer."
409 (interactive) 396 (interactive)
410 (goto-char (point-max)) 397 (goto-char (point-max))
411 (move-to-column (cua--rectangle-column) (cua--rectangle-padding)) 398 (move-to-column (cua--rectangle-column))
412 (cua--rectangle-bot t) 399 (cua--rectangle-bot t)
413 (cua--rectangle-resized)) 400 (cua--rectangle-resized))
414 401
@@ -416,31 +403,29 @@ Knows about CUA rectangle highlighting in addition to standard undo."
416 "Resize rectangle to top of buffer." 403 "Resize rectangle to top of buffer."
417 (interactive) 404 (interactive)
418 (goto-char (point-min)) 405 (goto-char (point-min))
419 (move-to-column (cua--rectangle-column) (cua--rectangle-padding)) 406 (move-to-column (cua--rectangle-column))
420 (cua--rectangle-top t) 407 (cua--rectangle-top t)
421 (cua--rectangle-resized)) 408 (cua--rectangle-resized))
422 409
423(defun cua-resize-rectangle-page-up () 410(defun cua-resize-rectangle-page-up ()
424 "Resize rectangle upwards by one scroll page." 411 "Resize rectangle upwards by one scroll page."
425 (interactive) 412 (interactive)
426 (let ((pad (cua--rectangle-padding))) 413 (scroll-down)
427 (scroll-down) 414 (move-to-column (cua--rectangle-column))
428 (move-to-column (cua--rectangle-column) pad) 415 (if (>= (cua--rectangle-corner) 2)
429 (if (>= (cua--rectangle-corner) 2) 416 (cua--rectangle-bot t)
430 (cua--rectangle-bot t) 417 (cua--rectangle-top t))
431 (cua--rectangle-top t)) 418 (cua--rectangle-resized))
432 (cua--rectangle-resized)))
433 419
434(defun cua-resize-rectangle-page-down () 420(defun cua-resize-rectangle-page-down ()
435 "Resize rectangle downwards by one scroll page." 421 "Resize rectangle downwards by one scroll page."
436 (interactive) 422 (interactive)
437 (let ((pad (cua--rectangle-padding))) 423 (scroll-up)
438 (scroll-up) 424 (move-to-column (cua--rectangle-column))
439 (move-to-column (cua--rectangle-column) pad) 425 (if (>= (cua--rectangle-corner) 2)
440 (if (>= (cua--rectangle-corner) 2) 426 (cua--rectangle-bot t)
441 (cua--rectangle-bot t) 427 (cua--rectangle-top t))
442 (cua--rectangle-top t)) 428 (cua--rectangle-resized))
443 (cua--rectangle-resized)))
444 429
445;;; Mouse support 430;;; Mouse support
446 431
@@ -450,7 +435,8 @@ Knows about CUA rectangle highlighting in addition to standard undo."
450 "Set rectangle corner at mouse click position." 435 "Set rectangle corner at mouse click position."
451 (interactive "e") 436 (interactive "e")
452 (mouse-set-point event) 437 (mouse-set-point event)
453 (if (cua--rectangle-padding) 438 ;; FIX ME -- need to calculate virtual column.
439 (if (cua--rectangle-virtual-edges)
454 (move-to-column (car (posn-col-row (event-end event))) t)) 440 (move-to-column (car (posn-col-row (event-end event))) t))
455 (if (cua--rectangle-right-side) 441 (if (cua--rectangle-right-side)
456 (cua--rectangle-right (current-column)) 442 (cua--rectangle-right (current-column))
@@ -470,6 +456,7 @@ Knows about CUA rectangle highlighting in addition to standard undo."
470 (cua--deactivate t)) 456 (cua--deactivate t))
471 (setq cua--last-rectangle nil) 457 (setq cua--last-rectangle nil)
472 (mouse-set-point event) 458 (mouse-set-point event)
459 ;; FIX ME -- need to calculate virtual column.
473 (cua-set-rectangle-mark) 460 (cua-set-rectangle-mark)
474 (setq cua--buffer-and-point-before-command nil) 461 (setq cua--buffer-and-point-before-command nil)
475 (setq cua--mouse-last-pos nil)) 462 (setq cua--mouse-last-pos nil))
@@ -489,13 +476,13 @@ If command is repeated at same position, delete the rectangle."
489 (let ((cua-keep-region-after-copy t)) 476 (let ((cua-keep-region-after-copy t))
490 (cua-copy-rectangle arg) 477 (cua-copy-rectangle arg)
491 (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle))))) 478 (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle)))))
479
492(defun cua--mouse-ignore (event) 480(defun cua--mouse-ignore (event)
493 (interactive "e") 481 (interactive "e")
494 (setq this-command last-command)) 482 (setq this-command last-command))
495 483
496(defun cua--rectangle-move (dir) 484(defun cua--rectangle-move (dir)
497 (let ((pad (cua--rectangle-padding)) 485 (let ((moved t)
498 (moved t)
499 (top (cua--rectangle-top)) 486 (top (cua--rectangle-top))
500 (bot (cua--rectangle-bot)) 487 (bot (cua--rectangle-bot))
501 (l (cua--rectangle-left)) 488 (l (cua--rectangle-left))
@@ -503,17 +490,17 @@ If command is repeated at same position, delete the rectangle."
503 (cond 490 (cond
504 ((eq dir 'up) 491 ((eq dir 'up)
505 (goto-char top) 492 (goto-char top)
506 (when (cua--forward-line -1 pad) 493 (when (cua--forward-line -1)
507 (cua--rectangle-top t) 494 (cua--rectangle-top t)
508 (goto-char bot) 495 (goto-char bot)
509 (forward-line -1) 496 (forward-line -1)
510 (cua--rectangle-bot t))) 497 (cua--rectangle-bot t)))
511 ((eq dir 'down) 498 ((eq dir 'down)
512 (goto-char bot) 499 (goto-char bot)
513 (when (cua--forward-line 1 pad) 500 (when (cua--forward-line 1)
514 (cua--rectangle-bot t) 501 (cua--rectangle-bot t)
515 (goto-char top) 502 (goto-char top)
516 (cua--forward-line 1 pad) 503 (cua--forward-line 1)
517 (cua--rectangle-top t))) 504 (cua--rectangle-top t)))
518 ((eq dir 'left) 505 ((eq dir 'left)
519 (when (> l 0) 506 (when (> l 0)
@@ -526,19 +513,37 @@ If command is repeated at same position, delete the rectangle."
526 (setq moved nil))) 513 (setq moved nil)))
527 (when moved 514 (when moved
528 (setq cua--buffer-and-point-before-command nil) 515 (setq cua--buffer-and-point-before-command nil)
529 (cua--pad-rectangle)
530 (cua--rectangle-set-corners) 516 (cua--rectangle-set-corners)
531 (cua--keep-active)))) 517 (cua--keep-active))))
532 518
533 519
534;;; Operations on current rectangle 520;;; Operations on current rectangle
535 521
536(defun cua--rectangle-operation (keep-clear visible undo pad &optional fct post-fct) 522(defun cua--tabify-start (start end)
523 ;; Return position where auto-tabify should start (or nil if not required).
524 (save-excursion
525 (save-restriction
526 (widen)
527 (and (not buffer-read-only)
528 cua-auto-tabify-rectangles
529 (if (or (not (integerp cua-auto-tabify-rectangles))
530 (= (point-min) (point-max))
531 (progn
532 (goto-char (max (point-min)
533 (- start cua-auto-tabify-rectangles)))
534 (search-forward "\t" (min (point-max)
535 (+ end cua-auto-tabify-rectangles)) t)))
536 start)))))
537
538(defun cua--rectangle-operation (keep-clear visible undo pad tabify &optional fct post-fct)
537 ;; Call FCT for each line of region with 4 parameters: 539 ;; Call FCT for each line of region with 4 parameters:
538 ;; Region start, end, left-col, right-col 540 ;; Region start, end, left-col, right-col
539 ;; Point is at start when FCT is called 541 ;; Point is at start when FCT is called
542 ;; Call fct with (s,e) = whole lines if VISIBLE non-nil.
543 ;; Only call fct for visible lines if VISIBLE==t.
540 ;; Set undo boundary if UNDO is non-nil. 544 ;; Set undo boundary if UNDO is non-nil.
541 ;; Rectangle is padded if PAD = t or numeric and (cua--rectangle-padding) 545 ;; Rectangle is padded if PAD = t or numeric and (cua--rectangle-virtual-edges)
546 ;; Perform auto-tabify after operation if TABIFY is non-nil.
542 ;; Mark is kept if keep-clear is 'keep and cleared if keep-clear is 'clear. 547 ;; Mark is kept if keep-clear is 'keep and cleared if keep-clear is 'clear.
543 (let* ((start (cua--rectangle-top)) 548 (let* ((start (cua--rectangle-top))
544 (end (cua--rectangle-bot)) 549 (end (cua--rectangle-bot))
@@ -546,11 +551,12 @@ If command is repeated at same position, delete the rectangle."
546 (r (1+ (cua--rectangle-right))) 551 (r (1+ (cua--rectangle-right)))
547 (m (make-marker)) 552 (m (make-marker))
548 (tabpad (and (integerp pad) (= pad 2))) 553 (tabpad (and (integerp pad) (= pad 2)))
549 (sel (cua--rectangle-restriction))) 554 (sel (cua--rectangle-restriction))
555 (tabify-start (and tabify (cua--tabify-start start end))))
550 (if undo 556 (if undo
551 (cua--rectangle-undo-boundary)) 557 (cua--rectangle-undo-boundary))
552 (if (integerp pad) 558 (if (integerp pad)
553 (setq pad (cua--rectangle-padding))) 559 (setq pad (cua--rectangle-virtual-edges)))
554 (save-excursion 560 (save-excursion
555 (save-restriction 561 (save-restriction
556 (widen) 562 (widen)
@@ -558,7 +564,7 @@ If command is repeated at same position, delete the rectangle."
558 (goto-char end) 564 (goto-char end)
559 (and (bolp) (not (eolp)) (not (eobp)) 565 (and (bolp) (not (eolp)) (not (eobp))
560 (setq end (1+ end)))) 566 (setq end (1+ end))))
561 (when visible 567 (when (eq visible t)
562 (setq start (max (window-start) start)) 568 (setq start (max (window-start) start))
563 (setq end (min (window-end) end))) 569 (setq end (min (window-end) end)))
564 (goto-char end) 570 (goto-char end)
@@ -575,7 +581,7 @@ If command is repeated at same position, delete the rectangle."
575 (forward-char 1)) 581 (forward-char 1))
576 (set-marker m (point)) 582 (set-marker m (point))
577 (move-to-column l pad) 583 (move-to-column l pad)
578 (if (and fct (>= (current-column) l) (<= (current-column) r)) 584 (if (and fct (or visible (and (>= (current-column) l) (<= (current-column) r))))
579 (let ((v t) (p (point))) 585 (let ((v t) (p (point)))
580 (when sel 586 (when sel
581 (if (car (cdr sel)) 587 (if (car (cdr sel))
@@ -585,8 +591,7 @@ If command is repeated at same position, delete the rectangle."
585 (if (car (cdr (cdr sel))) 591 (if (car (cdr (cdr sel)))
586 (setq v (null v)))) 592 (setq v (null v))))
587 (if visible 593 (if visible
588 (unless (eolp) 594 (funcall fct p m l r v)
589 (funcall fct p m l r v))
590 (if v 595 (if v
591 (funcall fct p m l r))))) 596 (funcall fct p m l r)))))
592 (set-marker m nil) 597 (set-marker m nil)
@@ -594,7 +599,9 @@ If command is repeated at same position, delete the rectangle."
594 (if (not visible) 599 (if (not visible)
595 (cua--rectangle-bot t)) 600 (cua--rectangle-bot t))
596 (if post-fct 601 (if post-fct
597 (funcall post-fct l r)))) 602 (funcall post-fct l r))
603 (when tabify-start
604 (tabify tabify-start (point)))))
598 (cond 605 (cond
599 ((eq keep-clear 'keep) 606 ((eq keep-clear 'keep)
600 (cua--keep-active)) 607 (cua--keep-active))
@@ -607,48 +614,96 @@ If command is repeated at same position, delete the rectangle."
607 614
608(put 'cua--rectangle-operation 'lisp-indent-function 4) 615(put 'cua--rectangle-operation 'lisp-indent-function 4)
609 616
610(defun cua--pad-rectangle (&optional pad)
611 (if (or pad (cua--rectangle-padding))
612 (cua--rectangle-operation nil nil t t)))
613
614(defun cua--delete-rectangle () 617(defun cua--delete-rectangle ()
615 (cua--rectangle-operation nil nil t 2 618 (let ((lines 0))
616 '(lambda (s e l r) 619 (if (not (cua--rectangle-virtual-edges))
617 (if (and (> e s) (<= e (point-max))) 620 (cua--rectangle-operation nil nil t 2 t
618 (delete-region s e))))) 621 '(lambda (s e l r v)
622 (setq lines (1+ lines))
623 (if (and (> e s) (<= e (point-max)))
624 (delete-region s e))))
625 (cua--rectangle-operation nil 1 t nil t
626 '(lambda (s e l r v)
627 (setq lines (1+ lines))
628 (when (and (> e s) (<= e (point-max)))
629 (delete-region s e)))))
630 lines))
619 631
620(defun cua--extract-rectangle () 632(defun cua--extract-rectangle ()
621 (let (rect) 633 (let (rect)
622 (cua--rectangle-operation nil nil nil 1 634 (if (not (cua--rectangle-virtual-edges))
623 '(lambda (s e l r) 635 (cua--rectangle-operation nil nil nil nil nil ; do not tabify
624 (setq rect (cons (buffer-substring-no-properties s e) rect)))) 636 '(lambda (s e l r)
625 (nreverse rect))) 637 (setq rect (cons (buffer-substring-no-properties s e) rect))))
626 638 (cua--rectangle-operation nil 1 nil nil nil ; do not tabify
627(defun cua--insert-rectangle (rect &optional below) 639 '(lambda (s e l r v)
640 (let ((copy t) (bs 0) (as 0) row)
641 (if (= s e) (setq e (1+ e)))
642 (goto-char s)
643 (move-to-column l)
644 (if (= (point) (line-end-position))
645 (setq bs (- r l)
646 copy nil)
647 (skip-chars-forward "\s\t" e)
648 (setq bs (- (min r (current-column)) l)
649 s (point))
650 (move-to-column r)
651 (skip-chars-backward "\s\t" s)
652 (setq as (- r (max (current-column) l))
653 e (point)))
654 (setq row (if (and copy (> e s))
655 (buffer-substring-no-properties s e)
656 ""))
657 (when (> bs 0)
658 (setq row (concat (make-string bs ?\s) row)))
659 (when (> as 0)
660 (setq row (concat row (make-string as ?\s))))
661 (setq rect (cons row rect))))))
662 (nreverse rect)))
663
664(defun cua--insert-rectangle (rect &optional below paste-column line-count)
628 ;; Insert rectangle as insert-rectangle, but don't set mark and exit with 665 ;; Insert rectangle as insert-rectangle, but don't set mark and exit with
629 ;; point at either next to top right or below bottom left corner 666 ;; point at either next to top right or below bottom left corner
630 ;; Notice: In overwrite mode, the rectangle is inserted as separate text lines. 667 ;; Notice: In overwrite mode, the rectangle is inserted as separate text lines.
631 (if (and below (eq below 'auto)) 668 (if (eq below 'auto)
632 (setq below (and (bolp) 669 (setq below (and (bolp)
633 (or (eolp) (eobp) (= (1+ (point)) (point-max)))))) 670 (or (eolp) (eobp) (= (1+ (point)) (point-max))))))
671 (unless paste-column
672 (setq paste-column (current-column)))
634 (let ((lines rect) 673 (let ((lines rect)
635 (insertcolumn (current-column))
636 (first t) 674 (first t)
675 (tabify-start (cua--tabify-start (point) (point)))
676 last-column
637 p) 677 p)
638 (while (or lines below) 678 (while (or lines below)
639 (or first 679 (or first
640 (if overwrite-mode 680 (if overwrite-mode
641 (insert ?\n) 681 (insert ?\n)
642 (forward-line 1) 682 (forward-line 1)
643 (or (bolp) (insert ?\n)) 683 (or (bolp) (insert ?\n))))
644 (move-to-column insertcolumn t))) 684 (unless overwrite-mode
685 (move-to-column paste-column t))
645 (if (not lines) 686 (if (not lines)
646 (setq below nil) 687 (setq below nil)
647 (insert-for-yank (car lines)) 688 (insert-for-yank (car lines))
689 (unless last-column
690 (setq last-column (current-column)))
648 (setq lines (cdr lines)) 691 (setq lines (cdr lines))
649 (and first (not below) 692 (and first (not below)
650 (setq p (point)))) 693 (setq p (point))))
651 (setq first nil)) 694 (setq first nil)
695 (if (and line-count (= (setq line-count (1- line-count)) 0))
696 (setq lines nil)))
697 (when (and line-count last-column (not overwrite-mode))
698 (while (> line-count 0)
699 (forward-line 1)
700 (or (bolp) (insert ?\n))
701 (move-to-column paste-column t)
702 (insert-char ?\s (- last-column paste-column -1))
703 (setq line-count (1- line-count))))
704 (when (and tabify-start
705 (not overwrite-mode))
706 (tabify tabify-start (point)))
652 (and p (not overwrite-mode) 707 (and p (not overwrite-mode)
653 (goto-char p)))) 708 (goto-char p))))
654 709
@@ -662,7 +717,7 @@ If command is repeated at same position, delete the rectangle."
662 (function (lambda (row) (concat row "\n"))) 717 (function (lambda (row) (concat row "\n")))
663 killed-rectangle ""))))) 718 killed-rectangle "")))))
664 719
665(defun cua--activate-rectangle (&optional force) 720(defun cua--activate-rectangle ()
666 ;; Turn on rectangular marking mode by disabling transient mark mode 721 ;; Turn on rectangular marking mode by disabling transient mark mode
667 ;; and manually handling highlighting from a post command hook. 722 ;; and manually handling highlighting from a post command hook.
668 ;; Be careful if we are already marking a rectangle. 723 ;; Be careful if we are already marking a rectangle.
@@ -671,12 +726,8 @@ If command is repeated at same position, delete the rectangle."
671 (eq (car cua--last-rectangle) (current-buffer)) 726 (eq (car cua--last-rectangle) (current-buffer))
672 (eq (car (cdr cua--last-rectangle)) (point))) 727 (eq (car (cdr cua--last-rectangle)) (point)))
673 (cdr (cdr cua--last-rectangle)) 728 (cdr (cdr cua--last-rectangle))
674 (cua--rectangle-get-corners 729 (cua--rectangle-get-corners))
675 (and (not buffer-read-only) 730 cua--status-string (if (cua--rectangle-virtual-edges) " [R]" "")
676 (or cua-auto-expand-rectangles
677 force
678 (eq major-mode 'picture-mode)))))
679 cua--status-string (if (cua--rectangle-padding) " Pad" "")
680 cua--last-rectangle nil)) 731 cua--last-rectangle nil))
681 732
682;; (defvar cua-save-point nil) 733;; (defvar cua-save-point nil)
@@ -698,7 +749,7 @@ If command is repeated at same position, delete the rectangle."
698 ;; Each overlay extends across all the columns of the rectangle. 749 ;; Each overlay extends across all the columns of the rectangle.
699 ;; We try to reuse overlays where possible because this is more efficient 750 ;; We try to reuse overlays where possible because this is more efficient
700 ;; and results in less flicker. 751 ;; and results in less flicker.
701 ;; If cua--rectangle-padding is nil and the buffer contains tabs or short lines, 752 ;; If cua--rectangle-virtual-edges is nil and the buffer contains tabs or short lines,
702 ;; the higlighted region may not be perfectly rectangular. 753 ;; the higlighted region may not be perfectly rectangular.
703 (let ((deactivate-mark deactivate-mark) 754 (let ((deactivate-mark deactivate-mark)
704 (old cua--rectangle-overlays) 755 (old cua--rectangle-overlays)
@@ -707,12 +758,59 @@ If command is repeated at same position, delete the rectangle."
707 (right (1+ (cua--rectangle-right)))) 758 (right (1+ (cua--rectangle-right))))
708 (when (/= left right) 759 (when (/= left right)
709 (sit-for 0) ; make window top/bottom reliable 760 (sit-for 0) ; make window top/bottom reliable
710 (cua--rectangle-operation nil t nil nil 761 (cua--rectangle-operation nil t nil nil nil ; do not tabify
711 '(lambda (s e l r v) 762 '(lambda (s e l r v)
712 (let ((rface (if v 'cua-rectangle-face 'cua-rectangle-noselect-face)) 763 (let ((rface (if v 'cua-rectangle-face 'cua-rectangle-noselect-face))
713 overlay) 764 overlay bs as)
714 ;; Trim old leading overlays.
715 (if (= s e) (setq e (1+ e))) 765 (if (= s e) (setq e (1+ e)))
766 (when (cua--rectangle-virtual-edges)
767 (let ((lb (line-beginning-position))
768 (le (line-end-position))
769 cl cl0 pl cr cr0 pr)
770 (goto-char s)
771 (setq cl (move-to-column l)
772 pl (point))
773 (setq cr (move-to-column r)
774 pr (point))
775 (if (= lb pl)
776 (setq cl0 0)
777 (goto-char (1- pl))
778 (setq cl0 (current-column)))
779 (if (= lb le)
780 (setq cr0 0)
781 (goto-char (1- pr))
782 (setq cr0 (current-column)))
783 (unless (and (= cl l) (= cr r))
784 (when (/= cl l)
785 (setq bs (propertize
786 (make-string
787 (- l cl0 (if (and (= le pl) (/= le lb)) 1 0))
788 (if cua--virtual-edges-debug ?. ?\s))
789 'face 'default))
790 (if (/= pl le)
791 (setq s (1- s))))
792 (cond
793 ((= cr r)
794 (if (and (/= cr0 (1- cr))
795 (= (mod cr tab-width) 0))
796 (setq e (1- e))))
797 ((= cr cl)
798 (setq bs (concat bs
799 (propertize
800 (make-string
801 (- r l)
802 (if cua--virtual-edges-debug ?, ?\s))
803 'face rface)))
804 (setq rface nil))
805 (t
806 (setq as (propertize
807 (make-string
808 (- r cr0 (if (= le pr) 1 0))
809 (if cua--virtual-edges-debug ?~ ?\s))
810 'face rface))
811 (if (/= pr le)
812 (setq e (1- e))))))))
813 ;; Trim old leading overlays.
716 (while (and old 814 (while (and old
717 (setq overlay (car old)) 815 (setq overlay (car old))
718 (< (overlay-start overlay) s) 816 (< (overlay-start overlay) s)
@@ -728,8 +826,10 @@ If command is repeated at same position, delete the rectangle."
728 (move-overlay overlay s e) 826 (move-overlay overlay s e)
729 (setq old (cdr old))) 827 (setq old (cdr old)))
730 (setq overlay (make-overlay s e))) 828 (setq overlay (make-overlay s e)))
731 (overlay-put overlay 'face rface) 829 (overlay-put overlay 'before-string bs)
732 (setq new (cons overlay new)))))) 830 (overlay-put overlay 'after-string as)
831 (overlay-put overlay 'face rface)
832 (setq new (cons overlay new))))))
733 ;; Trim old trailing overlays. 833 ;; Trim old trailing overlays.
734 (mapcar (function delete-overlay) old) 834 (mapcar (function delete-overlay) old)
735 (setq cua--rectangle-overlays (nreverse new)))) 835 (setq cua--rectangle-overlays (nreverse new))))
@@ -737,9 +837,9 @@ If command is repeated at same position, delete the rectangle."
737(defun cua--indent-rectangle (&optional ch to-col clear) 837(defun cua--indent-rectangle (&optional ch to-col clear)
738 ;; Indent current rectangle. 838 ;; Indent current rectangle.
739 (let ((col (cua--rectangle-insert-col)) 839 (let ((col (cua--rectangle-insert-col))
740 (pad (cua--rectangle-padding)) 840 (pad (cua--rectangle-virtual-edges))
741 indent) 841 indent)
742 (cua--rectangle-operation (if clear 'clear 'corners) nil t pad 842 (cua--rectangle-operation (if clear 'clear 'corners) nil t pad t
743 '(lambda (s e l r) 843 '(lambda (s e l r)
744 (move-to-column col pad) 844 (move-to-column col pad)
745 (if (and (eolp) 845 (if (and (eolp)
@@ -877,21 +977,18 @@ With prefix argument, the toggle restriction."
877 (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1)) 977 (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1))
878 (cua--rectangle-set-corners)) 978 (cua--rectangle-set-corners))
879 979
880(defun cua-toggle-rectangle-padding () 980(defun cua-toggle-rectangle-virtual-edges ()
881 (interactive) 981 (interactive)
882 (if buffer-read-only 982 (cua--rectangle-virtual-edges t (not (cua--rectangle-virtual-edges)))
883 (message "Cannot do padding in read-only buffer.") 983 (cua--rectangle-set-corners)
884 (cua--rectangle-padding t (not (cua--rectangle-padding))) 984 (setq cua--status-string (and (cua--rectangle-virtual-edges) " [R]"))
885 (cua--pad-rectangle)
886 (cua--rectangle-set-corners))
887 (setq cua--status-string (and (cua--rectangle-padding) " Pad"))
888 (cua--keep-active)) 985 (cua--keep-active))
889 986
890(defun cua-do-rectangle-padding () 987(defun cua-do-rectangle-padding ()
891 (interactive) 988 (interactive)
892 (if buffer-read-only 989 (if buffer-read-only
893 (message "Cannot do padding in read-only buffer.") 990 (message "Cannot do padding in read-only buffer.")
894 (cua--pad-rectangle t) 991 (cua--rectangle-operation nil nil t t t)
895 (cua--rectangle-set-corners)) 992 (cua--rectangle-set-corners))
896 (cua--keep-active)) 993 (cua--keep-active))
897 994
@@ -900,7 +997,7 @@ With prefix argument, the toggle restriction."
900The text previously in the region is not overwritten by the blanks, 997The text previously in the region is not overwritten by the blanks,
901but instead winds up to the right of the rectangle." 998but instead winds up to the right of the rectangle."
902 (interactive) 999 (interactive)
903 (cua--rectangle-operation 'corners nil t 1 1000 (cua--rectangle-operation 'corners nil t 1 nil
904 '(lambda (s e l r) 1001 '(lambda (s e l r)
905 (skip-chars-forward " \t") 1002 (skip-chars-forward " \t")
906 (let ((ws (- (current-column) l)) 1003 (let ((ws (- (current-column) l))
@@ -915,7 +1012,7 @@ On each line in the rectangle, all continuous whitespace starting
915at that column is deleted. 1012at that column is deleted.
916With prefix arg, also delete whitespace to the left of that column." 1013With prefix arg, also delete whitespace to the left of that column."
917 (interactive "P") 1014 (interactive "P")
918 (cua--rectangle-operation 'clear nil t 1 1015 (cua--rectangle-operation 'clear nil t 1 nil
919 '(lambda (s e l r) 1016 '(lambda (s e l r)
920 (when arg 1017 (when arg
921 (skip-syntax-backward " " (line-beginning-position)) 1018 (skip-syntax-backward " " (line-beginning-position))
@@ -927,7 +1024,7 @@ With prefix arg, also delete whitespace to the left of that column."
927 "Blank out CUA rectangle. 1024 "Blank out CUA rectangle.
928The text previously in the rectangle is overwritten by the blanks." 1025The text previously in the rectangle is overwritten by the blanks."
929 (interactive) 1026 (interactive)
930 (cua--rectangle-operation 'keep nil nil 1 1027 (cua--rectangle-operation 'keep nil nil 1 nil
931 '(lambda (s e l r) 1028 '(lambda (s e l r)
932 (goto-char e) 1029 (goto-char e)
933 (skip-syntax-forward " " (line-end-position)) 1030 (skip-syntax-forward " " (line-end-position))
@@ -942,7 +1039,7 @@ The text previously in the rectangle is overwritten by the blanks."
942 "Align rectangle lines to left column." 1039 "Align rectangle lines to left column."
943 (interactive) 1040 (interactive)
944 (let (x) 1041 (let (x)
945 (cua--rectangle-operation 'clear nil t t 1042 (cua--rectangle-operation 'clear nil t t nil
946 '(lambda (s e l r) 1043 '(lambda (s e l r)
947 (let ((b (line-beginning-position))) 1044 (let ((b (line-beginning-position)))
948 (skip-syntax-backward "^ " b) 1045 (skip-syntax-backward "^ " b)
@@ -984,7 +1081,7 @@ The text previously in the rectangle is overwritten by the blanks."
984 "Replace CUA rectangle contents with STRING on each line. 1081 "Replace CUA rectangle contents with STRING on each line.
985The length of STRING need not be the same as the rectangle width." 1082The length of STRING need not be the same as the rectangle width."
986 (interactive "sString rectangle: ") 1083 (interactive "sString rectangle: ")
987 (cua--rectangle-operation 'keep nil t t 1084 (cua--rectangle-operation 'keep nil t t nil
988 '(lambda (s e l r) 1085 '(lambda (s e l r)
989 (delete-region s e) 1086 (delete-region s e)
990 (skip-chars-forward " \t") 1087 (skip-chars-forward " \t")
@@ -999,7 +1096,7 @@ The length of STRING need not be the same as the rectangle width."
999(defun cua-fill-char-rectangle (ch) 1096(defun cua-fill-char-rectangle (ch)
1000 "Replace CUA rectangle contents with CHARACTER." 1097 "Replace CUA rectangle contents with CHARACTER."
1001 (interactive "cFill rectangle with character: ") 1098 (interactive "cFill rectangle with character: ")
1002 (cua--rectangle-operation 'clear nil t 1 1099 (cua--rectangle-operation 'clear nil t 1 nil
1003 '(lambda (s e l r) 1100 '(lambda (s e l r)
1004 (delete-region s e) 1101 (delete-region s e)
1005 (move-to-column l t) 1102 (move-to-column l t)
@@ -1010,7 +1107,7 @@ The length of STRING need not be the same as the rectangle width."
1010 (interactive "sReplace regexp: \nsNew text: ") 1107 (interactive "sReplace regexp: \nsNew text: ")
1011 (if buffer-read-only 1108 (if buffer-read-only
1012 (message "Cannot replace in read-only buffer") 1109 (message "Cannot replace in read-only buffer")
1013 (cua--rectangle-operation 'keep nil t 1 1110 (cua--rectangle-operation 'keep nil t 1 nil
1014 '(lambda (s e l r) 1111 '(lambda (s e l r)
1015 (if (re-search-forward regexp e t) 1112 (if (re-search-forward regexp e t)
1016 (replace-match newtext nil nil)))))) 1113 (replace-match newtext nil nil))))))
@@ -1018,7 +1115,7 @@ The length of STRING need not be the same as the rectangle width."
1018(defun cua-incr-rectangle (increment) 1115(defun cua-incr-rectangle (increment)
1019 "Increment each line of CUA rectangle by prefix amount." 1116 "Increment each line of CUA rectangle by prefix amount."
1020 (interactive "p") 1117 (interactive "p")
1021 (cua--rectangle-operation 'keep nil t 1 1118 (cua--rectangle-operation 'keep nil t 1 nil
1022 '(lambda (s e l r) 1119 '(lambda (s e l r)
1023 (cond 1120 (cond
1024 ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t) 1121 ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
@@ -1051,36 +1148,36 @@ The numbers are formatted according to the FORMAT string."
1051 (if (= (length fmt) 0) 1148 (if (= (length fmt) 0)
1052 (setq fmt cua--rectangle-seq-format) 1149 (setq fmt cua--rectangle-seq-format)
1053 (setq cua--rectangle-seq-format fmt)) 1150 (setq cua--rectangle-seq-format fmt))
1054 (cua--rectangle-operation 'clear nil t 1 1151 (cua--rectangle-operation 'clear nil t 1 nil
1055 '(lambda (s e l r) 1152 '(lambda (s e l r)
1056 (delete-region s e) 1153 (delete-region s e)
1057 (insert (format fmt first)) 1154 (insert (format fmt first))
1058 (setq first (+ first incr))))) 1155 (setq first (+ first incr)))))
1059 1156
1060(defmacro cua--convert-rectangle-as (command) 1157(defmacro cua--convert-rectangle-as (command tabify)
1061 `(cua--rectangle-operation 'clear nil nil nil 1158 `(cua--rectangle-operation 'clear nil nil nil ,tabify
1062 '(lambda (s e l r) 1159 '(lambda (s e l r)
1063 (,command s e)))) 1160 (,command s e))))
1064 1161
1065(defun cua-upcase-rectangle () 1162(defun cua-upcase-rectangle ()
1066 "Convert the rectangle to upper case." 1163 "Convert the rectangle to upper case."
1067 (interactive) 1164 (interactive)
1068 (cua--convert-rectangle-as upcase-region)) 1165 (cua--convert-rectangle-as upcase-region nil))
1069 1166
1070(defun cua-downcase-rectangle () 1167(defun cua-downcase-rectangle ()
1071 "Convert the rectangle to lower case." 1168 "Convert the rectangle to lower case."
1072 (interactive) 1169 (interactive)
1073 (cua--convert-rectangle-as downcase-region)) 1170 (cua--convert-rectangle-as downcase-region nil))
1074 1171
1075(defun cua-upcase-initials-rectangle () 1172(defun cua-upcase-initials-rectangle ()
1076 "Convert the rectangle initials to upper case." 1173 "Convert the rectangle initials to upper case."
1077 (interactive) 1174 (interactive)
1078 (cua--convert-rectangle-as upcase-initials-region)) 1175 (cua--convert-rectangle-as upcase-initials-region nil))
1079 1176
1080(defun cua-capitalize-rectangle () 1177(defun cua-capitalize-rectangle ()
1081 "Convert the rectangle to proper case." 1178 "Convert the rectangle to proper case."
1082 (interactive) 1179 (interactive)
1083 (cua--convert-rectangle-as capitalize-region)) 1180 (cua--convert-rectangle-as capitalize-region nil))
1084 1181
1085 1182
1086;;; Replace/rearrange text in current rectangle 1183;;; Replace/rearrange text in current rectangle
@@ -1116,7 +1213,7 @@ The numbers are formatted according to the FORMAT string."
1116 (setq z (reverse z)) 1213 (setq z (reverse z))
1117 (if cua--debug 1214 (if cua--debug
1118 (print z auxbuf)) 1215 (print z auxbuf))
1119 (cua--rectangle-operation nil nil t pad 1216 (cua--rectangle-operation nil nil t pad nil
1120 '(lambda (s e l r) 1217 '(lambda (s e l r)
1121 (let (cc) 1218 (let (cc)
1122 (goto-char e) 1219 (goto-char e)
@@ -1232,9 +1329,9 @@ With prefix arg, indent to that column."
1232 "Delete char to left or right of rectangle." 1329 "Delete char to left or right of rectangle."
1233 (interactive) 1330 (interactive)
1234 (let ((col (cua--rectangle-insert-col)) 1331 (let ((col (cua--rectangle-insert-col))
1235 (pad (cua--rectangle-padding)) 1332 (pad (cua--rectangle-virtual-edges))
1236 indent) 1333 indent)
1237 (cua--rectangle-operation 'corners nil t pad 1334 (cua--rectangle-operation 'corners nil t pad nil
1238 '(lambda (s e l r) 1335 '(lambda (s e l r)
1239 (move-to-column 1336 (move-to-column
1240 (if (cua--rectangle-right-side t) 1337 (if (cua--rectangle-right-side t)
@@ -1282,10 +1379,7 @@ With prefix arg, indent to that column."
1282 (cua--rectangle-left (current-column))) 1379 (cua--rectangle-left (current-column)))
1283 (if (>= (cua--rectangle-corner) 2) 1380 (if (>= (cua--rectangle-corner) 2)
1284 (cua--rectangle-bot t) 1381 (cua--rectangle-bot t)
1285 (cua--rectangle-top t)) 1382 (cua--rectangle-top t))))
1286 (if (cua--rectangle-padding)
1287 (setq unread-command-events
1288 (cons (if cua-use-hyper-key ?\H-P ?\M-P) unread-command-events)))))
1289 (if cua--rectangle 1383 (if cua--rectangle
1290 (if (and mark-active 1384 (if (and mark-active
1291 (not deactivate-mark)) 1385 (not deactivate-mark))
@@ -1379,7 +1473,7 @@ With prefix arg, indent to that column."
1379 (cua--rect-M/H-key ?m 'cua-copy-rectangle-as-text) 1473 (cua--rect-M/H-key ?m 'cua-copy-rectangle-as-text)
1380 (cua--rect-M/H-key ?n 'cua-sequence-rectangle) 1474 (cua--rect-M/H-key ?n 'cua-sequence-rectangle)
1381 (cua--rect-M/H-key ?o 'cua-open-rectangle) 1475 (cua--rect-M/H-key ?o 'cua-open-rectangle)
1382 (cua--rect-M/H-key ?p 'cua-toggle-rectangle-padding) 1476 (cua--rect-M/H-key ?p 'cua-toggle-rectangle-virtual-edges)
1383 (cua--rect-M/H-key ?P 'cua-do-rectangle-padding) 1477 (cua--rect-M/H-key ?P 'cua-do-rectangle-padding)
1384 (cua--rect-M/H-key ?q 'cua-refill-rectangle) 1478 (cua--rect-M/H-key ?q 'cua-refill-rectangle)
1385 (cua--rect-M/H-key ?r 'cua-replace-in-rectangle) 1479 (cua--rect-M/H-key ?r 'cua-replace-in-rectangle)
diff --git a/lisp/ielm.el b/lisp/ielm.el
index 944e2453cb9..96969bfc878 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -198,7 +198,7 @@ This variable is buffer-local.")
198;;; Completion stuff 198;;; Completion stuff
199 199
200(defun ielm-tab nil 200(defun ielm-tab nil
201 "Possibly indent the current line as lisp code." 201 "Possibly indent the current line as Lisp code."
202 (interactive) 202 (interactive)
203 (if (or (eq (preceding-char) ?\n) 203 (if (or (eq (preceding-char) ?\n)
204 (eq (char-syntax (preceding-char)) ? )) 204 (eq (char-syntax (preceding-char)) ? ))
@@ -207,7 +207,7 @@ This variable is buffer-local.")
207 t))) 207 t)))
208 208
209(defun ielm-complete-symbol nil 209(defun ielm-complete-symbol nil
210 "Complete the lisp symbol before point." 210 "Complete the Lisp symbol before point."
211 ;; A wrapper for lisp-complete symbol that returns non-nil if 211 ;; A wrapper for lisp-complete symbol that returns non-nil if
212 ;; completion has occurred 212 ;; completion has occurred
213 (let* ((btick (buffer-modified-tick)) 213 (let* ((btick (buffer-modified-tick))
@@ -528,7 +528,7 @@ Customized bindings may be defined in `ielm-map', which currently contains:
528 (condition-case nil 528 (condition-case nil
529 (start-process "ielm" (current-buffer) "hexl") 529 (start-process "ielm" (current-buffer) "hexl")
530 (file-error (start-process "ielm" (current-buffer) "cat"))) 530 (file-error (start-process "ielm" (current-buffer) "cat")))
531 (process-kill-without-query (ielm-process)) 531 (set-process-query-on-exit-flag (ielm-process) nil)
532 (goto-char (point-max)) 532 (goto-char (point-max))
533 533
534 ;; Lisp output can include raw characters that confuse comint's 534 ;; Lisp output can include raw characters that confuse comint's
diff --git a/lisp/indent.el b/lisp/indent.el
index e56db11b6f1..2d223b05ad6 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -442,8 +442,8 @@ This should be a list of integers, ordered from smallest to largest."
442 "Keymap used in `edit-tab-stops'.") 442 "Keymap used in `edit-tab-stops'.")
443 443
444(defvar edit-tab-stops-buffer nil 444(defvar edit-tab-stops-buffer nil
445 "Buffer whose tab stops are being edited--in case 445 "Buffer whose tab stops are being edited.
446the variable `tab-stop-list' is local in that buffer.") 446This matters if the variable `tab-stop-list' is local in that buffer.")
447 447
448(defun edit-tab-stops () 448(defun edit-tab-stops ()
449 "Edit the tab stops used by `tab-to-tab-stop'. 449 "Edit the tab stops used by `tab-to-tab-stop'.
diff --git a/lisp/international/utf-8.el b/lisp/international/utf-8.el
index bad79b58743..5a7acee0f0e 100644
--- a/lisp/international/utf-8.el
+++ b/lisp/international/utf-8.el
@@ -870,7 +870,9 @@ Also compose particular scripts if `utf-8-compose-scripts' is non-nil."
870 ;; version of the string in the loop, since it's always loaded as 870 ;; version of the string in the loop, since it's always loaded as
871 ;; unibyte from a byte-compiled file. 871 ;; unibyte from a byte-compiled file.
872 (let ((range (string-as-multibyte "^\xc0-\xc3\xe1-\xf7")) 872 (let ((range (string-as-multibyte "^\xc0-\xc3\xe1-\xf7"))
873 (buffer-multibyte enable-multibyte-characters)
873 hash-table ch) 874 hash-table ch)
875 (set-buffer-multibyte t)
874 (when utf-translate-cjk-mode 876 (when utf-translate-cjk-mode
875 (if (not utf-translate-cjk-lang-env) 877 (if (not utf-translate-cjk-lang-env)
876 ;; Check these characters: 878 ;; Check these characters:
@@ -893,7 +895,9 @@ Also compose particular scripts if `utf-8-compose-scripts' is non-nil."
893 (progn 895 (progn
894 (insert ch) 896 (insert ch)
895 (delete-char 1)) 897 (delete-char 1))
896 (forward-char 1))))) 898 (forward-char 1))))
899 (or buffer-multibyte
900 (set-buffer-multibyte nil)))
897 901
898 (when (and utf-8-compose-scripts (> length 1)) 902 (when (and utf-8-compose-scripts (> length 1))
899 ;; These currently have definitions which cover the relevant 903 ;; These currently have definitions which cover the relevant
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 990291caead..dd1062da816 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,5 +1,40 @@
12004-08-21 Bill Wohler <wohler@newt.com> 12004-08-21 Bill Wohler <wohler@newt.com>
2 2
3 * Released MH-E version 7.82.
4
5 * MH-E-NEWS, README: Updated for release 7.82.
6
7 * mh-e.el (Version, mh-version): Updated for release 7.82.
8
92004-08-24 Bill Wohler <wohler@newt.com>
10
11 * mh-init.el (mh-variant-set): Changed MH to mh as that's what is
12 emitted by `mh-variant-mh-info' (closes SF #1014781).
13 (mh-variant-p): Added mu-mh to docstring.
14
152004-08-23 Satyaki Das <satyaki@theforce.stanford.edu>
16
17 * mh-acros.el (mh-require-cl): Remove unneeded autoloads.
18 (require): Add an advice to the function so that at compile time
19 the uncompiled file is loaded. This avoids compilation problems
20 when built in the Emacs tree.
21
22 * mh-mime.el (mh-identity-pgg-default-user-id): Defvar the
23 variable, to avoid compiler warnings.
24
25 * mh-e.el (mh-seq): Load mh-seq since functions defined there are
26 used here. Without this, the state mh-seq.elc would be loaded.
27
28 * mh-customize.el (mh-init, mh-identity): Load mh-init and
29 mh-identity at compile time manually, before the corresponding
30 stale elc files get autoloaded.
31
322004-08-21 Bill Wohler <wohler@newt.com>
33
34 * mh-e.el (Version, mh-version): Added +cvs to release number.
35
362004-08-21 Bill Wohler <wohler@newt.com>
37
3 * Released MH-E version 7.81. 38 * Released MH-E version 7.81.
4 39
5 * MH-E-NEWS, README: Updated for release 7.81. 40 * MH-E-NEWS, README: Updated for release 7.81.
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index dd8660a8ce3..16383304503 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -51,12 +51,7 @@ Some versions of `cl' produce code for the expansion of
51\(setf (gethash ...) ...) that uses functions in `cl' at run time. This macro 51\(setf (gethash ...) ...) that uses functions in `cl' at run time. This macro
52recognizes that and loads `cl' where appropriate." 52recognizes that and loads `cl' where appropriate."
53 (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash) 53 (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash)
54 `(progn 54 `(require 'cl)
55 (require 'cl)
56 ;; Autoloads of CL functions go here...
57 (autoload 'cl-puthash "cl")
58 (autoload 'values "cl")
59 (autoload 'copy-tree "cl"))
60 `(eval-when-compile (require 'cl)))) 55 `(eval-when-compile (require 'cl))))
61 56
62;;; Macros to generate correct code for different emacs variants 57;;; Macros to generate correct code for different emacs variants
@@ -130,6 +125,12 @@ various structure fields. Lookup `defstruct' for more details."
130 (list 'nth ,x z))) 125 (list 'nth ,x z)))
131 (quote ,struct-name)))) 126 (quote ,struct-name))))
132 127
128(defadvice require (around mh-prefer-el activate)
129 "Modify `require' to load uncompiled MH-E files."
130 (or (featurep (ad-get-arg 0))
131 (and (string-match "^mh-" (symbol-name (ad-get-arg 0)))
132 (load (format "%s.el" (ad-get-arg 0)) t t))
133 ad-do-it))
133 134
134(provide 'mh-acros) 135(provide 'mh-acros)
135 136
diff --git a/lisp/mh-e/mh-customize.el b/lisp/mh-e/mh-customize.el
index 67a126a8327..622c457897f 100644
--- a/lisp/mh-e/mh-customize.el
+++ b/lisp/mh-e/mh-customize.el
@@ -78,6 +78,13 @@
78(when mh-xemacs-flag 78(when mh-xemacs-flag
79 (require 'mh-xemacs)) 79 (require 'mh-xemacs))
80 80
81;; XXX: Functions autoloaded from the following files are used to initialize
82;; customizable variables. They are require'd here, since otherwise the
83;; corresponding .elc would be loaded at compile time.
84(eval-when-compile
85 (require 'mh-init)
86 (require 'mh-identity))
87
81(defun mh-customize (&optional delete-other-windows-flag) 88(defun mh-customize (&optional delete-other-windows-flag)
82 "Customize MH-E variables. 89 "Customize MH-E variables.
83If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other windows in 90If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other windows in
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 5cbb97b72d0..2081d49b6cd 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -5,7 +5,7 @@
5 5
6;; Author: Bill Wohler <wohler@newt.com> 6;; Author: Bill Wohler <wohler@newt.com>
7;; Maintainer: Bill Wohler <wohler@newt.com> 7;; Maintainer: Bill Wohler <wohler@newt.com>
8;; Version: 7.81 8;; Version: 7.82
9;; Keywords: mail 9;; Keywords: mail
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
@@ -89,6 +89,7 @@
89(require 'mh-utils) 89(require 'mh-utils)
90(require 'mh-init) 90(require 'mh-init)
91(require 'mh-inc) 91(require 'mh-inc)
92(require 'mh-seq)
92(require 'gnus-util) 93(require 'gnus-util)
93(require 'easymenu) 94(require 'easymenu)
94 95
@@ -96,7 +97,7 @@
96(defvar font-lock-auto-fontify) 97(defvar font-lock-auto-fontify)
97(defvar font-lock-defaults) 98(defvar font-lock-defaults)
98 99
99(defconst mh-version "7.81" "Version number of MH-E.") 100(defconst mh-version "7.82" "Version number of MH-E.")
100 101
101;;; Autoloads 102;;; Autoloads
102(autoload 'Info-goto-node "info") 103(autoload 'Info-goto-node "info")
diff --git a/lisp/mh-e/mh-init.el b/lisp/mh-e/mh-init.el
index ac7305fa217..a975b882128 100644
--- a/lisp/mh-e/mh-init.el
+++ b/lisp/mh-e/mh-init.el
@@ -90,7 +90,7 @@ GNU mailutils."
90 (cond 90 (cond
91 ((mh-variant-set-variant 'nmh) 91 ((mh-variant-set-variant 'nmh)
92 (message "%s installed as MH variant" mh-variant-in-use)) 92 (message "%s installed as MH variant" mh-variant-in-use))
93 ((mh-variant-set-variant 'MH) 93 ((mh-variant-set-variant 'mh)
94 (message "%s installed as MH variant" mh-variant-in-use)) 94 (message "%s installed as MH variant" mh-variant-in-use))
95 ((mh-variant-set-variant 'mu-mh) 95 ((mh-variant-set-variant 'mu-mh)
96 (message "%s installed as MH variant" mh-variant-in-use)) 96 (message "%s installed as MH variant" mh-variant-in-use))
@@ -145,7 +145,7 @@ If VARIANT is a symbol, select the first entry that matches that variant."
145;;;###mh-autoload 145;;;###mh-autoload
146(defun mh-variant-p (&rest variants) 146(defun mh-variant-p (&rest variants)
147 "Return t if variant is any of VARIANTS. 147 "Return t if variant is any of VARIANTS.
148Currently known variants are 'mh and 'nmh." 148Currently known variants are 'MH, 'nmh, and 'mu-mh."
149 (let ((variant-in-use 149 (let ((variant-in-use
150 (cadr (assoc 'variant (assoc mh-variant-in-use mh-variants))))) 150 (cadr (assoc 'variant (assoc mh-variant-in-use mh-variants)))))
151 (not (null (member variant-in-use variants))))) 151 (not (null (member variant-in-use variants)))))
diff --git a/lisp/mh-e/mh-loaddefs.el b/lisp/mh-e/mh-loaddefs.el
index 6a88278a847..fd989ffa3b9 100644
--- a/lisp/mh-e/mh-loaddefs.el
+++ b/lisp/mh-e/mh-loaddefs.el
@@ -13,7 +13,7 @@
13;;;;;; mh-check-whom mh-insert-signature mh-to-fcc mh-to-field mh-fill-paragraph-function 13;;;;;; mh-check-whom mh-insert-signature mh-to-fcc mh-to-field mh-fill-paragraph-function
14;;;;;; mh-get-header-field mh-send-other-window mh-send mh-reply 14;;;;;; mh-get-header-field mh-send-other-window mh-send mh-reply
15;;;;;; mh-redistribute mh-forward mh-extract-rejected-mail mh-edit-again) 15;;;;;; mh-redistribute mh-forward mh-extract-rejected-mail mh-edit-again)
16;;;;;; "mh-comp" "mh-comp.el" (16665 55172)) 16;;;;;; "mh-comp" "mh-comp.el" (16665 53716))
17;;; Generated autoloads from mh-comp.el 17;;; Generated autoloads from mh-comp.el
18 18
19(autoload (quote mh-edit-again) "mh-comp" "\ 19(autoload (quote mh-edit-again) "mh-comp" "\
@@ -183,7 +183,7 @@ If we are at the first header field go to the start of the message body." t nil)
183;;;;;; mh-store-msg mh-undo-folder mh-sort-folder mh-page-digest-backwards 183;;;;;; mh-store-msg mh-undo-folder mh-sort-folder mh-page-digest-backwards
184;;;;;; mh-page-digest mh-pipe-msg mh-pack-folder mh-list-folders 184;;;;;; mh-page-digest mh-pipe-msg mh-pack-folder mh-list-folders
185;;;;;; mh-kill-folder mh-copy-msg mh-burst-digest) "mh-funcs" "mh-funcs.el" 185;;;;;; mh-kill-folder mh-copy-msg mh-burst-digest) "mh-funcs" "mh-funcs.el"
186;;;;;; (16671 49652)) 186;;;;;; (16671 48788))
187;;; Generated autoloads from mh-funcs.el 187;;; Generated autoloads from mh-funcs.el
188 188
189(autoload (quote mh-burst-digest) "mh-funcs" "\ 189(autoload (quote mh-burst-digest) "mh-funcs" "\
@@ -261,7 +261,7 @@ Display cheat sheet for the commands of the current prefix in minibuffer." t nil
261;;;;;; mh-identity-insert-attribution-verb mh-identity-handler-attribution-verb 261;;;;;; mh-identity-insert-attribution-verb mh-identity-handler-attribution-verb
262;;;;;; mh-identity-handler-signature mh-identity-handler-gpg-identity 262;;;;;; mh-identity-handler-signature mh-identity-handler-gpg-identity
263;;;;;; mh-insert-identity mh-identity-list-set mh-identity-make-menu) 263;;;;;; mh-insert-identity mh-identity-list-set mh-identity-make-menu)
264;;;;;; "mh-identity" "mh-identity.el" (16680 7172)) 264;;;;;; "mh-identity" "mh-identity.el" (16671 57010))
265;;; Generated autoloads from mh-identity.el 265;;; Generated autoloads from mh-identity.el
266 266
267(autoload (quote mh-identity-make-menu) "mh-identity" "\ 267(autoload (quote mh-identity-make-menu) "mh-identity" "\
@@ -307,7 +307,7 @@ If the field wasn't present, the VALUE is added at the bottom of the header." ni
307;;;*** 307;;;***
308 308
309;;;### (autoloads (mh-inc-spool-list-set) "mh-inc" "mh-inc.el" (16671 309;;;### (autoloads (mh-inc-spool-list-set) "mh-inc" "mh-inc.el" (16671
310;;;;;; 49652)) 310;;;;;; 48848))
311;;; Generated autoloads from mh-inc.el 311;;; Generated autoloads from mh-inc.el
312 312
313(autoload (quote mh-inc-spool-list-set) "mh-inc" "\ 313(autoload (quote mh-inc-spool-list-set) "mh-inc" "\
@@ -326,7 +326,7 @@ This is called after 'customize is used to alter `mh-inc-spool-list'." nil nil)
326;;;;;; mh-index-parse-search-regexp mh-index-do-search mh-index-p 326;;;;;; mh-index-parse-search-regexp mh-index-do-search mh-index-p
327;;;;;; mh-index-read-data mh-index-search mh-index-create-sequences 327;;;;;; mh-index-read-data mh-index-search mh-index-create-sequences
328;;;;;; mh-create-sequence-map mh-index-update-maps) "mh-index" "mh-index.el" 328;;;;;; mh-create-sequence-map mh-index-update-maps) "mh-index" "mh-index.el"
329;;;;;; (16665 55172)) 329;;;;;; (16665 53754))
330;;; Generated autoloads from mh-index.el 330;;; Generated autoloads from mh-index.el
331 331
332(autoload (quote mh-index-update-maps) "mh-index" "\ 332(autoload (quote mh-index-update-maps) "mh-index" "\
@@ -582,7 +582,7 @@ system." nil nil)
582;;;*** 582;;;***
583 583
584;;;### (autoloads (mh-variants mh-variant-p mh-variant-set) "mh-init" 584;;;### (autoloads (mh-variants mh-variant-p mh-variant-set) "mh-init"
585;;;;;; "mh-init.el" (16680 9361)) 585;;;;;; "mh-init.el" (16684 6777))
586;;; Generated autoloads from mh-init.el 586;;; Generated autoloads from mh-init.el
587 587
588(autoload (quote mh-variant-set) "mh-init" "\ 588(autoload (quote mh-variant-set) "mh-init" "\
@@ -593,7 +593,7 @@ GNU mailutils." t nil)
593 593
594(autoload (quote mh-variant-p) "mh-init" "\ 594(autoload (quote mh-variant-p) "mh-init" "\
595Return t if variant is any of VARIANTS. 595Return t if variant is any of VARIANTS.
596Currently known variants are 'mh and 'nmh." nil nil) 596Currently known variants are 'MH, 'nmh, and 'mu-mh." nil nil)
597 597
598(autoload (quote mh-variants) "mh-init" "\ 598(autoload (quote mh-variants) "mh-init" "\
599Return a list of installed variants of MH on the system. 599Return a list of installed variants of MH on the system.
@@ -604,7 +604,7 @@ by the variable `mh-variants'." nil nil)
604;;;*** 604;;;***
605 605
606;;;### (autoloads (mh-junk-whitelist mh-junk-blacklist) "mh-junk" 606;;;### (autoloads (mh-junk-whitelist mh-junk-blacklist) "mh-junk"
607;;;;;; "mh-junk.el" (16671 49652)) 607;;;;;; "mh-junk.el" (16671 48929))
608;;; Generated autoloads from mh-junk.el 608;;; Generated autoloads from mh-junk.el
609 609
610(autoload (quote mh-junk-blacklist) "mh-junk" "\ 610(autoload (quote mh-junk-blacklist) "mh-junk" "\
@@ -644,7 +644,7 @@ The `mh-junk-program' option specifies the spam program in use." t nil)
644;;;;;; mh-mhn-compose-external-compressed-tar mh-mhn-compose-anon-ftp 644;;;;;; mh-mhn-compose-external-compressed-tar mh-mhn-compose-anon-ftp
645;;;;;; mh-mhn-compose-insertion mh-file-mime-type mh-have-file-command 645;;;;;; mh-mhn-compose-insertion mh-file-mime-type mh-have-file-command
646;;;;;; mh-compose-forward mh-compose-insertion) "mh-mime" "mh-mime.el" 646;;;;;; mh-compose-forward mh-compose-insertion) "mh-mime" "mh-mime.el"
647;;;;;; (16680 7172)) 647;;;;;; (16684 7323))
648;;; Generated autoloads from mh-mime.el 648;;; Generated autoloads from mh-mime.el
649 649
650(autoload (quote mh-compose-insertion) "mh-mime" "\ 650(autoload (quote mh-compose-insertion) "mh-mime" "\
@@ -857,7 +857,7 @@ View MIME PART-INDEX externally." t nil)
857;;;*** 857;;;***
858 858
859;;;### (autoloads (mh-do-search mh-pick-do-search mh-search-folder) 859;;;### (autoloads (mh-do-search mh-pick-do-search mh-search-folder)
860;;;;;; "mh-pick" "mh-pick.el" (16671 49652)) 860;;;;;; "mh-pick" "mh-pick.el" (16671 49140))
861;;; Generated autoloads from mh-pick.el 861;;; Generated autoloads from mh-pick.el
862 862
863(autoload (quote mh-search-folder) "mh-pick" "\ 863(autoload (quote mh-search-folder) "mh-pick" "\
@@ -882,7 +882,7 @@ indexing program specified in `mh-index-program' is used." t nil)
882 882
883;;;### (autoloads (mh-print-msg mh-ps-print-toggle-mime mh-ps-print-toggle-color 883;;;### (autoloads (mh-print-msg mh-ps-print-toggle-mime mh-ps-print-toggle-color
884;;;;;; mh-ps-print-toggle-faces mh-ps-print-msg-show mh-ps-print-msg-file 884;;;;;; mh-ps-print-toggle-faces mh-ps-print-msg-show mh-ps-print-msg-file
885;;;;;; mh-ps-print-msg) "mh-print" "mh-print.el" (16680 9361)) 885;;;;;; mh-ps-print-msg) "mh-print" "mh-print.el" (16680 11171))
886;;; Generated autoloads from mh-print.el 886;;; Generated autoloads from mh-print.el
887 887
888(autoload (quote mh-ps-print-msg) "mh-print" "\ 888(autoload (quote mh-ps-print-msg) "mh-print" "\
@@ -935,7 +935,7 @@ The messages are formatted by mhl. See the variable `mhl-formfile'." t nil)
935;;;;;; mh-rename-seq mh-translate-range mh-read-range mh-read-seq-default 935;;;;;; mh-rename-seq mh-translate-range mh-read-range mh-read-seq-default
936;;;;;; mh-notate-deleted-and-refiled mh-widen mh-put-msg-in-seq 936;;;;;; mh-notate-deleted-and-refiled mh-widen mh-put-msg-in-seq
937;;;;;; mh-narrow-to-seq mh-msg-is-in-seq mh-list-sequences mh-delete-seq) 937;;;;;; mh-narrow-to-seq mh-msg-is-in-seq mh-list-sequences mh-delete-seq)
938;;;;;; "mh-seq" "mh-seq.el" (16668 22297)) 938;;;;;; "mh-seq" "mh-seq.el" (16671 65286))
939;;; Generated autoloads from mh-seq.el 939;;; Generated autoloads from mh-seq.el
940 940
941(autoload (quote mh-delete-seq) "mh-seq" "\ 941(autoload (quote mh-delete-seq) "mh-seq" "\
@@ -1157,7 +1157,7 @@ Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command." t nil)
1157 1157
1158;;;### (autoloads (mh-speed-add-folder mh-speed-invalidate-map mh-speed-flists 1158;;;### (autoloads (mh-speed-add-folder mh-speed-invalidate-map mh-speed-flists
1159;;;;;; mh-speed-view mh-speed-toggle mh-folder-speedbar-buttons) 1159;;;;;; mh-speed-view mh-speed-toggle mh-folder-speedbar-buttons)
1160;;;;;; "mh-speed" "mh-speed.el" (16665 55171)) 1160;;;;;; "mh-speed" "mh-speed.el" (16665 53793))
1161;;; Generated autoloads from mh-speed.el 1161;;; Generated autoloads from mh-speed.el
1162 1162
1163(autoload (quote mh-folder-speedbar-buttons) "mh-speed" "\ 1163(autoload (quote mh-folder-speedbar-buttons) "mh-speed" "\
@@ -1196,7 +1196,7 @@ The function invalidates the latest ancestor that is present." nil nil)
1196;;;;;; mh-alias-grab-from-field mh-alias-add-alias mh-alias-for-from-p 1196;;;;;; mh-alias-grab-from-field mh-alias-add-alias mh-alias-for-from-p
1197;;;;;; mh-alias-address-to-alias mh-alias-letter-expand-alias mh-alias-minibuffer-confirm-address 1197;;;;;; mh-alias-address-to-alias mh-alias-letter-expand-alias mh-alias-minibuffer-confirm-address
1198;;;;;; mh-read-address mh-alias-reload-maybe mh-alias-reload) "mh-alias" 1198;;;;;; mh-read-address mh-alias-reload-maybe mh-alias-reload) "mh-alias"
1199;;;;;; "mh-alias.el" (16671 49553)) 1199;;;;;; "mh-alias.el" (16671 49382))
1200;;; Generated autoloads from mh-alias.el 1200;;; Generated autoloads from mh-alias.el
1201 1201
1202(autoload (quote mh-alias-reload) "mh-alias" "\ 1202(autoload (quote mh-alias-reload) "mh-alias" "\
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index f952f8b80fb..72cb654dedd 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -583,6 +583,8 @@ automatically."
583 (mml-insert-empty-tag 'part 'type type 'filename file 583 (mml-insert-empty-tag 'part 'type type 'filename file
584 'disposition dispos 'description description))) 584 'disposition dispos 'description description)))
585 585
586(defvar mh-identity-pgg-default-user-id)
587
586(defun mh-secure-message (method mode &optional identity) 588(defun mh-secure-message (method mode &optional identity)
587 "Add directive to Encrypt/Sign an entire message. 589 "Add directive to Encrypt/Sign an entire message.
588METHOD should be one of: \"pgpmime\", \"pgp\", \"smime\". 590METHOD should be one of: \"pgpmime\", \"pgp\", \"smime\".
@@ -852,7 +854,7 @@ If message has been encoded for transfer take that into account."
852;;;###mh-autoload 854;;;###mh-autoload
853(defun mh-toggle-mh-decode-mime-flag () 855(defun mh-toggle-mh-decode-mime-flag ()
854 "Toggle whether MH-E should decode MIME or not." 856 "Toggle whether MH-E should decode MIME or not."
855 (interactive) 857 (interactive)
856 (setq mh-decode-mime-flag (not mh-decode-mime-flag)) 858 (setq mh-decode-mime-flag (not mh-decode-mime-flag))
857 (mh-show nil t) 859 (mh-show nil t)
858 (message (format "(setq mh-decode-mime-flag %s)" mh-decode-mime-flag))) 860 (message (format "(setq mh-decode-mime-flag %s)" mh-decode-mime-flag)))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 4464df3a916..ddbd2ce6f35 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -772,26 +772,6 @@ Assumes the tags table is the current buffer."
772 (all-completions string (tags-completion-table) predicate) 772 (all-completions string (tags-completion-table) predicate)
773 (try-completion string (tags-completion-table) predicate)))) 773 (try-completion string (tags-completion-table) predicate))))
774 774
775;; Return a default tag to search for, based on the text at point.
776(defun find-tag-default ()
777 (save-excursion
778 (while (looking-at "\\sw\\|\\s_")
779 (forward-char 1))
780 (if (or (re-search-backward "\\sw\\|\\s_"
781 (save-excursion (beginning-of-line) (point))
782 t)
783 (re-search-forward "\\(\\sw\\|\\s_\\)+"
784 (save-excursion (end-of-line) (point))
785 t))
786 (progn (goto-char (match-end 0))
787 (buffer-substring-no-properties
788 (point)
789 (progn (forward-sexp -1)
790 (while (looking-at "\\s'")
791 (forward-char 1))
792 (point))))
793 nil)))
794
795;; Read a tag name from the minibuffer with defaulting and completion. 775;; Read a tag name from the minibuffer with defaulting and completion.
796(defun find-tag-tag (string) 776(defun find-tag-tag (string)
797 (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) 777 (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 5b678f26171..f4acd564a3c 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -384,9 +384,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
384 (let ((tag-default 384 (let ((tag-default
385 (funcall (or find-tag-default-function 385 (funcall (or find-tag-default-function
386 (get major-mode 'find-tag-default-function) 386 (get major-mode 'find-tag-default-function)
387 ;; We use grep-tag-default instead of 387 'find-tag-default)))
388 ;; find-tag-default, to avoid loading etags.
389 'grep-tag-default)))
390 (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)") 388 (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)")
391 (grep-default (or (car grep-history) grep-command))) 389 (grep-default (or (car grep-history) grep-command)))
392 ;; Replace the thing matching for with that around cursor. 390 ;; Replace the thing matching for with that around cursor.
@@ -457,25 +455,6 @@ temporarily highlight in visited source lines."
457 (set (make-local-variable 'compilation-error-regexp-alist) 455 (set (make-local-variable 'compilation-error-regexp-alist)
458 grep-regexp-alist)) 456 grep-regexp-alist))
459 457
460;; This is a copy of find-tag-default from etags.el.
461;;;###autoload
462(defun grep-tag-default ()
463 (save-excursion
464 (while (looking-at "\\sw\\|\\s_")
465 (forward-char 1))
466 (when (or (re-search-backward "\\sw\\|\\s_"
467 (save-excursion (beginning-of-line) (point))
468 t)
469 (re-search-forward "\\(\\sw\\|\\s_\\)+"
470 (save-excursion (end-of-line) (point))
471 t))
472 (goto-char (match-end 0))
473 (buffer-substring (point)
474 (progn (forward-sexp -1)
475 (while (looking-at "\\s'")
476 (forward-char 1))
477 (point))))))
478
479;;;###autoload 458;;;###autoload
480(defun grep-find (command-args) 459(defun grep-find (command-args)
481 "Run grep via find, with user-specified args COMMAND-ARGS. 460 "Run grep via find, with user-specified args COMMAND-ARGS.
diff --git a/lisp/subr.el b/lisp/subr.el
index bac77872cf0..6676a6b7794 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1981,6 +1981,27 @@ Uses the `derived-mode-parent' property of the symbol to trace backwards."
1981 (setq parent (get parent 'derived-mode-parent)))) 1981 (setq parent (get parent 'derived-mode-parent))))
1982 parent)) 1982 parent))
1983 1983
1984(defun find-tag-default ()
1985 "Determine default tag to search for, based on text at point.
1986If there is no plausible default, return nil."
1987 (save-excursion
1988 (while (looking-at "\\sw\\|\\s_")
1989 (forward-char 1))
1990 (if (or (re-search-backward "\\sw\\|\\s_"
1991 (save-excursion (beginning-of-line) (point))
1992 t)
1993 (re-search-forward "\\(\\sw\\|\\s_\\)+"
1994 (save-excursion (end-of-line) (point))
1995 t))
1996 (progn (goto-char (match-end 0))
1997 (buffer-substring-no-properties
1998 (point)
1999 (progn (forward-sexp -1)
2000 (while (looking-at "\\s'")
2001 (forward-char 1))
2002 (point))))
2003 nil)))
2004
1984(defmacro with-syntax-table (table &rest body) 2005(defmacro with-syntax-table (table &rest body)
1985 "Evaluate BODY with syntax table of current buffer set to TABLE. 2006 "Evaluate BODY with syntax table of current buffer set to TABLE.
1986The syntax table of the current buffer is saved, BODY is evaluated, and the 2007The syntax table of the current buffer is saved, BODY is evaluated, and the
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 28bf9f6cf28..1c4b89f0a62 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1141,10 +1141,14 @@ on the line for the invalidity you want to see."
1141 'occur-target tem))))) 1141 'occur-target tem)))))
1142 (goto-char prev-end)))) 1142 (goto-char prev-end))))
1143 (with-current-buffer standard-output 1143 (with-current-buffer standard-output
1144 (if (eq num-matches 0) 1144 (let ((no-matches (zerop num-matches)))
1145 (insert "None!\n")) 1145 (if no-matches
1146 (if (interactive-p) 1146 (insert "None!\n"))
1147 (message "%d mismatches found" num-matches)))))) 1147 (if (interactive-p)
1148 (message (cond (no-matches "No mismatches found")
1149 ((= num-matches 1) "1 mismatch found")
1150 (t "%d mismatches found"))
1151 num-matches)))))))
1148 1152
1149(defun tex-validate-region (start end) 1153(defun tex-validate-region (start end)
1150 "Check for mismatched braces or $'s in region. 1154 "Check for mismatched braces or $'s in region.
@@ -1459,7 +1463,7 @@ Mark is left at original location."
1459 nil) 1463 nil)
1460 (let ((proc (get-process "tex-shell"))) 1464 (let ((proc (get-process "tex-shell")))
1461 (set-process-sentinel proc 'tex-shell-sentinel) 1465 (set-process-sentinel proc 'tex-shell-sentinel)
1462 (process-kill-without-query proc) 1466 (set-process-query-on-exit-flag proc nil)
1463 (tex-shell) 1467 (tex-shell)
1464 (while (zerop (buffer-size)) 1468 (while (zerop (buffer-size))
1465 (sleep-for 1))))) 1469 (sleep-for 1)))))
@@ -1928,7 +1932,7 @@ for the error messages."
1928 (re-search-forward 1932 (re-search-forward
1929 "^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\)?\\(.*\\)$" nil 'move)) 1933 "^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\)?\\(.*\\)$" nil 'move))
1930 (let* ((this-error (copy-marker begin-of-error)) 1934 (let* ((this-error (copy-marker begin-of-error))
1931 (linenum (string-to-int (match-string 1))) 1935 (linenum (string-to-number (match-string 1)))
1932 (error-text (regexp-quote (match-string 3))) 1936 (error-text (regexp-quote (match-string 3)))
1933 (filename 1937 (filename
1934 (save-excursion 1938 (save-excursion