aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2011-09-08 16:46:33 +0200
committerJoakim Verona2011-09-08 16:46:33 +0200
commit0e852ac995c1bb7aa059ffface31b7b7c00308ea (patch)
tree9e95988cec1d083ed3bf938546ae7d7f7e5b77b5 /lisp
parent94110bea46d4a1481b6f2f4e33cf8ce6ac6d8d62 (diff)
parent97f05794552e8415ccc7522017f4dff06f84d1a4 (diff)
downloademacs-0e852ac995c1bb7aa059ffface31b7b7c00308ea.tar.gz
emacs-0e852ac995c1bb7aa059ffface31b7b7c00308ea.zip
upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog16
-rw-r--r--lisp/progmodes/compile.el10
-rw-r--r--lisp/progmodes/grep.el19
-rw-r--r--lisp/window.el116
4 files changed, 86 insertions, 75 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9d9d564fa15..6d64950d64b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,19 @@
12011-09-08 Juri Linkov <juri@jurta.org>
2
3 * progmodes/compile.el (compilation-environment): Make it
4 a defcustom (bug#8340).
5
62011-09-08 Martin Rudalics <rudalics@gmx.at>
7
8 * window.el (frame-auto-delete): Rename to window-auto-delete.
9 Make it control auto-deletion of windows and/or frames.
10 (window-deletable-p): New argument FORCE. Rewrite conditions
11 for deleting window/frame. (Bug#9419)
12 (switch-to-prev-buffer, replace-buffer-in-windows, quit-window):
13 Rewrite handling of case when window/frame can be deleted.
14 (delete-windows-on): Call window-deletable-p with new FORCE
15 argument t. (Bug#9456)
16
12011-09-07 Chong Yidong <cyd@stupidchicken.com> 172011-09-07 Chong Yidong <cyd@stupidchicken.com>
2 18
3 * help-mode.el (help-mode): Restore autoload. 19 * help-mode.el (help-mode): Restore autoload.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4871c980fb5..cd891a8df60 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -637,11 +637,15 @@ This should be a function of three arguments: process status, exit status,
637and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to 637and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to
638write into the compilation buffer, and to put in its mode line.") 638write into the compilation buffer, and to put in its mode line.")
639 639
640(defvar compilation-environment nil 640(defcustom compilation-environment nil
641 "*List of environment variables for compilation to inherit. 641 "List of environment variables for compilation to inherit.
642Each element should be a string of the form ENVVARNAME=VALUE. 642Each element should be a string of the form ENVVARNAME=VALUE.
643This list is temporarily prepended to `process-environment' prior to 643This list is temporarily prepended to `process-environment' prior to
644starting the compilation process.") 644starting the compilation process."
645 :type '(repeat (string :tag "ENVVARNAME=VALUE"))
646 :options '(("LANG=C"))
647 :group 'compilation
648 :version "24.1")
645 649
646;; History of compile commands. 650;; History of compile commands.
647(defvar compile-history nil) 651(defvar compile-history nil)
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index b3f9758bacf..000243b05df 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -343,7 +343,16 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
343 343
344;;;###autoload 344;;;###autoload
345(defconst grep-regexp-alist 345(defconst grep-regexp-alist
346 '(("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2" 346 '(
347 ;; Rule to match column numbers is commented out since no known grep
348 ;; produces them
349 ;; ("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2\\(?:\\([1-9][0-9]*\\)\\(?:-\\([1-9][0-9]*\\)\\)?\\2\\)?"
350 ;; 1 3 (4 . 5))
351 ;; Note that we want to use as tight a regexp as we can to try and
352 ;; handle weird file names (with colons in them) as well as possible.
353 ;; E.g. we use [1-9][0-9]* rather than [0-9]+ so as to accept ":034:"
354 ;; in file names.
355 ("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2"
347 1 3 356 1 3
348 ;; Calculate column positions (col . end-col) of first grep match on a line 357 ;; Calculate column positions (col . end-col) of first grep match on a line
349 ((lambda () 358 ((lambda ()
@@ -362,14 +371,6 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
362 (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end)))) 371 (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end))))
363 (when mend 372 (when mend
364 (- mend beg))))))) 373 (- mend beg)))))))
365 ;; Rule to match column numbers is commented out since no known grep
366 ;; produces them
367 ;; ("^\\(.+?\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?"
368 ;; 1 3 (4 . 5))
369 ;; Note that we want to use as tight a regexp as we can to try and
370 ;; handle weird file names (with colons in them) as well as possible.
371 ;; E.g. we use [1-9][0-9]* rather than [0-9]+ so as to accept ":034:" in
372 ;; file names.
373 ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) 374 ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
374 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") 375 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
375 376
diff --git a/lisp/window.el b/lisp/window.el
index 5272841a9c7..d771f9ffdcd 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2258,77 +2258,75 @@ and no others."
2258 (next-window base-window (if nomini 'arg) all-frames)))) 2258 (next-window base-window (if nomini 'arg) all-frames))))
2259 2259
2260;;; Deleting windows. 2260;;; Deleting windows.
2261(defcustom frame-auto-delete 'automatic 2261(defcustom window-auto-delete t
2262 "If non-nil, quitting a window can delete its frame. 2262 "If non-nil, quitting a window can delete the window.
2263If this variable is nil, functions that quit a window never 2263If this variable is t, functions that quit a window can delete
2264delete the associated frame. If this variable's value is the 2264the window and, if applicable, the corresponding frame. If it is
2265symbol `automatic', a frame is deleted only if the window is 2265'frame, these functions can delete a window and its frame,
2266dedicated or was created by `display-buffer'. If this variable 2266provided there are no other windows on the frame. If it is
2267is t, a frame can be always deleted, even if it was created by 2267'window, these functions can delete the window, provided there
2268`make-frame-command'. Other values should not be used. 2268are other windows on the corresponding frame. If this variable
2269 2269is nil, functions that quit a window never delete the window or
2270Note that a frame will be effectively deleted if and only if 2270the associated frame.
2271
2272Note that a frame can be effectively deleted if and only if
2271another frame still exists. 2273another frame still exists.
2272 2274
2273Functions quitting a window and consequently affected by this 2275Functions quitting a window and consequently affected by this
2274variable are `switch-to-prev-buffer', `delete-windows-on', 2276variable are `switch-to-prev-buffer' including its callers like
2275`replace-buffer-in-windows' and `quit-window'." 2277`bury-buffer', `replace-buffer-in-windows' and its callers like
2278`kill-buffer', and `quit-window'."
2276 :type '(choice 2279 :type '(choice
2277 (const :tag "Never" nil) 2280 (const :tag "Always" t)
2278 (const :tag "Automatic" automatic) 2281 (const :tag "Window" window)
2279 (const :tag "Always" t)) 2282 (const :tag "Frame" frame)
2280 :group 'windows 2283 (const :tag "Never" nil))
2281 :group 'frames) 2284 :group 'windows)
2282 2285
2283(defun window-deletable-p (&optional window) 2286(defun window-deletable-p (&optional window force)
2284 "Return t if WINDOW can be safely deleted from its frame. 2287 "Return t if WINDOW can be safely deleted from its frame.
2285Return `frame' if deleting WINDOW should also delete its 2288Return `frame' if deleting WINDOW should also delete its
2286frame." 2289frame.
2290
2291Optional argument FORCE non-nil means return non-nil unless
2292WINDOW is the root window of the only visible frame. FORCE nil
2293or omitted means return nil unless WINDOW is either dedicated to
2294its buffer or has no previous buffer to show instead."
2287 (setq window (window-normalize-any-window window)) 2295 (setq window (window-normalize-any-window window))
2296
2288 (unless ignore-window-parameters 2297 (unless ignore-window-parameters
2289 ;; Handle atomicity. 2298 ;; Handle atomicity.
2290 (when (window-parameter window 'window-atom) 2299 (when (window-parameter window 'window-atom)
2291 (setq window (window-atom-root window)))) 2300 (setq window (window-atom-root window))))
2292 (let ((parent (window-parent window)) 2301
2293 (frame (window-frame window)) 2302 (let* ((parent (window-parent window))
2294 (buffer (window-buffer window)) 2303 (frame (window-frame window))
2295 (dedicated (and (window-buffer window) (window-dedicated-p window))) 2304 (buffer (window-buffer window))
2296 (quit-restore (window-parameter window 'quit-restore))) 2305 (dedicated (and (window-buffer window) (window-dedicated-p window)))
2306 ;; prev non-nil means there is another buffer we can show
2307 ;; in WINDOW instead.
2308 (prev (and (window-prev-buffers window)
2309 (or (cdr (window-prev-buffers window))
2310 (not (eq (caar (window-prev-buffers window))
2311 buffer))))))
2297 (cond 2312 (cond
2298 ((frame-root-window-p window) 2313 ((frame-root-window-p window)
2299 ;; Don't delete FRAME if `frame-auto-delete' is nil. 2314 (when (and (or force dedicated
2300 (when (and (or (eq frame-auto-delete t) 2315 (and (not prev) (memq window-auto-delete '(t frame))))
2301 (and (eq frame-auto-delete 'automatic)
2302 ;; Delete FRAME only if it's either dedicated
2303 ;; or quit-restore's car is `new-frame' and
2304 ;; WINDOW still displays the same buffer
2305 (or dedicated
2306 (and (eq (car-safe quit-restore) 'new-frame)
2307 (eq (nth 1 quit-restore)
2308 (window-buffer window))))))
2309 ;; Don't delete FRAME if we have another buffer in
2310 ;; WINDOW's previous buffers. Bug#9419.
2311 (or (not (window-prev-buffers window))
2312 (eq (caar (window-prev-buffers window)) buffer))
2313 ;; Don't try to delete FRAME when there are no other
2314 ;; visible frames left.
2315 (other-visible-frames-p frame)) 2316 (other-visible-frames-p frame))
2317 ;; We can delete WINDOW's frame if (1) either FORCE is non-nil,
2318 ;; WINDOW is dedicated to its buffer, or there are no previous
2319 ;; buffers to show and (2) there are other visible frames left.
2316 'frame)) 2320 'frame))
2317 ;; Don't delete WINDOW if we find another buffer in WINDOW's 2321 ((and (or force dedicated
2318 ;; previous buffers. 2322 (and (not prev) (memq window-auto-delete '(t window))))
2319 ((and (or (not (window-prev-buffers window))
2320 (eq (caar (window-prev-buffers window)) buffer))
2321 ;; Delete WINDOW only if it's dedicated or quit-restore's car
2322 ;; is `new-frame' or `new-window' and it still displays the
2323 ;; same buffer.
2324 (or dedicated
2325 (and (memq (car-safe quit-restore) '(new-window new-frame))
2326 (eq (nth 1 quit-restore) (window-buffer window))))
2327 ;; Don't delete the last main window.
2328 (or ignore-window-parameters 2323 (or ignore-window-parameters
2329 (not (eq (window-parameter window 'window-side) 'none)) 2324 (not (eq (window-parameter window 'window-side) 'none))
2330 (and parent 2325 (and parent
2331 (eq (window-parameter parent 'window-side) 'none)))) 2326 (eq (window-parameter parent 'window-side) 'none))))
2327 ;; We can delete WINDOW if (1) either FORCE is non-nil, WINDOW is
2328 ;; dedicated to its buffer, or there are no previous buffers to
2329 ;; show and (2) WINDOW is not the main window of its frame.
2332 t)))) 2330 t))))
2333 2331
2334(defun window-or-subwindow-p (subwindow window) 2332(defun window-or-subwindow-p (subwindow window)
@@ -2601,11 +2599,7 @@ shall not be switched to in future invocations of this command."
2601 ;; When BURY-OR-KILL is non-nil, there's no previous buffer for 2599 ;; When BURY-OR-KILL is non-nil, there's no previous buffer for
2602 ;; this window, and we can delete the window (or the frame) do 2600 ;; this window, and we can delete the window (or the frame) do
2603 ;; that. 2601 ;; that.
2604 ((and bury-or-kill 2602 ((and bury-or-kill (setq deletable (window-deletable-p window)))
2605 (or (not (window-prev-buffers window))
2606 (and (eq (caar (window-prev-buffers window)) old-buffer)
2607 (not (cdr (car (window-prev-buffers window))))))
2608 (setq deletable (window-deletable-p window)))
2609 (if (eq deletable 'frame) 2603 (if (eq deletable 'frame)
2610 (delete-frame (window-frame window)) 2604 (delete-frame (window-frame window))
2611 (delete-window window))) 2605 (delete-window window)))
@@ -2877,7 +2871,7 @@ frames left."
2877 (all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame)))) 2871 (all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame))))
2878 (dolist (window (window-list-1 nil nil all-frames)) 2872 (dolist (window (window-list-1 nil nil all-frames))
2879 (if (eq (window-buffer window) buffer) 2873 (if (eq (window-buffer window) buffer)
2880 (let ((deletable (window-deletable-p window))) 2874 (let ((deletable (window-deletable-p window t)))
2881 (cond 2875 (cond
2882 ((eq deletable 'frame) 2876 ((eq deletable 'frame)
2883 ;; Delete frame. 2877 ;; Delete frame.
@@ -2913,7 +2907,7 @@ all window-local buffer lists."
2913 ((eq deletable 'frame) 2907 ((eq deletable 'frame)
2914 ;; Delete frame. 2908 ;; Delete frame.
2915 (delete-frame (window-frame window))) 2909 (delete-frame (window-frame window)))
2916 ((and (window-dedicated-p window) deletable) 2910 (deletable
2917 ;; Delete window. 2911 ;; Delete window.
2918 (delete-window window)) 2912 (delete-window window))
2919 (t 2913 (t
@@ -2939,11 +2933,7 @@ one. If non-nil, reset `quit-restore' parameter to nil."
2939 (quit-restore (window-parameter window 'quit-restore)) 2933 (quit-restore (window-parameter window 'quit-restore))
2940 deletable resize) 2934 deletable resize)
2941 (cond 2935 (cond
2942 ((and (or (and (memq (car-safe quit-restore) '(new-window new-frame)) 2936 ((setq deletable (window-deletable-p window))
2943 ;; Check that WINDOW's buffer is still the same.
2944 (eq (window-buffer window) (nth 1 quit-restore)))
2945 (window-dedicated-p window))
2946 (setq deletable (window-deletable-p window)))
2947 ;; Check if WINDOW's frame can be deleted. 2937 ;; Check if WINDOW's frame can be deleted.
2948 (if (eq deletable 'frame) 2938 (if (eq deletable 'frame)
2949 (delete-frame (window-frame window)) 2939 (delete-frame (window-frame window))