diff options
-rw-r--r-- | lisp/ChangeLog | 16 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 10 | ||||
-rw-r--r-- | lisp/progmodes/grep.el | 19 | ||||
-rw-r--r-- | lisp/window.el | 116 | ||||
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/emacs.c | 2 |
6 files changed, 92 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 @@ +2011-09-08 Juri Linkov <juri@jurta.org> + + * progmodes/compile.el (compilation-environment): Make it + a defcustom (bug#8340). + +2011-09-08 Martin Rudalics <rudalics@gmx.at> + + * window.el (frame-auto-delete): Rename to window-auto-delete. + Make it control auto-deletion of windows and/or frames. + (window-deletable-p): New argument FORCE. Rewrite conditions + for deleting window/frame. (Bug#9419) + (switch-to-prev-buffer, replace-buffer-in-windows, quit-window): + Rewrite handling of case when window/frame can be deleted. + (delete-windows-on): Call window-deletable-p with new FORCE + argument t. (Bug#9456) + 2011-09-07 Chong Yidong <cyd@stupidchicken.com> * 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, and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to write into the compilation buffer, and to put in its mode line.") -(defvar compilation-environment nil - "*List of environment variables for compilation to inherit. +(defcustom compilation-environment nil + "List of environment variables for compilation to inherit. Each element should be a string of the form ENVVARNAME=VALUE. This list is temporarily prepended to `process-environment' prior to -starting the compilation process.") +starting the compilation process." + :type '(repeat (string :tag "ENVVARNAME=VALUE")) + :options '(("LANG=C")) + :group 'compilation + :version "24.1") ;; History of compile commands. (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 ;;;###autoload (defconst grep-regexp-alist - '(("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2" + '( + ;; Rule to match column numbers is commented out since no known grep + ;; produces them + ;; ("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2\\(?:\\([1-9][0-9]*\\)\\(?:-\\([1-9][0-9]*\\)\\)?\\2\\)?" + ;; 1 3 (4 . 5)) + ;; Note that we want to use as tight a regexp as we can to try and + ;; handle weird file names (with colons in them) as well as possible. + ;; E.g. we use [1-9][0-9]* rather than [0-9]+ so as to accept ":034:" + ;; in file names. + ("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2" 1 3 ;; Calculate column positions (col . end-col) of first grep match on a line ((lambda () @@ -362,14 +371,6 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end)))) (when mend (- mend beg))))))) - ;; Rule to match column numbers is commented out since no known grep - ;; produces them - ;; ("^\\(.+?\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?" - ;; 1 3 (4 . 5)) - ;; Note that we want to use as tight a regexp as we can to try and - ;; handle weird file names (with colons in them) as well as possible. - ;; E.g. we use [1-9][0-9]* rather than [0-9]+ so as to accept ":034:" in - ;; file names. ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") 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." (next-window base-window (if nomini 'arg) all-frames)))) ;;; Deleting windows. -(defcustom frame-auto-delete 'automatic - "If non-nil, quitting a window can delete its frame. -If this variable is nil, functions that quit a window never -delete the associated frame. If this variable's value is the -symbol `automatic', a frame is deleted only if the window is -dedicated or was created by `display-buffer'. If this variable -is t, a frame can be always deleted, even if it was created by -`make-frame-command'. Other values should not be used. - -Note that a frame will be effectively deleted if and only if +(defcustom window-auto-delete t + "If non-nil, quitting a window can delete the window. +If this variable is t, functions that quit a window can delete +the window and, if applicable, the corresponding frame. If it is +'frame, these functions can delete a window and its frame, +provided there are no other windows on the frame. If it is +'window, these functions can delete the window, provided there +are other windows on the corresponding frame. If this variable +is nil, functions that quit a window never delete the window or +the associated frame. + +Note that a frame can be effectively deleted if and only if another frame still exists. Functions quitting a window and consequently affected by this -variable are `switch-to-prev-buffer', `delete-windows-on', -`replace-buffer-in-windows' and `quit-window'." +variable are `switch-to-prev-buffer' including its callers like +`bury-buffer', `replace-buffer-in-windows' and its callers like +`kill-buffer', and `quit-window'." :type '(choice - (const :tag "Never" nil) - (const :tag "Automatic" automatic) - (const :tag "Always" t)) - :group 'windows - :group 'frames) + (const :tag "Always" t) + (const :tag "Window" window) + (const :tag "Frame" frame) + (const :tag "Never" nil)) + :group 'windows) -(defun window-deletable-p (&optional window) +(defun window-deletable-p (&optional window force) "Return t if WINDOW can be safely deleted from its frame. Return `frame' if deleting WINDOW should also delete its -frame." +frame. + +Optional argument FORCE non-nil means return non-nil unless +WINDOW is the root window of the only visible frame. FORCE nil +or omitted means return nil unless WINDOW is either dedicated to +its buffer or has no previous buffer to show instead." (setq window (window-normalize-any-window window)) + (unless ignore-window-parameters ;; Handle atomicity. (when (window-parameter window 'window-atom) (setq window (window-atom-root window)))) - (let ((parent (window-parent window)) - (frame (window-frame window)) - (buffer (window-buffer window)) - (dedicated (and (window-buffer window) (window-dedicated-p window))) - (quit-restore (window-parameter window 'quit-restore))) + + (let* ((parent (window-parent window)) + (frame (window-frame window)) + (buffer (window-buffer window)) + (dedicated (and (window-buffer window) (window-dedicated-p window))) + ;; prev non-nil means there is another buffer we can show + ;; in WINDOW instead. + (prev (and (window-prev-buffers window) + (or (cdr (window-prev-buffers window)) + (not (eq (caar (window-prev-buffers window)) + buffer)))))) (cond ((frame-root-window-p window) - ;; Don't delete FRAME if `frame-auto-delete' is nil. - (when (and (or (eq frame-auto-delete t) - (and (eq frame-auto-delete 'automatic) - ;; Delete FRAME only if it's either dedicated - ;; or quit-restore's car is `new-frame' and - ;; WINDOW still displays the same buffer - (or dedicated - (and (eq (car-safe quit-restore) 'new-frame) - (eq (nth 1 quit-restore) - (window-buffer window)))))) - ;; Don't delete FRAME if we have another buffer in - ;; WINDOW's previous buffers. Bug#9419. - (or (not (window-prev-buffers window)) - (eq (caar (window-prev-buffers window)) buffer)) - ;; Don't try to delete FRAME when there are no other - ;; visible frames left. + (when (and (or force dedicated + (and (not prev) (memq window-auto-delete '(t frame)))) (other-visible-frames-p frame)) + ;; We can delete WINDOW's frame if (1) either FORCE is non-nil, + ;; WINDOW is dedicated to its buffer, or there are no previous + ;; buffers to show and (2) there are other visible frames left. 'frame)) - ;; Don't delete WINDOW if we find another buffer in WINDOW's - ;; previous buffers. - ((and (or (not (window-prev-buffers window)) - (eq (caar (window-prev-buffers window)) buffer)) - ;; Delete WINDOW only if it's dedicated or quit-restore's car - ;; is `new-frame' or `new-window' and it still displays the - ;; same buffer. - (or dedicated - (and (memq (car-safe quit-restore) '(new-window new-frame)) - (eq (nth 1 quit-restore) (window-buffer window)))) - ;; Don't delete the last main window. + ((and (or force dedicated + (and (not prev) (memq window-auto-delete '(t window)))) (or ignore-window-parameters (not (eq (window-parameter window 'window-side) 'none)) (and parent (eq (window-parameter parent 'window-side) 'none)))) + ;; We can delete WINDOW if (1) either FORCE is non-nil, WINDOW is + ;; dedicated to its buffer, or there are no previous buffers to + ;; show and (2) WINDOW is not the main window of its frame. t)))) (defun window-or-subwindow-p (subwindow window) @@ -2601,11 +2599,7 @@ shall not be switched to in future invocations of this command." ;; When BURY-OR-KILL is non-nil, there's no previous buffer for ;; this window, and we can delete the window (or the frame) do ;; that. - ((and bury-or-kill - (or (not (window-prev-buffers window)) - (and (eq (caar (window-prev-buffers window)) old-buffer) - (not (cdr (car (window-prev-buffers window)))))) - (setq deletable (window-deletable-p window))) + ((and bury-or-kill (setq deletable (window-deletable-p window))) (if (eq deletable 'frame) (delete-frame (window-frame window)) (delete-window window))) @@ -2877,7 +2871,7 @@ frames left." (all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame)))) (dolist (window (window-list-1 nil nil all-frames)) (if (eq (window-buffer window) buffer) - (let ((deletable (window-deletable-p window))) + (let ((deletable (window-deletable-p window t))) (cond ((eq deletable 'frame) ;; Delete frame. @@ -2913,7 +2907,7 @@ all window-local buffer lists." ((eq deletable 'frame) ;; Delete frame. (delete-frame (window-frame window))) - ((and (window-dedicated-p window) deletable) + (deletable ;; Delete window. (delete-window window)) (t @@ -2939,11 +2933,7 @@ one. If non-nil, reset `quit-restore' parameter to nil." (quit-restore (window-parameter window 'quit-restore)) deletable resize) (cond - ((and (or (and (memq (car-safe quit-restore) '(new-window new-frame)) - ;; Check that WINDOW's buffer is still the same. - (eq (window-buffer window) (nth 1 quit-restore))) - (window-dedicated-p window)) - (setq deletable (window-deletable-p window))) + ((setq deletable (window-deletable-p window)) ;; Check if WINDOW's frame can be deleted. (if (eq deletable 'frame) (delete-frame (window-frame window)) diff --git a/src/ChangeLog b/src/ChangeLog index 44b8e168031..a4c985b1a0c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-09-08 Juanma Barranquero <lekktu@gmail.com> + + * emacs.c (my_heap_start): #ifdef to avoid warnings when unused. + 2011-09-07 Eli Zaretskii <eliz@gnu.org> * xdisp.c (move_it_in_display_line_to): Call RESTORE_IT on ppos_it diff --git a/src/emacs.c b/src/emacs.c index 57a52a0c48f..c766523b1c3 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -174,8 +174,10 @@ int display_arg; Tells GC how to save a copy of the stack. */ char *stack_bottom; +#if defined (DOUG_LEA_MALLOC) || defined (GNU_LINUX) /* The address where the heap starts (from the first sbrk (0) call). */ static void *my_heap_start; +#endif #ifdef GNU_LINUX /* The gap between BSS end and heap start as far as we can tell. */ |