aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey2004-05-31 13:48:26 +0000
committerKaroly Lorentey2004-05-31 13:48:26 +0000
commit190a56d6e02f134591a9d8861b8c4aa55bbec79b (patch)
treed1ea16845ca26efed987116be6e6b4fc6fc60000 /lisp
parenta596810c6c3c3c2fd450717f5083a5ff5207d243 (diff)
parent64df673db44e48ae6e2f57849f42961a78103075 (diff)
downloademacs-190a56d6e02f134591a9d8861b8c4aa55bbec79b.tar.gz
emacs-190a56d6e02f134591a9d8861b8c4aa55bbec79b.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-356 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-183
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog155
-rw-r--r--lisp/autorevert.el8
-rw-r--r--lisp/dired.el4
-rw-r--r--lisp/dos-fns.el10
-rw-r--r--lisp/emacs-lisp/lisp-mode.el10
-rw-r--r--lisp/files.el31
-rw-r--r--lisp/font-lock.el1
-rw-r--r--lisp/imenu.el4
-rw-r--r--lisp/net/ange-ftp.el7
-rw-r--r--lisp/net/browse-url.el11
-rw-r--r--lisp/net/tramp-smb.el3
-rw-r--r--lisp/net/tramp-uu.el10
-rw-r--r--lisp/net/tramp.el129
-rw-r--r--lisp/progmodes/gdb-ui.el30
-rw-r--r--lisp/replace.el6
-rw-r--r--lisp/subr.el13
-rw-r--r--lisp/thumbs.el283
-rw-r--r--lisp/w32-fns.el10
-rw-r--r--lisp/window.el3
19 files changed, 527 insertions, 201 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 28f6d394230..bf08d2643f3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,158 @@
12004-05-30 Luc Teirlinck <teirllm@auburn.edu>
2
3 * replace.el (query-replace-interactive): Convert defvar into
4 defcustom.
5
6 * autorevert.el: Update `Commentary' section.
7
82004-05-30 Juanma Barranquero <lektu@terra.es>
9
10 * dos-fns.el (convert-standard-filename):
11 * files.el (convert-standard-filename):
12 * w32-fns.el (convert-standard-filename):
13 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
14
152004-05-30 Kai Grossjohann <kai.grossjohann@gmx.net>
16
17 Sync with Tramp.
18
19 * net/tramp.el (tramp-let-maybe): Reverse args of `get'.
20 (tramp-let-maybe): Move to an earlier spot in the file. Patch by
21 Andreas Schwab.
22
232004-05-30 Andreas Schwab <schwab@suse.de>
24
25 * dired.el (dired-get-filename): Don't use dired-re-dot.
26
272004-05-30 Richard M. Stallman <rms@gnu.org>
28
29 * files.el (find-file): Doc fix.
30
31 * font-lock.el (lisp-font-lock-keywords-2): Add multiple-value-bind.
32
332004-05-30 Nick Roberts <nickrob@gnu.org>
34
35 * progmodes/gdb-ui.el (gdb-current-frame, gud-watch)
36 (gdb-locals-mode, gdb-frame-handler): Display current frame in the
37 modeline of the locals buffer.
38 (gdb-goto-breakpoint): Handle gdbmi.
39 (gdb-get-frame-number): Change for gdbmi.
40
412004-05-30 Michael Albinus <michael.albinus@gmx.de>
42
43 * files.el (file-remote-p): Apply file name handler for operation
44 `file-remote-p'. It isn' a property any longer.
45 (file-relative-name): `fh' and `fd' get the required value via
46 `find-file-name-handler' already.
47
48 * ange-ftp.el (ange-ftp-file-remote-p): New defun.
49 (top): Remove setting of `file-remote-p' property for
50 `ange-ftp-hook-function'. Add `ange-ftp' property to
51 `file-remote-p'.
52
532004-05-29 Michael Albinus <michael.albinus@gmx.de>
54
55 Version 2.0.41 of Tramp released.
56
57 * tramp.el (tramp-wait-for-regexp, tramp-wait-for-output): Throw
58 away if process has died. Reported by Luc Teirlinck
59 <teirllm@dms.auburn.edu>.
60 (tramp-out-of-band-prompt-regexp): Renamed to
61 `tramp-process-alive-regexp', because its usage is widen.
62 (tramp-actions-copy-out-of-band): Apply it.
63 (tramp-actions-before-shell, tramp-multi-actions): Add
64 `tramp-action-process-alive' action.
65 (tramp-action-process-alive): New defun.
66 (tramp-file-name-handler-alist, tramp-file-name-for-operation):
67 Add entry for `file-remote-p'.
68 (tramp-handle-file-remote-p): New defun.
69 (top): Remove setting of `file-remote-p'. Don't set
70 `inhibit-file-name-handlers' and `inhibit-file-name-operation'.
71
72 * tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry for
73 `file-remote-p'.
74
75 * tramp-uu.el (tramp-uuencode-region): Padding characters aren't
76 counted for (last) line. Reported by Aaron Ucko
77 <ucko@ncbi.nlm.nih.gov>.
78
792004-05-29 Kai Grossjohann <kai.grossjohann@gmx.net>
80
81 * tramp.el (tramp-initial-commands): Add "unset HISTFILE"; this is
82 not really necessary but seems to keep the shell history smaller
83 in some cases. It is no substitute for setting HISTFILE and
84 HISTSIZE from tramp-open-connection-setup-interactive-shell,
85 though. Suggested by Luc Teirlinck.
86 (tramp-open-connection-setup-interactive-shell): Export variables
87 HISTFILE and HISTSIZE, do not just set them. From Luc Teirlinck.
88 (tramp-set-process-query-on-exit-flag): New compat function.
89 (tramp-open-connection-multi, tramp-open-connection-su)
90 (tramp-open-connection-rsh, tramp-open-connection-telnet)
91 (tramp-do-copy-or-rename-file-out-of-band): Use it.
92 (tramp-let-maybe): New macro, let-binds a variable only if it
93 isn't obsolete.
94 (tramp-check-ls-commands, tramp-handle-expand-file-name)
95 (tramp-handle-file-truename): Use it.
96 (tramp-completion-file-name-regexp-unified): Avoid matching
97 filenames starting with "/:" -- those are reserved for
98 file-name-non-special.
99
100 * tramp-smb.el (tramp-smb-open-connection): Use
101 tramp-set-process-query-on-exit-flag compat function.
102
1032004-05-29 Richard M. Stallman <rms@gnu.org>
104
105 * net/browse-url.el (browse-url-interactive-arg): Doc fix.
106
107 * emacs-lisp/lisp-mode.el (prin1-char): Catch errors from `string'.
108 (eval-last-sexp-print-value): Print char equivalent regardless
109 of standard-output value.
110
111 * thumbs.el (thumbs-subst-char-in-string): Deleted.
112 (thumbs-thumbname): Use subst-char-in-string.
113 (thumbs-resize-image): Use condition-case, not ignore-errors.
114 (thumbs-kill-buffer): Likewise.
115
116 * thumbs.el: Don't include cl. Don't bother with old Emacs versions.
117 (thumbs-mode): Make buffer read-only.
118 (thumbs-make-thumb): Unconditionally accept an existing file.
119 (thumbs-insert-thumb): Add thumb-image-file property to the image.
120 (thumbs-do-thumbs-insertion): Be smarter about where to put newlines.
121 (thumbs-show-thumbs-list): Error if images not supported.
122 (thumbs-save-current-image): Improve prompt string.
123 (thumbs-mode-map): Define u, R, x.
124 (thumbs-unmark): New command.
125 (thumbs-emboss-image): Minor cleanup.
126 (thumbs-forward-char, thumbs-backward-char): Skip chars with no image.
127 (thumbs-rename-images): New command.
128 (thumbs-show-image-num): Rewrite. Don't rename the buffer.
129
130 * thumbs.el (thumbs-current-image): New function.
131 (thumbs-file-list, thumbs-file-alist): New functions.
132 (thumbs-find-image): Delete arg L.
133 Don't set up thumbs-fileL as buffer-local global var.
134 (thumbs-find-image-at-point): Use thumbs-current-image.
135 (thumbs-set-image-at-point-to-root-window): Likewise.
136 (thumbs-delete-images): Use thumbs-current-image, thumbs-file-alist.
137 Record and warn about errors. Update thumbs-markedL for deletions.
138 (thumbs-next-image, thumbs-previous-image): Use thumbs-file-alist.
139 (thumbs-redraw-buffer): Use thumbs-file-list.
140 (thumbs-mark): Use thumbs-current-image.
141 (thumbs-show-name): Use thumbs-current-image.
142
143 * imenu.el (imenu--menubar-select): Set imenu-menubar-modified-tick
144 and imenu--last-menubar-index-alist.
145
146 * subr.el (with-selected-window): Undo previous change.
147
1482004-05-29 John Paul Wallington <jpw@gnu.org>
149
150 * thumbs.el (thumbs-show-name): Do nothing if no image at point.
151 (thumbs-mouse-find-image): New command.
152 (thumbs-mode-map): Bind it to mouse-2.
153 (thumbs-mode): Make mode-class special.
154 (thumbs-view-image-mode): Likewise.
155
12004-05-29 Pavel Kobiakov <pk_at_work@yahoo.com> 1562004-05-29 Pavel Kobiakov <pk_at_work@yahoo.com>
2 157
3 * flymake.el: New file. 158 * flymake.el: New file.
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 1ba48a54236..7987e880ec1 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -36,8 +36,12 @@
36;; Auto-Revert Mode. Both modes automatically revert buffers 36;; Auto-Revert Mode. Both modes automatically revert buffers
37;; whenever the corresponding files have been changed on disk. 37;; whenever the corresponding files have been changed on disk.
38;; 38;;
39;; Auto-Revert Mode can be activated for individual buffers. 39;; Auto-Revert Mode can be activated for individual buffers. Global
40;; Global Auto-Revert Mode applies to all file buffers. 40;; Auto-Revert Mode applies to all file buffers. (If the user option
41;; `global-auto-revert-non-file-buffers' is non-nil, it also applies
42;; to some non-file buffers. This option is disabled by default.)
43;; Since checking a remote file is too slow, these modes do not check
44;; or revert remote files.
41;; 45;;
42;; Both modes operate by checking the time stamp of all files at 46;; Both modes operate by checking the time stamp of all files at
43;; intervals of `auto-revert-interval'. The default is every five 47;; intervals of `auto-revert-interval'. The default is every five
diff --git a/lisp/dired.el b/lisp/dired.el
index 8bdfe1befce..3d4491cc819 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1634,9 +1634,7 @@ Otherwise, an error occurs in these cases."
1634 ((eq localp 'verbatim) 1634 ((eq localp 'verbatim)
1635 file) 1635 file)
1636 ((and (not no-error-if-not-filep) 1636 ((and (not no-error-if-not-filep)
1637 (save-excursion 1637 (member file '("." "..")))
1638 (beginning-of-line)
1639 (looking-at dired-re-dot)))
1640 (error "Cannot operate on `.' or `..'")) 1638 (error "Cannot operate on `.' or `..'"))
1641 ((and (eq localp 'no-dir) already-absolute) 1639 ((and (eq localp 'no-dir) already-absolute)
1642 (file-name-nondirectory file)) 1640 (file-name-nondirectory file))
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index 65b6c0063c0..1253b7b5811 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -31,9 +31,13 @@
31;; This overrides a trivial definition in files.el. 31;; This overrides a trivial definition in files.el.
32(defun convert-standard-filename (filename) 32(defun convert-standard-filename (filename)
33 "Convert a standard file's name to something suitable for the current OS. 33 "Convert a standard file's name to something suitable for the current OS.
34This function's standard definition is trivial; it just returns the argument. 34This means to guarantee valid names and perhaps to canonicalize
35However, on some systems, the function is redefined 35certain patterns.
36with a definition that really does change some file names." 36
37On Windows and DOS, replace invalid characters. On DOS, make
38sure to obey the 8.3 limitations. On Windows, turn Cygwin names
39into native names, and also turn slashes into backslashes if the
40shell requires it (see `w32-shell-dos-semantics')."
37 (if (or (not (stringp filename)) 41 (if (or (not (stringp filename))
38 ;; This catches the case where FILENAME is "x:" or "x:/" or 42 ;; This catches the case where FILENAME is "x:" or "x:/" or
39 ;; "/", thus preventing infinite recursion. 43 ;; "/", thus preventing infinite recursion.
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 1f53d9e630f..d6ac05642ba 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -470,7 +470,10 @@ If CHAR is not a character, return nil."
470 (cond 470 (cond
471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) 471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
472 ((eq c 127) "\\C-?") 472 ((eq c 127) "\\C-?")
473 (t (string c))))))) 473 (t
474 (condition-case nil
475 (string c)
476 (error nil))))))))
474 477
475(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) 478(defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
476 "Evaluate sexp before point; print value in minibuffer. 479 "Evaluate sexp before point; print value in minibuffer.
@@ -538,9 +541,8 @@ With argument, print output into current buffer."
538 end) 541 end)
539 (prog1 542 (prog1
540 (prin1 value) 543 (prin1 value)
541 (if (eq standard-output t) 544 (let ((str (eval-expression-print-format value)))
542 (let ((str (eval-expression-print-format value))) 545 (if str (princ str)))
543 (if str (princ str))))
544 (setq end (point)) 546 (setq end (point))
545 (when (and (bufferp standard-output) 547 (when (and (bufferp standard-output)
546 (or (not (null print-length)) 548 (or (not (null print-length))
diff --git a/lisp/files.el b/lisp/files.el
index 27e0ded28e2..81e014d2283 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -481,10 +481,15 @@ Runs the usual ange-ftp hook, but only for completion operations."
481 481
482(defun convert-standard-filename (filename) 482(defun convert-standard-filename (filename)
483 "Convert a standard file's name to something suitable for the current OS. 483 "Convert a standard file's name to something suitable for the current OS.
484This function's standard definition is trivial; it just returns the argument. 484This means to guarantee valid names and perhaps to canonicalize
485However, on some systems, the function is redefined with a definition 485certain patterns.
486that really does change some file names to canonicalize certain 486
487patterns and to guarantee valid names." 487This function's standard definition is trivial; it just returns
488the argument. However, on Windows and DOS, replace invalid
489characters. On DOS, make sure to obey the 8.3 limitations. On
490Windows, turn Cygwin names into native names, and also turn
491slashes into backslashes if the shell requires it (see
492`w32-shell-dos-semantics')."
488 filename) 493 filename)
489 494
490(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial) 495(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
@@ -642,9 +647,10 @@ This is an interface to the function `load'."
642 647
643(defun file-remote-p (file) 648(defun file-remote-p (file)
644 "Test whether FILE specifies a location on a remote system." 649 "Test whether FILE specifies a location on a remote system."
645 (let ((handler (find-file-name-handler file 'file-local-copy))) 650 (let ((handler (find-file-name-handler file 'file-remote-p)))
646 (if handler 651 (if handler
647 (get handler 'file-remote-p)))) 652 (funcall handler 'file-remote-p file)
653 nil)))
648 654
649(defun file-local-copy (file) 655(defun file-local-copy (file)
650 "Copy the file FILE into a temporary file on this machine. 656 "Copy the file FILE into a temporary file on this machine.
@@ -905,8 +911,11 @@ but the visited file name is available through the minibuffer history:
905type M-n to pull it into the minibuffer. 911type M-n to pull it into the minibuffer.
906 912
907Interactively, or if WILDCARDS is non-nil in a call from Lisp, 913Interactively, or if WILDCARDS is non-nil in a call from Lisp,
908expand wildcards (if any) and visit multiple files. Wildcard expansion 914expand wildcards (if any) and visit multiple files. You can
909can be suppressed by setting `find-file-wildcards'." 915suppress wildcard expansion by setting `find-file-wildcards'.
916
917To visit a file without any kind of conversion and without
918automatically choosing a major mode, use \\[find-file-literally]."
910 (interactive 919 (interactive
911 (find-file-read-args "Find file: " nil)) 920 (find-file-read-args "Find file: " nil))
912 (let ((value (find-file-noselect filename nil nil wildcards))) 921 (let ((value (find-file-noselect filename nil nil wildcards)))
@@ -2903,10 +2912,8 @@ on a DOS/Windows machine, it returns FILENAME on expanded form."
2903 (file-name-as-directory (expand-file-name (or directory 2912 (file-name-as-directory (expand-file-name (or directory
2904 default-directory)))) 2913 default-directory))))
2905 (setq filename (expand-file-name filename)) 2914 (setq filename (expand-file-name filename))
2906 (let ((hf (find-file-name-handler filename 'file-local-copy)) 2915 (let ((hf (find-file-name-handler filename 'file-remote-p))
2907 (hd (find-file-name-handler directory 'file-local-copy))) 2916 (hd (find-file-name-handler directory 'file-remote-p)))
2908 (when (and hf (not (get hf 'file-remote-p))) (setq hf nil))
2909 (when (and hd (not (get hd 'file-remote-p))) (setq hd nil))
2910 (if ;; Conditions for separate trees 2917 (if ;; Conditions for separate trees
2911 (or 2918 (or
2912 ;; Test for different drives on DOS/Windows 2919 ;; Test for different drives on DOS/Windows
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 96caba543c7..89e403f7502 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1910,6 +1910,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1910 "proclaim" "declaim" "declare" "symbol-macrolet" 1910 "proclaim" "declaim" "declare" "symbol-macrolet"
1911 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let" 1911 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
1912 "destructuring-bind" "macrolet" "tagbody" "block" 1912 "destructuring-bind" "macrolet" "tagbody" "block"
1913 "multiple-value-bind"
1913 "return" "return-from" 1914 "return" "return-from"
1914 "with-accessors" "with-compilation-unit" 1915 "with-accessors" "with-compilation-unit"
1915 "with-condition-restarts" "with-hash-table-iterator" 1916 "with-condition-restarts" "with-hash-table-iterator"
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 42f50fba3a4..e0b57440fd8 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -890,6 +890,7 @@ Returns t for rescan and otherwise a position number."
890 (setq name (completing-read prompt 890 (setq name (completing-read prompt
891 prepared-index-alist 891 prepared-index-alist
892 nil t nil 'imenu--history-list name))) 892 nil t nil 'imenu--history-list name)))
893
893 (cond ((not (stringp name)) nil) 894 (cond ((not (stringp name)) nil)
894 ((string= name (car imenu--rescan-item)) t) 895 ((string= name (car imenu--rescan-item)) t)
895 (t 896 (t
@@ -1015,7 +1016,10 @@ This value becomes local in every buffer when it is set.")
1015 (if (equal item imenu--rescan-item) 1016 (if (equal item imenu--rescan-item)
1016 (progn 1017 (progn
1017 (imenu--cleanup) 1018 (imenu--cleanup)
1019 ;; Make sure imenu-update-menubar redoes everything.
1020 (setq imenu-menubar-modified-tick -1)
1018 (setq imenu--index-alist nil) 1021 (setq imenu--index-alist nil)
1022 (setq imenu--last-menubar-index-alist nil)
1019 (imenu-update-menubar) 1023 (imenu-update-menubar)
1020 t) 1024 t)
1021 (imenu item) 1025 (imenu item)
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 8e1068a5bed..09448e87329 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4116,6 +4116,9 @@ directory, so that Emacs will know its current contents."
4116 (format "Getting %s" fn1)) 4116 (format "Getting %s" fn1))
4117 tmp1)))) 4117 tmp1))))
4118 4118
4119(defun ange-ftp-file-remote-p (file)
4120 (when (ange-ftp-ftp-name file) t))
4121
4119(defun ange-ftp-load (file &optional noerror nomessage nosuffix) 4122(defun ange-ftp-load (file &optional noerror nomessage nosuffix)
4120 (if (ange-ftp-ftp-name file) 4123 (if (ange-ftp-ftp-name file)
4121 (let ((tryfiles (if nosuffix 4124 (let ((tryfiles (if nosuffix
@@ -4257,9 +4260,6 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4257 (let ((fn (get operation 'ange-ftp))) 4260 (let ((fn (get operation 'ange-ftp)))
4258 (if fn (save-match-data (apply fn args)) 4261 (if fn (save-match-data (apply fn args))
4259 (ange-ftp-run-real-handler operation args)))) 4262 (ange-ftp-run-real-handler operation args))))
4260;;;###autoload
4261;;; These file names are remote file names.
4262(put 'ange-ftp-hook-function 'file-remote-p t)
4263 4263
4264;; The following code is commented out because Tramp now deals with 4264;; The following code is commented out because Tramp now deals with
4265;; Ange-FTP filenames, too. 4265;; Ange-FTP filenames, too.
@@ -4327,6 +4327,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4327(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion) 4327(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion)
4328(put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory) 4328(put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory)
4329(put 'file-local-copy 'ange-ftp 'ange-ftp-file-local-copy) 4329(put 'file-local-copy 'ange-ftp 'ange-ftp-file-local-copy)
4330(put 'file-remote-p 'ange-ftp 'ange-ftp-file-remote-p)
4330(put 'unhandled-file-name-directory 'ange-ftp 4331(put 'unhandled-file-name-directory 'ange-ftp
4331 'ange-ftp-unhandled-file-name-directory) 4332 'ange-ftp-unhandled-file-name-directory)
4332(put 'file-name-sans-versions 'ange-ftp 'ange-ftp-file-name-sans-versions) 4333(put 'file-name-sans-versions 'ange-ftp 'ange-ftp-file-name-sans-versions)
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index e98b3d815ab..1dbd97f0073 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -578,11 +578,12 @@ down (this *won't* always work)."
578(defun browse-url-interactive-arg (prompt) 578(defun browse-url-interactive-arg (prompt)
579 "Read a URL from the minibuffer, prompting with PROMPT. 579 "Read a URL from the minibuffer, prompting with PROMPT.
580If `transient-mark-mode' is non-nil and the mark is active, 580If `transient-mark-mode' is non-nil and the mark is active,
581defaults to the current region, else to the URL at or before 581it defaults to the current region, else to the URL at or before
582point. If invoked with a mouse button, set point to the 582point. If invoked with a mouse button, it moves point to the
583position clicked first. Return a list for use in `interactive' 583position clicked before acting.
584containing the URL and `browse-url-new-window-flag' or its 584
585negation if a prefix argument was given." 585This function returns a list (URL NEW-WINDOW-FLAG)
586for use in `interactive'."
586 (let ((event (elt (this-command-keys) 0))) 587 (let ((event (elt (this-command-keys) 0)))
587 (and (listp event) (mouse-set-point event))) 588 (and (listp event) (mouse-set-point event)))
588 (list (read-string prompt (or (and transient-mark-mode mark-active 589 (list (read-string prompt (or (and transient-mark-mode mark-active
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 781814a9d55..cca01d169b6 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -144,6 +144,7 @@ This variable is local to each buffer.")
144 (file-executable-p . tramp-smb-handle-file-exists-p) 144 (file-executable-p . tramp-smb-handle-file-exists-p)
145 (file-exists-p . tramp-smb-handle-file-exists-p) 145 (file-exists-p . tramp-smb-handle-file-exists-p)
146 (file-local-copy . tramp-smb-handle-file-local-copy) 146 (file-local-copy . tramp-smb-handle-file-local-copy)
147 (file-remote-p . tramp-handle-file-remote-p)
147 (file-modes . tramp-handle-file-modes) 148 (file-modes . tramp-handle-file-modes)
148 (file-name-all-completions . tramp-smb-handle-file-name-all-completions) 149 (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
149 ;; `file-name-as-directory' performed by default handler 150 ;; `file-name-as-directory' performed by default handler
@@ -1003,7 +1004,7 @@ Domain names in USER and port numbers in HOST are acknowledged."
1003 tramp-smb-program args))) 1004 tramp-smb-program args)))
1004 1005
1005 (tramp-message 9 "Started process %s" (process-command p)) 1006 (tramp-message 9 "Started process %s" (process-command p))
1006 (process-kill-without-query p) 1007 (tramp-set-process-query-on-exit-flag p nil)
1007 (set-buffer buffer) 1008 (set-buffer buffer)
1008 (setq tramp-smb-share share) 1009 (setq tramp-smb-share share)
1009 1010
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 1047e62a3cb..d18af101c48 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,7 +1,7 @@
1;;; -*- coding: iso-2022-7bit; -*- 1;;; -*- coding: iso-2022-7bit; -*-
2;;; tramp-uu.el --- uuencode in Lisp 2;;; tramp-uu.el --- uuencode in Lisp
3 3
4;; Copyright (C) 2002 Free Software Foundation, Inc. 4;; Copyright (C) 2002, 2004 Free Software Foundation, Inc.
5 5
6;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> 6;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
7;; Keywords: comm, terminals 7;; Keywords: comm, terminals
@@ -63,10 +63,10 @@
63 (setq c (char-after (point))) 63 (setq c (char-after (point)))
64 (delete-char 1) 64 (delete-char 1)
65 (if (equal c ?=) 65 (if (equal c ?=)
66 ;; "=" means padding. Insert "`" instead. 66 ;; "=" means padding. Insert "`" instead. Not counted for length.
67 (insert "`") 67 (progn (insert "`") (setq len (1- len)))
68 (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c)))) 68 (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c)))
69 (setq i (1+ i)) 69 (setq i (1+ i)))
70 ;; Every 60 characters, add "M" at beginning of line (as 70 ;; Every 60 characters, add "M" at beginning of line (as
71 ;; length byte) and insert a newline. 71 ;; length byte) and insert a newline.
72 (when (zerop (% i 60)) 72 (when (zerop (% i 60))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0fd955b27bc..769ad3f51f6 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -911,12 +911,13 @@ The answer will be provided by `tramp-action-terminal', which see."
911 :group 'tramp 911 :group 'tramp
912 :type 'regexp) 912 :type 'regexp)
913 913
914(defcustom tramp-out-of-band-prompt-regexp 914(defcustom tramp-process-alive-regexp
915 "" 915 ""
916 "Regular expression indicating an out-of-band copy has finished. 916 "Regular expression indicating a process has finished.
917In fact this expression is empty by intention, it will be used only to 917In fact this expression is empty by intention, it will be used only to
918check regularly the status of the associated process. 918check regularly the status of the associated process.
919The answer will be provided by `tramp-action-out-of-band', which see." 919The answer will be provided by `tramp-action-process-alive' and
920`tramp-action-out-of-band', which see."
920 :group 'tramp 921 :group 'tramp
921 :type 'regexp) 922 :type 'regexp)
922 923
@@ -1146,7 +1147,7 @@ Also see `tramp-file-name-structure'."
1146 1147
1147;;;###autoload 1148;;;###autoload
1148(defconst tramp-completion-file-name-regexp-unified 1149(defconst tramp-completion-file-name-regexp-unified
1149 "^/[^/]*$" 1150 "^/$\\|^/[^/:][^/]*$"
1150 "Value for `tramp-completion-file-name-regexp' for unified remoting. 1151 "Value for `tramp-completion-file-name-regexp' for unified remoting.
1151Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and 1152Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
1152Tramp. See `tramp-file-name-structure-unified' for more explanations.") 1153Tramp. See `tramp-file-name-structure-unified' for more explanations.")
@@ -1288,7 +1289,8 @@ but it might be slow on large directories."
1288 (tramp-wrong-passwd-regexp tramp-action-permission-denied) 1289 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
1289 (tramp-yesno-prompt-regexp tramp-action-yesno) 1290 (tramp-yesno-prompt-regexp tramp-action-yesno)
1290 (tramp-yn-prompt-regexp tramp-action-yn) 1291 (tramp-yn-prompt-regexp tramp-action-yn)
1291 (tramp-terminal-prompt-regexp tramp-action-terminal)) 1292 (tramp-terminal-prompt-regexp tramp-action-terminal)
1293 (tramp-process-alive-regexp tramp-action-process-alive))
1292 "List of pattern/action pairs. 1294 "List of pattern/action pairs.
1293Whenever a pattern matches, the corresponding action is performed. 1295Whenever a pattern matches, the corresponding action is performed.
1294Each item looks like (PATTERN ACTION). 1296Each item looks like (PATTERN ACTION).
@@ -1306,7 +1308,7 @@ corresponding PATTERN matches, the ACTION function is called."
1306(defcustom tramp-actions-copy-out-of-band 1308(defcustom tramp-actions-copy-out-of-band
1307 '((tramp-password-prompt-regexp tramp-action-password) 1309 '((tramp-password-prompt-regexp tramp-action-password)
1308 (tramp-wrong-passwd-regexp tramp-action-permission-denied) 1310 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
1309 (tramp-out-of-band-prompt-regexp tramp-action-out-of-band)) 1311 (tramp-process-alive-regexp tramp-action-out-of-band))
1310 "List of pattern/action pairs. 1312 "List of pattern/action pairs.
1311This list is used for copying/renaming with out-of-band methods. 1313This list is used for copying/renaming with out-of-band methods.
1312See `tramp-actions-before-shell' for more info." 1314See `tramp-actions-before-shell' for more info."
@@ -1318,7 +1320,8 @@ See `tramp-actions-before-shell' for more info."
1318 (tramp-login-prompt-regexp tramp-multi-action-login) 1320 (tramp-login-prompt-regexp tramp-multi-action-login)
1319 (shell-prompt-pattern tramp-multi-action-succeed) 1321 (shell-prompt-pattern tramp-multi-action-succeed)
1320 (tramp-shell-prompt-pattern tramp-multi-action-succeed) 1322 (tramp-shell-prompt-pattern tramp-multi-action-succeed)
1321 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)) 1323 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)
1324 (tramp-process-alive-regexp tramp-action-process-alive))
1322 "List of pattern/action pairs. 1325 "List of pattern/action pairs.
1323This list is used for each hop in multi-hop connections. 1326This list is used for each hop in multi-hop connections.
1324See `tramp-actions-before-shell' for more info." 1327See `tramp-actions-before-shell' for more info."
@@ -1326,7 +1329,8 @@ See `tramp-actions-before-shell' for more info."
1326 :type '(repeat (list variable function))) 1329 :type '(repeat (list variable function)))
1327 1330
1328(defcustom tramp-initial-commands 1331(defcustom tramp-initial-commands
1329 '("unset correct" 1332 '("unset HISTORY"
1333 "unset correct"
1330 "unset autocorrect") 1334 "unset autocorrect")
1331 "List of commands to send to the first remote shell that we see. 1335 "List of commands to send to the first remote shell that we see.
1332These commands will be sent to any shell, and thus they should be 1336These commands will be sent to any shell, and thus they should be
@@ -1768,6 +1772,7 @@ on the FILENAME argument, even if VISIT was a string.")
1768 (insert-directory . tramp-handle-insert-directory) 1772 (insert-directory . tramp-handle-insert-directory)
1769 (expand-file-name . tramp-handle-expand-file-name) 1773 (expand-file-name . tramp-handle-expand-file-name)
1770 (file-local-copy . tramp-handle-file-local-copy) 1774 (file-local-copy . tramp-handle-file-local-copy)
1775 (file-remote-p . tramp-handle-file-remote-p)
1771 (insert-file-contents . tramp-handle-insert-file-contents) 1776 (insert-file-contents . tramp-handle-insert-file-contents)
1772 (write-region . tramp-handle-write-region) 1777 (write-region . tramp-handle-write-region)
1773 (find-backup-file-name . tramp-handle-find-backup-file-name) 1778 (find-backup-file-name . tramp-handle-find-backup-file-name)
@@ -1880,6 +1885,16 @@ If VAR is nil, then we bind `v' to the structure and `multi-method',
1880;; To be activated for debugging containing this macro 1885;; To be activated for debugging containing this macro
1881(def-edebug-spec with-parsed-tramp-file-name t) 1886(def-edebug-spec with-parsed-tramp-file-name t)
1882 1887
1888(defmacro tramp-let-maybe (variable value &rest body)
1889 "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
1890BODY is executed whether or not the variable is obsolete.
1891The intent is to protect against `obsolete variable' warnings."
1892 `(if (get ',variable 'byte-obsolete-variable)
1893 (progn ,@body)
1894 (let ((,variable ,value))
1895 ,@body)))
1896(put 'tramp-let-maybe 'lisp-indent-function 2)
1897
1883;;; Config Manipulation Functions: 1898;;; Config Manipulation Functions:
1884 1899
1885(defun tramp-set-completion-function (method function-list) 1900(defun tramp-set-completion-function (method function-list)
@@ -2042,8 +2057,8 @@ target of the symlink differ."
2042 "Like `file-truename' for tramp files." 2057 "Like `file-truename' for tramp files."
2043 (with-parsed-tramp-file-name filename nil 2058 (with-parsed-tramp-file-name filename nil
2044 (let* ((steps (tramp-split-string localname "/")) 2059 (let* ((steps (tramp-split-string localname "/"))
2045 (localnamedir (let ((directory-sep-char ?/)) 2060 (localnamedir (tramp-let-maybe directory-sep-char ?/ ;for XEmacs
2046 (file-name-as-directory localname))) 2061 (file-name-as-directory localname)))
2047 (is-dir (string= localname localnamedir)) 2062 (is-dir (string= localname localnamedir))
2048 (thisstep nil) 2063 (thisstep nil)
2049 (numchase 0) 2064 (numchase 0)
@@ -2984,7 +2999,7 @@ be a local filename. The method used must be an out-of-band method."
2984 ;; Use rcp-like program for file transfer. 2999 ;; Use rcp-like program for file transfer.
2985 (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf 3000 (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
2986 copy-program copy-args))) 3001 copy-program copy-args)))
2987 (process-kill-without-query p) 3002 (tramp-set-process-query-on-exit-flag p nil)
2988 (tramp-process-actions p multi-method method user host 3003 (tramp-process-actions p multi-method method user host
2989 tramp-actions-copy-out-of-band)) 3004 tramp-actions-copy-out-of-band))
2990 (kill-buffer trampbuf) 3005 (kill-buffer trampbuf)
@@ -3297,7 +3312,7 @@ the result will be a local, non-Tramp, filename."
3297 ;; expand-file-name (this does "/./" and "/../"). We bind 3312 ;; expand-file-name (this does "/./" and "/../"). We bind
3298 ;; directory-sep-char here for XEmacs on Windows, which 3313 ;; directory-sep-char here for XEmacs on Windows, which
3299 ;; would otherwise use backslash. 3314 ;; would otherwise use backslash.
3300 (let ((directory-sep-char ?/)) 3315 (tramp-let-maybe directory-sep-char ?/
3301 (tramp-make-tramp-file-name 3316 (tramp-make-tramp-file-name
3302 multi-method (or method (tramp-find-default-method user host)) 3317 multi-method (or method (tramp-find-default-method user host))
3303 user host 3318 user host
@@ -3525,6 +3540,9 @@ This will break if COMMAND prints a newline, followed by the value of
3525 (t (error "Wrong method specification for `%s'" method))) 3540 (t (error "Wrong method specification for `%s'" method)))
3526 tmpfil))) 3541 tmpfil)))
3527 3542
3543(defun tramp-handle-file-remote-p (filename)
3544 "Like `file-remote-p' for tramp files."
3545 (when (tramp-tramp-file-p filename) t))
3528 3546
3529(defun tramp-handle-insert-file-contents 3547(defun tramp-handle-insert-file-contents
3530 (filename &optional visit beg end replace) 3548 (filename &optional visit beg end replace)
@@ -3845,10 +3863,10 @@ pass to the OPERATION."
3845 3863
3846;; We handle here all file primitives. Most of them have the file 3864;; We handle here all file primitives. Most of them have the file
3847;; name as first parameter; nevertheless we check for them explicitly 3865;; name as first parameter; nevertheless we check for them explicitly
3848;; in order to be be signalled if a new primitive appears. This 3866;; in order to be signalled if a new primitive appears. This
3849;; scenario is needed because there isn't a way to decide by 3867;; scenario is needed because there isn't a way to decide by
3850;; syntactical means whether a foreign method must be called. It would 3868;; syntactical means whether a foreign method must be called. It would
3851;; ease the live if `file-name-handler-alist' would support a decision 3869;; ease the life if `file-name-handler-alist' would support a decision
3852;; function as well but regexp only. 3870;; function as well but regexp only.
3853(defun tramp-file-name-for-operation (operation &rest args) 3871(defun tramp-file-name-for-operation (operation &rest args)
3854 "Return file name related to OPERATION file primitive. 3872 "Return file name related to OPERATION file primitive.
@@ -3862,16 +3880,16 @@ ARGS are the arguments OPERATION has been called with."
3862 'dired-compress-file 'dired-uncache 3880 'dired-compress-file 'dired-uncache
3863 'file-accessible-directory-p 'file-attributes 3881 'file-accessible-directory-p 'file-attributes
3864 'file-directory-p 'file-executable-p 'file-exists-p 3882 'file-directory-p 'file-executable-p 'file-exists-p
3865 'file-local-copy 'file-modes 'file-name-as-directory 3883 'file-local-copy 'file-remote-p 'file-modes
3866 'file-name-directory 'file-name-nondirectory 3884 'file-name-as-directory 'file-name-directory
3867 'file-name-sans-versions 'file-ownership-preserved-p 3885 'file-name-nondirectory 'file-name-sans-versions
3868 'file-readable-p 'file-regular-p 'file-symlink-p 3886 'file-ownership-preserved-p 'file-readable-p
3869 'file-truename 'file-writable-p 'find-backup-file-name 3887 'file-regular-p 'file-symlink-p 'file-truename
3870 'find-file-noselect 'get-file-buffer 'insert-directory 3888 'file-writable-p 'find-backup-file-name 'find-file-noselect
3871 'insert-file-contents 'load 'make-directory 3889 'get-file-buffer 'insert-directory 'insert-file-contents
3872 'make-directory-internal 'set-file-modes 3890 'load 'make-directory 'make-directory-internal
3873 'substitute-in-file-name 'unhandled-file-name-directory 3891 'set-file-modes 'substitute-in-file-name
3874 'vc-registered 3892 'unhandled-file-name-directory 'vc-registered
3875 ; XEmacs only 3893 ; XEmacs only
3876 'abbreviate-file-name 'create-file-buffer 3894 'abbreviate-file-name 'create-file-buffer
3877 'dired-file-modtime 'dired-make-compressed-filename 3895 'dired-file-modtime 'dired-make-compressed-filename
@@ -3940,9 +3958,6 @@ Falls back to normal file name handler if no tramp file name handler exists."
3940 (foreign (apply foreign operation args)) 3958 (foreign (apply foreign operation args))
3941 (t (tramp-run-real-handler operation args)))))) 3959 (t (tramp-run-real-handler operation args))))))
3942 3960
3943;;;###autoload
3944(put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p
3945
3946(defun tramp-sh-file-name-handler (operation &rest args) 3961(defun tramp-sh-file-name-handler (operation &rest args)
3947 "Invoke remote-shell Tramp file name handler. 3962 "Invoke remote-shell Tramp file name handler.
3948Fall back to normal file name handler if no Tramp handler exists." 3963Fall back to normal file name handler if no Tramp handler exists."
@@ -4887,16 +4902,16 @@ otherwise."
4887 "Checks whether the given `ls' executable in one of the dirs groks `-n'. 4902 "Checks whether the given `ls' executable in one of the dirs groks `-n'.
4888Returns nil if none was found, else the command is returned." 4903Returns nil if none was found, else the command is returned."
4889 (let ((dl dirlist) 4904 (let ((dl dirlist)
4890 (result nil) 4905 (result nil))
4891 (directory-sep-char ?/)) ;for XEmacs 4906 (tramp-let-maybe directory-sep-char ?/ ;for XEmacs
4892 ;; It would be better to use the CL function `find', but 4907 ;; It would be better to use the CL function `find', but
4893 ;; we don't want run-time dependencies on CL. 4908 ;; we don't want run-time dependencies on CL.
4894 (while (and dl (not result)) 4909 (while (and dl (not result))
4895 (let ((x (concat (file-name-as-directory (car dl)) cmd))) 4910 (let ((x (concat (file-name-as-directory (car dl)) cmd)))
4896 (when (tramp-check-ls-command multi-method method user host x) 4911 (when (tramp-check-ls-command multi-method method user host x)
4897 (setq result x))) 4912 (setq result x)))
4898 (setq dl (cdr dl))) 4913 (setq dl (cdr dl)))
4899 result)) 4914 result)))
4900 4915
4901(defun tramp-find-ls-command (multi-method method user host) 4916(defun tramp-find-ls-command (multi-method method user host)
4902 "Finds an `ls' command which groks the `-n' option, returning nil if failed. 4917 "Finds an `ls' command which groks the `-n' option, returning nil if failed.
@@ -4976,6 +4991,11 @@ The terminal type can be configured with `tramp-terminal-type'."
4976 (process-send-string nil (concat tramp-terminal-type 4991 (process-send-string nil (concat tramp-terminal-type
4977 tramp-rsh-end-of-line))) 4992 tramp-rsh-end-of-line)))
4978 4993
4994(defun tramp-action-process-alive (p multi-method method user host)
4995 "Check whether a process has finished."
4996 (unless (memq (process-status p) '(run open))
4997 (throw 'tramp-action 'process-died)))
4998
4979(defun tramp-action-out-of-band (p multi-method method user host) 4999(defun tramp-action-out-of-band (p multi-method method user host)
4980 "Check whether an out-of-band copy has finished." 5000 "Check whether an out-of-band copy has finished."
4981 (cond ((and (memq (process-status p) '(stop exit)) 5001 (cond ((and (memq (process-status p) '(stop exit))
@@ -5165,7 +5185,7 @@ Maybe the different regular expressions need to be tuned.
5165 user host 'tramp-login-args))) 5185 user host 'tramp-login-args)))
5166 (found nil) 5186 (found nil)
5167 (pw nil)) 5187 (pw nil))
5168 (process-kill-without-query p) 5188 (tramp-set-process-query-on-exit-flag p nil)
5169 (set-buffer (tramp-get-buffer multi-method method user host)) 5189 (set-buffer (tramp-get-buffer multi-method method user host))
5170 (erase-buffer) 5190 (erase-buffer)
5171 (tramp-process-actions p multi-method method user host 5191 (tramp-process-actions p multi-method method user host
@@ -5232,7 +5252,7 @@ arguments, and xx will be used as the host name to connect to.
5232 (apply #'start-process bufnam buf login-program 5252 (apply #'start-process bufnam buf login-program
5233 host login-args))) 5253 host login-args)))
5234 (found nil)) 5254 (found nil))
5235 (process-kill-without-query p) 5255 (tramp-set-process-query-on-exit-flag p nil)
5236 5256
5237 (set-buffer buf) 5257 (set-buffer buf)
5238 (tramp-process-actions p multi-method method user host 5258 (tramp-process-actions p multi-method method user host
@@ -5293,7 +5313,7 @@ prompt than you do, so it is not at all unlikely that the variable
5293 user host 'tramp-login-args)))) 5313 user host 'tramp-login-args))))
5294 (found nil) 5314 (found nil)
5295 (pw nil)) 5315 (pw nil))
5296 (process-kill-without-query p) 5316 (tramp-set-process-query-on-exit-flag p nil)
5297 (set-buffer (tramp-get-buffer multi-method method user host)) 5317 (set-buffer (tramp-get-buffer multi-method method user host))
5298 (tramp-process-actions p multi-method method user host 5318 (tramp-process-actions p multi-method method user host
5299 tramp-actions-before-shell) 5319 tramp-actions-before-shell)
@@ -5346,7 +5366,7 @@ log in as u2 to h2."
5346 tramp-multi-sh-program)) 5366 tramp-multi-sh-program))
5347 (num-hops (length method)) 5367 (num-hops (length method))
5348 (i 0)) 5368 (i 0))
5349 (process-kill-without-query p) 5369 (tramp-set-process-query-on-exit-flag p nil)
5350 (tramp-message 9 "Waiting 60s for local shell to come up...") 5370 (tramp-message 9 "Waiting 60s for local shell to come up...")
5351 (unless (tramp-wait-for-regexp 5371 (unless (tramp-wait-for-regexp
5352 p 60 (format "\\(%s\\)\\'\\|\\(%s\\)\\'" 5372 p 60 (format "\\(%s\\)\\'\\|\\(%s\\)\\'"
@@ -5466,12 +5486,16 @@ nil."
5466 (with-timeout (timeout) 5486 (with-timeout (timeout)
5467 (while (not found) 5487 (while (not found)
5468 (accept-process-output proc 1) 5488 (accept-process-output proc 1)
5489 (unless (memq (process-status proc) '(run open))
5490 (error "Process has died"))
5469 (goto-char (point-min)) 5491 (goto-char (point-min))
5470 (setq found (when (re-search-forward regexp nil t) 5492 (setq found (when (re-search-forward regexp nil t)
5471 (tramp-match-string-list))))))) 5493 (tramp-match-string-list)))))))
5472 (t 5494 (t
5473 (while (not found) 5495 (while (not found)
5474 (accept-process-output proc 1) 5496 (accept-process-output proc 1)
5497 (unless (memq (process-status proc) '(run open))
5498 (error "Process has died"))
5475 (goto-char (point-min)) 5499 (goto-char (point-min))
5476 (setq found (when (re-search-forward regexp nil t) 5500 (setq found (when (re-search-forward regexp nil t)
5477 (tramp-match-string-list)))))) 5501 (tramp-match-string-list))))))
@@ -5526,7 +5550,7 @@ Uses PROMPT as a prompt and sends the password to process P."
5526 5550
5527;; HHH: Not Changed. This might handle the case where USER is not 5551;; HHH: Not Changed. This might handle the case where USER is not
5528;; given in the "File name" very poorly. Then, the local 5552;; given in the "File name" very poorly. Then, the local
5529;; variable tramp-current user will be set to nil. 5553;; variable tramp-current-user will be set to nil.
5530(defun tramp-pre-connection (multi-method method user host) 5554(defun tramp-pre-connection (multi-method method user host)
5531 "Do some setup before actually logging in. 5555 "Do some setup before actually logging in.
5532METHOD, USER and HOST specify the connection." 5556METHOD, USER and HOST specify the connection."
@@ -5621,9 +5645,10 @@ to set up. METHOD, USER and HOST specify the connection."
5621 "stty -onlcr")))) 5645 "stty -onlcr"))))
5622 (erase-buffer) 5646 (erase-buffer)
5623 (tramp-message 5647 (tramp-message
5624 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'") 5648 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE'")
5625 (tramp-send-command-internal multi-method method user host 5649 (tramp-send-command-internal
5626 "HISTFILE=$HOME/.tramp_history; HISTSIZE=1") 5650 multi-method method user host
5651 "HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE")
5627 (erase-buffer) 5652 (erase-buffer)
5628 (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'") 5653 (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'")
5629 (tramp-send-command-internal multi-method method user host 5654 (tramp-send-command-internal multi-method method user host
@@ -6079,12 +6104,16 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
6079 (with-timeout (timeout) 6104 (with-timeout (timeout)
6080 (while (not found) 6105 (while (not found)
6081 (accept-process-output proc 1) 6106 (accept-process-output proc 1)
6107 (unless (memq (process-status proc) '(run open))
6108 (error "Process has died"))
6082 (goto-char (point-max)) 6109 (goto-char (point-max))
6083 (forward-line -1) 6110 (forward-line -1)
6084 (setq found (looking-at end-of-output)))))) 6111 (setq found (looking-at end-of-output))))))
6085 (t 6112 (t
6086 (while (not found) 6113 (while (not found)
6087 (accept-process-output proc 1) 6114 (accept-process-output proc 1)
6115 (unless (memq (process-status proc) '(run open))
6116 (error "Process has died"))
6088 (goto-char (point-max)) 6117 (goto-char (point-max))
6089 (forward-line -1) 6118 (forward-line -1)
6090 (setq found (looking-at end-of-output)))))) 6119 (setq found (looking-at end-of-output))))))
@@ -6762,6 +6791,16 @@ If you want to use it for something else, you'll have to check whether
6762it does the right thing." 6791it does the right thing."
6763 (delete "" (split-string string pattern))) 6792 (delete "" (split-string string pattern)))
6764 6793
6794(defun tramp-set-process-query-on-exit-flag (process flag)
6795 "Specify if query is needed for process when Emacs is exited.
6796If the second argument flag is non-nil, Emacs will query the user before
6797exiting if process is running."
6798 (if (fboundp 'set-process-query-on-exit-flag)
6799 (set-process-query-on-exit-flag process flag)
6800 (funcall (symbol-function 'process-kill-without-query)
6801 process flag)))
6802
6803
6765;; ------------------------------------------------------------ 6804;; ------------------------------------------------------------
6766;; -- Kludges section -- 6805;; -- Kludges section --
6767;; ------------------------------------------------------------ 6806;; ------------------------------------------------------------
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 6fce273f6ee..2f267787707 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -40,8 +40,15 @@
40;; Kingdon and uses GDB's annotation interface. You don't need to know about 40;; Kingdon and uses GDB's annotation interface. You don't need to know about
41;; annotations to use this mode as a debugger, but if you are interested 41;; annotations to use this mode as a debugger, but if you are interested
42;; developing the mode itself, then see the Annotations section in the GDB 42;; developing the mode itself, then see the Annotations section in the GDB
43;; info manual. Some GDB/MI commands are also used through th CLI command 43;; info manual.
44;; 'interpreter mi <mi-command>'. 44;;
45;; GDB developers plan to make the annotation interface obsolete. A new
46;; interface called GDB/MI (machine interface) has been designed to replace
47;; it. Some GDB/MI commands are used in this file through the CLI command
48;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included in the
49;; GDB repository for future releases (6.2 onwards) that uses GDB/MI as the
50;; primary interface to GDB. It is still under development and is part of a
51;; process to migrate Emacs from annotations to GDB/MI.
45;; 52;;
46;; Known Bugs: 53;; Known Bugs:
47;; 54;;
@@ -53,7 +60,7 @@
53(defvar gdb-current-address "main" "Initialisation for Assembler buffer.") 60(defvar gdb-current-address "main" "Initialisation for Assembler buffer.")
54(defvar gdb-previous-address nil) 61(defvar gdb-previous-address nil)
55(defvar gdb-previous-frame nil) 62(defvar gdb-previous-frame nil)
56(defvar gdb-current-frame "main") 63(defvar gdb-current-frame nil)
57(defvar gdb-current-language nil) 64(defvar gdb-current-language nil)
58(defvar gdb-view-source t "Non-nil means that source code can be viewed.") 65(defvar gdb-view-source t "Non-nil means that source code can be viewed.")
59(defvar gdb-selected-view 'source "Code type that user wishes to view.") 66(defvar gdb-selected-view 'source "Code type that user wishes to view.")
@@ -175,7 +182,7 @@ detailed description of this mode.
175 (setq gdb-current-address "main") 182 (setq gdb-current-address "main")
176 (setq gdb-previous-address nil) 183 (setq gdb-previous-address nil)
177 (setq gdb-previous-frame nil) 184 (setq gdb-previous-frame nil)
178 (setq gdb-current-frame "main") 185 (setq gdb-current-frame nil)
179 (setq gdb-view-source t) 186 (setq gdb-view-source t)
180 (setq gdb-selected-view 'source) 187 (setq gdb-selected-view 'source)
181 (setq gdb-var-list nil) 188 (setq gdb-var-list nil)
@@ -214,7 +221,7 @@ speedbar."
214 (require 'tooltip) 221 (require 'tooltip)
215 (let ((expr (tooltip-identifier-from-point (point)))) 222 (let ((expr (tooltip-identifier-from-point (point))))
216 (if (and (string-equal gdb-current-language "c") 223 (if (and (string-equal gdb-current-language "c")
217 gdb-use-colon-colon-notation) 224 gdb-use-colon-colon-notation gdb-current-frame)
218 (setq expr (concat gdb-current-frame "::" expr))) 225 (setq expr (concat gdb-current-frame "::" expr)))
219 (catch 'already-watched 226 (catch 'already-watched
220 (dolist (var gdb-var-list) 227 (dolist (var gdb-var-list)
@@ -1219,8 +1226,10 @@ static char *magick[] = {
1219 (interactive) 1226 (interactive)
1220 (save-excursion 1227 (save-excursion
1221 (beginning-of-line 1) 1228 (beginning-of-line 1)
1222 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) 1229 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdbmi))
1223 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")) 1230 (looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)")
1231 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
1232 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")))
1224 (if (match-string 2) 1233 (if (match-string 2)
1225 (let ((line (match-string 2)) 1234 (let ((line (match-string 2))
1226 (file (match-string 1))) 1235 (file (match-string 1)))
@@ -1311,7 +1320,7 @@ static char *magick[] = {
1311 1320
1312(defun gdb-get-frame-number () 1321(defun gdb-get-frame-number ()
1313 (save-excursion 1322 (save-excursion
1314 (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) 1323 (let* ((pos (re-search-backward "^#*\\([0-9]*\\)" nil t))
1315 (n (or (and pos (match-string-no-properties 1)) "0"))) 1324 (n (or (and pos (match-string-no-properties 1)) "0")))
1316 n))) 1325 n)))
1317 1326
@@ -1502,7 +1511,7 @@ static char *magick[] = {
1502 1511
1503\\{gdb-locals-mode-map}" 1512\\{gdb-locals-mode-map}"
1504 (setq major-mode 'gdb-locals-mode) 1513 (setq major-mode 'gdb-locals-mode)
1505 (setq mode-name "Locals") 1514 (setq mode-name (concat "Locals:" gdb-current-frame))
1506 (setq buffer-read-only t) 1515 (setq buffer-read-only t)
1507 (use-local-map gdb-locals-mode-map) 1516 (use-local-map gdb-locals-mode-map)
1508 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) 1517 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
@@ -1999,6 +2008,9 @@ BUFFER nil or omitted means use the current buffer."
1999 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") 2008 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ")
2000 (progn 2009 (progn
2001 (setq gdb-current-frame (match-string 2)) 2010 (setq gdb-current-frame (match-string 2))
2011 (if (gdb-get-buffer 'gdb-locals-buffer)
2012 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
2013 (setq mode-name (concat "Locals:" gdb-current-frame))))
2002 (let ((address (match-string 1))) 2014 (let ((address (match-string 1)))
2003 ;; remove leading 0s from output of info frame command. 2015 ;; remove leading 0s from output of info frame command.
2004 (if (string-match "^0+\\(.*\\)" address) 2016 (if (string-match "^0+\\(.*\\)" address)
diff --git a/lisp/replace.el b/lisp/replace.el
index e14e1314352..f7afcd594cf 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -36,9 +36,11 @@
36 36
37(defvar query-replace-history nil) 37(defvar query-replace-history nil)
38 38
39(defvar query-replace-interactive nil 39(defcustom query-replace-interactive nil
40 "Non-nil means `query-replace' uses the last search string. 40 "Non-nil means `query-replace' uses the last search string.
41That becomes the \"string to replace\".") 41That becomes the \"string to replace\"."
42 :type 'boolean
43 :group 'matching)
42 44
43(defcustom query-replace-from-history-variable 'query-replace-history 45(defcustom query-replace-from-history-variable 'query-replace-history
44 "History list to use for the FROM argument of `query-replace' commands. 46 "History list to use for the FROM argument of `query-replace' commands.
diff --git a/lisp/subr.el b/lisp/subr.el
index 59620d1bb7e..cd52efcebde 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1796,10 +1796,21 @@ The value returned is the value of the last form in BODY.
1796This does not alter the buffer list ordering. 1796This does not alter the buffer list ordering.
1797See also `with-temp-buffer'." 1797See also `with-temp-buffer'."
1798 (declare (indent 1) (debug t)) 1798 (declare (indent 1) (debug t))
1799 `(let ((save-selected-window-window (selected-window))) 1799 ;; Most of this code is a copy of save-selected-window.
1800 `(let ((save-selected-window-window (selected-window))
1801 ;; It is necessary to save all of these, because calling
1802 ;; select-window changes frame-selected-window for whatever
1803 ;; frame that window is in.
1804 (save-selected-window-alist
1805 (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
1806 (frame-list))))
1800 (unwind-protect 1807 (unwind-protect
1801 (progn (select-window ,window 'norecord) 1808 (progn (select-window ,window 'norecord)
1802 ,@body) 1809 ,@body)
1810 (dolist (elt save-selected-window-alist)
1811 (and (frame-live-p (car elt))
1812 (window-live-p (cadr elt))
1813 (set-frame-selected-window (car elt) (cadr elt))))
1803 (if (window-live-p save-selected-window-window) 1814 (if (window-live-p save-selected-window-window)
1804 (select-window save-selected-window-window 'norecord))))) 1815 (select-window save-selected-window-window 'norecord)))))
1805 1816
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 206492dee08..1fbf2d224a2 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -1,15 +1,10 @@
1;;; thumbs.el --- Thumbnails previewer for images files 1;;; thumbs.el --- Thumbnails previewer for images files
2;;; 2
3;; Copyright 2004 Free Software Foundation, Inc
4
3;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca> 5;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca>
4;;
5;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
6;; The peoples at #emacs@freenode.net for numerous help
7;; RMS for emacs and the GNU project.
8;;
9;; Keywords: Multimedia 6;; Keywords: Multimedia
10 7
11(defconst thumbs-version "2.0")
12
13;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
14 9
15;; GNU Emacs is free software; you can redistribute it and/or modify 10;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -26,6 +21,11 @@
26;; along with GNU Emacs; see the file COPYING. If not, write to the 21;; along with GNU Emacs; see the file COPYING. If not, write to the
27;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28;; Boston, MA 02111-1307, USA. 23;; Boston, MA 02111-1307, USA.
24;;
25;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
26;; The peoples at #emacs@freenode.net for numerous help
27;; RMS for emacs and the GNU project.
28;;
29 29
30;;; Commentary: 30;;; Commentary:
31 31
@@ -56,19 +56,8 @@
56 56
57;;; Code: 57;;; Code:
58 58
59(eval-when-compile
60 (require 'cl))
61(require 'dired) 59(require 'dired)
62 60
63;; Abort if in-line imaging isn't supported (i.e. Emacs-20.7)
64
65(when (not (display-images-p))
66 (error "Your Emacs version (%S) doesn't support in-line images,
67was not compiled with image support or is run in console mode.
68Upgrade to Emacs 21.1 or newer, compile it with image support
69or use a window-system"
70 emacs-version))
71
72;; CUSTOMIZATIONS 61;; CUSTOMIZATIONS
73 62
74(defgroup thumbs nil 63(defgroup thumbs nil
@@ -212,9 +201,9 @@ reached."
212 (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) filesL)))) 201 (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) filesL))))
213 (while (> dirsize thumbs-thumbsdir-max-size) 202 (while (> dirsize thumbs-thumbsdir-max-size)
214 (progn 203 (progn
215 (message "Deleting file %s" (caddar filesL))) 204 (message "Deleting file %s" (cadr (cdar filesL))))
216 (delete-file (caddar filesL)) 205 (delete-file (cadr (cdar filesL)))
217 (setq dirsize (- dirsize (cadar filesL))) 206 (setq dirsize (- dirsize (car (cdar filesL))))
218 (setq filesL (cdr filesL))))) 207 (setq filesL (cdr filesL)))))
219 208
220;; Check the thumbsnail directory size and clean it if necessary. 209;; Check the thumbsnail directory size and clean it if necessary.
@@ -272,11 +261,12 @@ if INCREMENT is set, make the image bigger, else smaller.
272Or, alternatively, a SIZE may be specified." 261Or, alternatively, a SIZE may be specified."
273 (interactive) 262 (interactive)
274 ;; cleaning of old temp file 263 ;; cleaning of old temp file
275 (ignore-errors 264 (condition-case nil
276 (apply 'delete-file 265 (apply 'delete-file
277 (directory-files 266 (directory-files
278 thumbs-temp-dir t 267 thumbs-temp-dir t
279 thumbs-temp-prefix))) 268 thumbs-temp-prefix))
269 (error nil))
280 (let ((buffer-read-only nil) 270 (let ((buffer-read-only nil)
281 (x (if size 271 (x (if size
282 size 272 size
@@ -309,22 +299,10 @@ Or, alternatively, a SIZE may be specified."
309 (interactive) 299 (interactive)
310 (thumbs-resize-image t)) 300 (thumbs-resize-image t))
311 301
312(defun thumbs-subst-char-in-string (orig rep string)
313 "Replace occurrences of character ORIG with character REP in STRING.
314Return the resulting (new) string. -- (defun borowed to Dave Love)"
315 (let ((string (copy-sequence string))
316 (l (length string))
317 (i 0))
318 (while (< i l)
319 (if (= (aref string i) orig)
320 (aset string i rep))
321 (setq i (1+ i)))
322 string))
323
324(defun thumbs-thumbname (img) 302(defun thumbs-thumbname (img)
325 "Return a thumbnail name for the image IMG." 303 "Return a thumbnail name for the image IMG."
326 (concat thumbs-thumbsdir "/" 304 (concat thumbs-thumbsdir "/"
327 (thumbs-subst-char-in-string 305 (subst-char-in-string
328 ?\ ?\_ 306 ?\ ?\_
329 (apply 307 (apply
330 'concat 308 'concat
@@ -336,7 +314,11 @@ Return the resulting (new) string. -- (defun borowed to Dave Love)"
336 (let* ((fn (expand-file-name img)) 314 (let* ((fn (expand-file-name img))
337 (tn (thumbs-thumbname img))) 315 (tn (thumbs-thumbname img)))
338 (if (or (not (file-exists-p tn)) 316 (if (or (not (file-exists-p tn))
339 (not (equal (thumbs-file-size tn) thumbs-geometry))) 317 ;; This is not the right fix, but I don't understand
318 ;; the external program or why it produces a geometry
319 ;; unequal to the one requested -- rms.
320;;; (not (equal (thumbs-file-size tn) thumbs-geometry))
321 )
340 (thumbs-call-convert fn tn "sample" thumbs-geometry)) 322 (thumbs-call-convert fn tn "sample" thumbs-geometry))
341 tn)) 323 tn))
342 324
@@ -380,30 +362,28 @@ if MARKED is non-nil, the image is marked."
380 "Insert the thumbnail for IMG at point. 362 "Insert the thumbnail for IMG at point.
381if MARKED is non-nil, the image is marked" 363if MARKED is non-nil, the image is marked"
382 (thumbs-insert-image 364 (thumbs-insert-image
383 (thumbs-make-thumb img) 'jpeg thumbs-relief marked)) 365 (thumbs-make-thumb img) 'jpeg thumbs-relief marked)
366 (put-text-property (1- (point)) (point)
367 'thumb-image-file img))
384 368
385(defun thumbs-do-thumbs-insertion (L) 369(defun thumbs-do-thumbs-insertion (L)
386 "Insert all thumbs in list L." 370 "Insert all thumbs in list L."
387 (setq thumbs-fileL nil)
388 (let ((i 0)) 371 (let ((i 0))
389 (while L 372 (dolist (img L)
373 (thumbs-insert-thumb img
374 (member img thumbs-markedL))
390 (when (= 0 (mod (setq i (1+ i)) thumbs-per-line)) 375 (when (= 0 (mod (setq i (1+ i)) thumbs-per-line))
391 (newline)) 376 (newline)))
392 (setq thumbs-fileL (cons (cons (point) 377 (unless (bobp) (newline))))
393 (car L))
394 thumbs-fileL))
395 (thumbs-insert-thumb (car L)
396 (member (car L) thumbs-markedL))
397 (setq L (cdr L)))))
398 378
399(defun thumbs-show-thumbs-list (L &optional buffer-name same-window) 379(defun thumbs-show-thumbs-list (L &optional buffer-name same-window)
380 (when (not (display-images-p))
381 (error "Images are not supported in this Emacs session"))
400 (funcall (if same-window 'switch-to-buffer 'pop-to-buffer) 382 (funcall (if same-window 'switch-to-buffer 'pop-to-buffer)
401 (or buffer-name "*THUMB-View*")) 383 (or buffer-name "*THUMB-View*"))
402 (let ((inhibit-read-only t)) 384 (let ((inhibit-read-only t))
403 (erase-buffer) 385 (erase-buffer)
404 (thumbs-mode) 386 (thumbs-mode)
405 (make-variable-buffer-local 'thumbs-fileL)
406 (setq thumbs-fileL nil)
407 (thumbs-do-thumbs-insertion L) 387 (thumbs-do-thumbs-insertion L)
408 (goto-char (point-min)) 388 (goto-char (point-min))
409 (setq thumbs-current-dir default-directory) 389 (setq thumbs-current-dir default-directory)
@@ -435,8 +415,8 @@ and SAME-WINDOW to show thumbs in the same window."
435;;;###autoload 415;;;###autoload
436(defalias 'thumbs 'thumbs-show-all-from-dir) 416(defalias 'thumbs 'thumbs-show-all-from-dir)
437 417
438(defun thumbs-find-image (img L &optional num otherwin) 418(defun thumbs-find-image (img &optional num otherwin)
439 (funcall 419 (funcall
440 (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer) 420 (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer)
441 (concat "*Image: " (file-name-nondirectory img) " - " 421 (concat "*Image: " (file-name-nondirectory img) " - "
442 (number-to-string (or num 0)) "*")) 422 (number-to-string (or num 0)) "*"))
@@ -449,8 +429,6 @@ and SAME-WINDOW to show thumbs in the same window."
449 (make-variable-buffer-local 'thumbs-current-tmp-filename) 429 (make-variable-buffer-local 'thumbs-current-tmp-filename)
450 (make-variable-buffer-local 'thumbs-current-image-size) 430 (make-variable-buffer-local 'thumbs-current-image-size)
451 (make-variable-buffer-local 'thumbs-image-num) 431 (make-variable-buffer-local 'thumbs-image-num)
452 (make-variable-buffer-local 'thumbs-fileL)
453 (setq thumbs-fileL L)
454 (delete-region (point-min)(point-max)) 432 (delete-region (point-min)(point-max))
455 (thumbs-insert-image img (thumbs-image-type img) 0))) 433 (thumbs-insert-image img (thumbs-image-type img) 0)))
456 434
@@ -458,10 +436,8 @@ and SAME-WINDOW to show thumbs in the same window."
458 "Display image IMG for thumbnail at point. 436 "Display image IMG for thumbnail at point.
459use another window it OTHERWIN is t." 437use another window it OTHERWIN is t."
460 (interactive) 438 (interactive)
461 (let* ((L thumbs-fileL) 439 (let* ((i (or img (thumbs-current-image))))
462 (n (point)) 440 (thumbs-find-image i (point) otherwin)))
463 (i (or img (cdr (assoc n L)))))
464 (thumbs-find-image i L n otherwin)))
465 441
466(defun thumbs-find-image-at-point-other-window () 442(defun thumbs-find-image-at-point-other-window ()
467 "Display image for thumbnail at point in the preview buffer. 443 "Display image for thumbnail at point in the preview buffer.
@@ -469,6 +445,12 @@ Open another window."
469 (interactive) 445 (interactive)
470 (thumbs-find-image-at-point nil t)) 446 (thumbs-find-image-at-point nil t))
471 447
448(defun thumbs-mouse-find-image (event)
449 "Display image for thumbnail at mouse click EVENT."
450 (interactive "e")
451 (mouse-set-point event)
452 (thumbs-find-image-at-point))
453
472(defun thumbs-call-setroot-command (img) 454(defun thumbs-call-setroot-command (img)
473 "Call the setroot program for IMG." 455 "Call the setroot program for IMG."
474 (run-hooks 'thumbs-before-setroot-hook) 456 (run-hooks 'thumbs-before-setroot-hook)
@@ -481,7 +463,8 @@ Open another window."
481(defun thumbs-set-image-at-point-to-root-window () 463(defun thumbs-set-image-at-point-to-root-window ()
482 "Set the image at point as the desktop wallpaper." 464 "Set the image at point as the desktop wallpaper."
483 (interactive) 465 (interactive)
484 (thumbs-call-setroot-command (cdr (assoc (point) thumbs-fileL)))) 466 (thumbs-call-setroot-command
467 (thumbs-current-image)))
485 468
486(defun thumbs-set-root () 469(defun thumbs-set-root ()
487 "Set the current image as root." 470 "Set the current image as root."
@@ -490,36 +473,102 @@ Open another window."
490 (or thumbs-current-tmp-filename 473 (or thumbs-current-tmp-filename
491 thumbs-current-image-filename))) 474 thumbs-current-image-filename)))
492 475
476(defun thumbs-file-alist ()
477 "Make an alist of elements (POS . FILENAME) for all images in thumb buffer."
478 (save-excursion
479 (let (list)
480 (goto-char (point-min))
481 (while (not (eobp))
482 (if (thumbs-current-image)
483 (push (cons (point-marker)
484 (thumbs-current-image))
485 list))
486 (forward-char 1))
487 list)))
488
489(defun thumbs-file-list ()
490 "Make a list of file names for all images in thumb buffer."
491 (save-excursion
492 (let (list)
493 (goto-char (point-min))
494 (while (not (eobp))
495 (if (thumbs-current-image)
496 (push (thumbs-current-image) list))
497 (forward-char 1))
498 (nreverse list))))
499
493(defun thumbs-delete-images () 500(defun thumbs-delete-images ()
494 "Delete the image at point (and it's thumbnail) (or marked files if any)." 501 "Delete the image at point (and it's thumbnail) (or marked files if any)."
495 (interactive) 502 (interactive)
496 (let ((f (or thumbs-markedL (list (cdr (assoc (point) thumbs-fileL)))))) 503 (let ((files (or thumbs-markedL (list (thumbs-current-image)))))
497 (if (yes-or-no-p (format "Really delete %d files? " (length f))) 504 (if (yes-or-no-p (format "Really delete %d files? " (length files)))
498 (progn 505 (let ((thumbs-fileL (thumbs-file-alist))
499 (mapcar (lambda (x) 506 (inhibit-read-only t))
500 (setq thumbs-fileL (delete (rassoc x thumbs-fileL) thumbs-fileL)) 507 (dolist (x files)
508 (let (failure)
509 (condition-case ()
510 (progn
501 (delete-file x) 511 (delete-file x)
502 (delete-file (thumbs-thumbname x))) f) 512 (delete-file (thumbs-thumbname x)))
503 (thumbs-redraw-buffer))))) 513 (file-error (setq failure t)))
514 (unless failure
515 (when (rassoc x thumbs-fileL)
516 (goto-char (car (rassoc x thumbs-fileL)))
517 (delete-region (point) (1+ (point))))
518 (setq thumbs-markedL
519 (delq x thumbs-markedL)))))))))
520
521(defun thumbs-rename-images (newfile)
522 "Rename the image at point (and it's thumbnail) (or marked files if any)."
523 (interactive "FRename to file or directory: ")
524 (let ((files (or thumbs-markedL (list (thumbs-current-image))))
525 failures)
526 (if (and (not (file-directory-p newfile))
527 thumbs-markedL)
528 (if (file-exists-p newfile)
529 (error "Renaming marked files to file name `%s'" newfile)
530 (make-directory newfile t)))
531 (if (yes-or-no-p (format "Really rename %d files? " (length files)))
532 (let ((thumbs-fileL (thumbs-file-alist))
533 (inhibit-read-only t))
534 (dolist (file files)
535 (let (failure)
536 (condition-case ()
537 (if (file-directory-p newfile)
538 (rename-file file
539 (expand-file-name
540 (file-name-nondirectory file)
541 newfile))
542 (rename-file file newfile))
543 (file-error (setq failure t)
544 (push file failures)))
545 (unless failure
546 (when (rassoc file thumbs-fileL)
547 (goto-char (car (rassoc file thumbs-fileL)))
548 (delete-region (point) (1+ (point))))
549 (setq thumbs-markedL
550 (delq file thumbs-markedL)))))))
551 (if failures
552 (display-warning 'file-error
553 (format "Rename failures for %s into %s"
554 failures newfile)
555 :error))))
504 556
505(defun thumbs-kill-buffer () 557(defun thumbs-kill-buffer ()
506 "Kill the current buffer." 558 "Kill the current buffer."
507 (interactive) 559 (interactive)
508 (let ((buffer (current-buffer))) 560 (let ((buffer (current-buffer)))
509 (ignore-errors (delete-window (selected-window))) 561 (condition-case nil
562 (delete-window (selected-window))
563 (error nil))
510 (kill-buffer buffer))) 564 (kill-buffer buffer)))
511 565
512(defun thumbs-show-image-num (num) 566(defun thumbs-show-image-num (num)
513 "Show the image with number NUM." 567 "Show the image with number NUM."
514 (let ((inhibit-read-only t)) 568 (let ((image-buffer (get-buffer-create "*Image*")))
515 (delete-region (point-min)(point-max)) 569 (let ((i (thumbs-current-image)))
516 (let ((i (cdr (assoc num thumbs-fileL)))) 570 (with-current-buffer image-buffer
517 (thumbs-insert-image i (thumbs-image-type i) 0) 571 (thumbs-insert-image i (thumbs-image-type i) 0))
518 (sleep-for 2)
519 (rename-buffer (concat "*Image: "
520 (file-name-nondirectory i)
521 " - "
522 (number-to-string num) "*"))
523 (setq thumbs-image-num num 572 (setq thumbs-image-num num
524 thumbs-current-image-filename i)))) 573 thumbs-current-image-filename i))))
525 574
@@ -527,40 +576,54 @@ Open another window."
527 "Show next image." 576 "Show next image."
528 (interactive) 577 (interactive)
529 (let* ((i (1+ thumbs-image-num)) 578 (let* ((i (1+ thumbs-image-num))
530 (l (caar thumbs-fileL)) 579 (list (thumbs-file-alist))
531 (num 580 (l (caar list)))
532 (cond ((assoc i thumbs-fileL) i) 581 (while (and (/= i thumbs-image-num) (not (assoc i list)))
533 ((>= i l) 1) 582 (setq i (if (>= i l) 1 (1+ i))))
534 (t (1+ i))))) 583 (thumbs-show-image-num i)))
535 (thumbs-show-image-num num)))
536 584
537(defun thumbs-previous-image () 585(defun thumbs-previous-image ()
538 "Show the previous image." 586 "Show the previous image."
539 (interactive) 587 (interactive)
540 (let* ((i (- thumbs-image-num 1)) 588 (let* ((i (- thumbs-image-num 1))
541 (l (caar thumbs-fileL)) 589 (list (thumbs-file-alist))
542 (num 590 (l (caar list)))
543 (cond ((assoc i thumbs-fileL) i) 591 (while (and (/= i thumbs-image-num) (not (assoc i list)))
544 ((<= i 1) l) 592 (setq i (if (<= i 1) l (1- i))))
545 (t (- i 1))))) 593 (thumbs-show-image-num i)))
546 (thumbs-show-image-num num)))
547 594
548(defun thumbs-redraw-buffer () 595(defun thumbs-redraw-buffer ()
549 "Redraw the current thumbs buffer." 596 "Redraw the current thumbs buffer."
550 (let ((p (point)) 597 (let ((p (point))
551 (inhibit-read-only t)) 598 (inhibit-read-only t)
552 (delete-region (point-min)(point-max)) 599 (files (thumbs-file-list)))
553 (thumbs-do-thumbs-insertion (reverse (mapcar 'cdr thumbs-fileL))) 600 (erase-buffer)
554 (goto-char (1+ p)))) 601 (thumbs-do-thumbs-insertion files)
602 (goto-char p)))
555 603
556(defun thumbs-mark () 604(defun thumbs-mark ()
557 "Mark the image at point." 605 "Mark the image at point."
558 (interactive) 606 (interactive)
559 (setq thumbs-markedL (cons (cdr (assoc (point) thumbs-fileL)) thumbs-markedL)) 607 (let ((elt (thumbs-current-image)))
560 (let ((inhibit-read-only t)) 608 (unless elt
561 (delete-char 1) 609 (error "No image here"))
562 (thumbs-insert-thumb (cdr (assoc (point) thumbs-fileL)) t)) 610 (push elt thumbs-markedL)
563 (when (eolp)(forward-char))) 611 (let ((inhibit-read-only t))
612 (delete-char 1)
613 (thumbs-insert-thumb elt t)))
614 (when (eolp) (forward-char)))
615
616(defun thumbs-unmark ()
617 "Unmark the image at point."
618 (interactive)
619 (let ((elt (thumbs-current-image)))
620 (unless elt
621 (error "No image here"))
622 (setq thumbs-markedL (delete elt thumbs-markedL))
623 (let ((inhibit-read-only t))
624 (delete-char 1)
625 (thumbs-insert-thumb elt nil)))
626 (when (eolp) (forward-char)))
564 627
565;; Image modification routines 628;; Image modification routines
566 629
@@ -587,8 +650,8 @@ ACTION and ARG should be legal convert command."
587(defun thumbs-emboss-image (emboss) 650(defun thumbs-emboss-image (emboss)
588 "Emboss the image with value EMBOSS." 651 "Emboss the image with value EMBOSS."
589 (interactive "nEmboss value: ") 652 (interactive "nEmboss value: ")
590 (if (or (< emboss 3) (> emboss 31) (zerop (logand emboss 1))) 653 (if (or (< emboss 3) (> emboss 31) (zerop (% emboss 2)))
591 (error "Arg must be a odd number between 3 and 31")) 654 (error "Arg must be an odd number between 3 and 31"))
592 (thumbs-modify-image "emboss" (number-to-string emboss))) 655 (thumbs-modify-image "emboss" (number-to-string emboss)))
593 656
594(defun thumbs-monochrome-image () 657(defun thumbs-monochrome-image ()
@@ -611,17 +674,24 @@ ACTION and ARG should be legal convert command."
611 (interactive) 674 (interactive)
612 (thumbs-modify-image "rotate" "90")) 675 (thumbs-modify-image "rotate" "90"))
613 676
677(defun thumbs-current-image ()
678 "Return the name of the image file name at point."
679 (get-text-property (point) 'thumb-image-file))
680
614(defun thumbs-forward-char () 681(defun thumbs-forward-char ()
615 "Move forward one image." 682 "Move forward one image."
616 (interactive) 683 (interactive)
617 (forward-char) 684 (forward-char)
618 (when (eolp)(forward-char)) 685 (while (and (not (eobp)) (not (thumbs-current-image)))
686 (forward-char))
619 (thumbs-show-name)) 687 (thumbs-show-name))
620 688
621(defun thumbs-backward-char () 689(defun thumbs-backward-char ()
622 "Move backward one image." 690 "Move backward one image."
623 (interactive) 691 (interactive)
624 (forward-char -1) 692 (forward-char -1)
693 (while (and (not (bobp)) (not (thumbs-current-image)))
694 (forward-char -1))
625 (thumbs-show-name)) 695 (thumbs-show-name))
626 696
627(defun thumbs-forward-line () 697(defun thumbs-forward-line ()
@@ -639,15 +709,15 @@ ACTION and ARG should be legal convert command."
639(defun thumbs-show-name () 709(defun thumbs-show-name ()
640 "Show the name of the current file." 710 "Show the name of the current file."
641 (interactive) 711 (interactive)
642 (let ((f (cdr (assoc (point) thumbs-fileL)))) 712 (let ((f (thumbs-current-image)))
643 (message "%s [%s]" f (thumbs-file-size f)))) 713 (and f (message "%s [%s]" f (thumbs-file-size f)))))
644 714
645(defun thumbs-save-current-image () 715(defun thumbs-save-current-image ()
646 "Save the current image." 716 "Save the current image."
647 (interactive) 717 (interactive)
648 (let ((f (or thumbs-current-tmp-filename 718 (let ((f (or thumbs-current-tmp-filename
649 thumbs-current-image-filename)) 719 thumbs-current-image-filename))
650 (sa (read-from-minibuffer "save file as: " 720 (sa (read-from-minibuffer "Save image file as: "
651 thumbs-current-image-filename))) 721 thumbs-current-image-filename)))
652 (copy-file f sa))) 722 (copy-file f sa)))
653 723
@@ -661,6 +731,7 @@ ACTION and ARG should be legal convert command."
661(defvar thumbs-mode-map 731(defvar thumbs-mode-map
662 (let ((map (make-sparse-keymap))) 732 (let ((map (make-sparse-keymap)))
663 (define-key map [return] 'thumbs-find-image-at-point) 733 (define-key map [return] 'thumbs-find-image-at-point)
734 (define-key map [mouse-2] 'thumbs-mouse-find-image)
664 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window) 735 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
665 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window) 736 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
666 (define-key map [delete] 'thumbs-delete-images) 737 (define-key map [delete] 'thumbs-delete-images)
@@ -670,15 +741,20 @@ ACTION and ARG should be legal convert command."
670 (define-key map [down] 'thumbs-forward-line) 741 (define-key map [down] 'thumbs-forward-line)
671 (define-key map "d" 'thumbs-dired) 742 (define-key map "d" 'thumbs-dired)
672 (define-key map "m" 'thumbs-mark) 743 (define-key map "m" 'thumbs-mark)
744 (define-key map "u" 'thumbs-unmark)
745 (define-key map "R" 'thumbs-rename-images)
746 (define-key map "x" 'thumbs-delete-images)
673 (define-key map "s" 'thumbs-show-name) 747 (define-key map "s" 'thumbs-show-name)
674 (define-key map "q" 'thumbs-kill-buffer) 748 (define-key map "q" 'thumbs-kill-buffer)
675 map) 749 map)
676 "Keymap for `thumbs-mode'.") 750 "Keymap for `thumbs-mode'.")
677 751
752(put 'thumbs-mode 'mode-class 'special)
678(define-derived-mode thumbs-mode 753(define-derived-mode thumbs-mode
679 fundamental-mode "thumbs" 754 fundamental-mode "thumbs"
680 "Preview images in a thumbnails buffer" 755 "Preview images in a thumbnails buffer"
681 (make-variable-buffer-local 'thumbs-markedL) 756 (make-variable-buffer-local 'thumbs-markedL)
757 (setq buffer-read-only t)
682 (setq thumbs-markedL nil)) 758 (setq thumbs-markedL nil))
683 759
684(defvar thumbs-view-image-mode-map 760(defvar thumbs-view-image-mode-map
@@ -698,6 +774,7 @@ ACTION and ARG should be legal convert command."
698 "Keymap for `thumbs-view-image-mode'.") 774 "Keymap for `thumbs-view-image-mode'.")
699 775
700;; thumbs-view-image-mode 776;; thumbs-view-image-mode
777(put 'thumbs-view-image-mode 'mode-class 'special)
701(define-derived-mode thumbs-view-image-mode 778(define-derived-mode thumbs-view-image-mode
702 fundamental-mode "image-view-mode") 779 fundamental-mode "image-view-mode")
703 780
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index 4a485414d7a..86703a3b9b5 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -230,9 +230,13 @@ You should set this to t when using a non-system shell.\n\n"))))
230 230
231(defun convert-standard-filename (filename) 231(defun convert-standard-filename (filename)
232 "Convert a standard file's name to something suitable for the current OS. 232 "Convert a standard file's name to something suitable for the current OS.
233This function's standard definition is trivial; it just returns the argument. 233This means to guarantee valid names and perhaps to canonicalize
234However, on some systems, the function is redefined 234certain patterns.
235with a definition that really does change some file names." 235
236On Windows and DOS, replace invalid characters. On DOS, make
237sure to obey the 8.3 limitations. On Windows, turn Cygwin names
238into native names, and also turn slashes into backslashes if the
239shell requires it (see `w32-shell-dos-semantics')."
236 (let ((name 240 (let ((name
237 (save-match-data 241 (save-match-data
238 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) 242 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
diff --git a/lisp/window.el b/lisp/window.el
index 2b5a4ab161d..188b3acf311 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -36,6 +36,9 @@ of this construct.
36However, if a window has become dead, don't get an error, 36However, if a window has become dead, don't get an error,
37just refrain from reselecting it." 37just refrain from reselecting it."
38 `(let ((save-selected-window-window (selected-window)) 38 `(let ((save-selected-window-window (selected-window))
39 ;; It is necessary to save all of these, because calling
40 ;; select-window changes frame-selected-window for whatever
41 ;; frame that window is in.
39 (save-selected-window-alist 42 (save-selected-window-alist
40 (mapcar (lambda (frame) (list frame (frame-selected-window frame))) 43 (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
41 (frame-list)))) 44 (frame-list))))