Now on revision 109757. ------------------------------------------------------------ revno: 109757 fixes bug: http://debbugs.gnu.org/12187 committer: Juri Linkov branch nick: trunk timestamp: Thu 2012-08-23 02:30:47 +0300 message: * lisp/info.el (Info-fontify-node): Hide the suffix of the Info file name in the header line. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 17:55:19 +0000 +++ lisp/ChangeLog 2012-08-22 23:30:47 +0000 @@ -1,3 +1,8 @@ +2012-08-22 Juri Linkov + + * info.el (Info-fontify-node): Hide the suffix of the + Info file name in the header line. (Bug#12187) + 2012-08-22 Glenn Morris * calendar/cal-tex.el (cal-tex-weekly-common): === modified file 'lisp/info.el' --- lisp/info.el 2012-08-21 00:12:42 +0000 +++ lisp/info.el 2012-08-22 23:30:47 +0000 @@ -4527,7 +4527,17 @@ ((not (bobp)) ;; Hide the punctuation at the end, too. (skip-chars-backward " \t,") - (put-text-property (point) header-end 'invisible t)))))) + (put-text-property (point) header-end 'invisible t) + ;; Hide the suffix of the Info file name. + (beginning-of-line) + (if (re-search-forward + (format "File: %s\\([^,\n\t]+\\)," + (if (stringp Info-current-file) + (file-name-nondirectory Info-current-file) + Info-current-file)) + header-end t) + (put-text-property (match-beginning 1) (match-end 1) + 'invisible t))))))) ;; Fontify titles (goto-char (point-min)) ------------------------------------------------------------ revno: 109756 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-08-22 13:55:19 -0400 message: * lisp/calendar/cal-tex.el (cal-tex-weekly-common): Restore leading blank page. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 17:32:51 +0000 +++ lisp/ChangeLog 2012-08-22 17:55:19 +0000 @@ -1,3 +1,8 @@ +2012-08-22 Glenn Morris + + * calendar/cal-tex.el (cal-tex-weekly-common): + Restore leading blank page. + 2012-08-22 Le Wang (tiny change) * misc.el (forward-to-word, backward-to-word): Activate or extend === modified file 'lisp/calendar/cal-tex.el' --- lisp/calendar/cal-tex.el 2012-08-22 00:39:44 +0000 +++ lisp/calendar/cal-tex.el 2012-08-22 17:55:19 +0000 @@ -1080,8 +1080,8 @@ (cal-tex-longday "weekend" "0.8in") (insert cal-tex-lefthead) (cal-tex-longday "leftday" "1.85in")) - (cal-tex-preamble "twoside,12pt") - (insert "\\textwidth 7in + (cal-tex-preamble "twoside,12pt") + (insert "\\textwidth 7in \\textheight 10.5in \\oddsidemargin 0in \\evensidemargin 0in @@ -1090,13 +1090,19 @@ \\headsep 0.125in \\footskip .125in ") - (insert cal-tex-righthead) - (cal-tex-longday "rightday" "2.75in") - (cal-tex-longday "weekend" "1.8in") - (insert cal-tex-lefthead) - (cal-tex-longday "leftday" "2.75in")) + (insert cal-tex-righthead) + (cal-tex-longday "rightday" "2.75in") + (cal-tex-longday "weekend" "1.8in") + (insert cal-tex-lefthead) + (cal-tex-longday "leftday" "2.75in")) (cal-tex-b-document) (cal-tex-cmd "\\pagestyle" "empty") + ;; Let's assume this is something to with twopage documents. + ;; It has the downside that we start with a blank page. + ;; It doesn't make obvious sense when oddside and evenside margins + ;; are the same (non-filofax), but consider the left and right + ;; versions of various functions as applicable to even and odd pages. + (cal-tex-newpage) (dotimes (i n) (insert "\\lefthead") (cal-tex-arg ------------------------------------------------------------ revno: 109755 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-08-22 13:34:50 -0400 message: Bump executable-prefix :version diff: === modified file 'lisp/progmodes/executable.el' --- lisp/progmodes/executable.el 2012-08-22 16:58:14 +0000 +++ lisp/progmodes/executable.el 2012-08-22 17:34:50 +0000 @@ -86,6 +86,7 @@ (defcustom executable-prefix "#!" "Interpreter magic number prefix inserted when there was no magic number." + :version "24.3" ; "#! " -> "#!" :type 'string :group 'executable) ------------------------------------------------------------ revno: 109754 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-08-22 13:32:51 -0400 message: ChangeLog fix diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 17:12:35 +0000 +++ lisp/ChangeLog 2012-08-22 17:32:51 +0000 @@ -1,8 +1,10 @@ +2012-08-22 Le Wang (tiny change) + + * misc.el (forward-to-word, backward-to-word): Activate or extend + the region under `shift-select-mode'. (Bug#12231) + 2012-08-22 Bastien Guerry - * misc.el (forward-to-word, backward-to-word): Activate or extend - the region under `shift-select-mode'. - * progmodes/executable.el (executable-prefix): Set to "#!" instead of "#! ". http://www.in-ulm.de/~mascheck/various/shebang/#details gives details on why the space is never needed. ------------------------------------------------------------ revno: 109753 committer: Bastien Guerry branch nick: trunk timestamp: Wed 2012-08-22 19:12:35 +0200 message: misc.el (forward-to-word, backward-to-word): Use (interactive "^p"). Thanks to Le Wang for the patch. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 16:58:14 +0000 +++ lisp/ChangeLog 2012-08-22 17:12:35 +0000 @@ -1,4 +1,7 @@ -2012-08-22 Bastien Guerry +2012-08-22 Bastien Guerry + + * misc.el (forward-to-word, backward-to-word): Activate or extend + the region under `shift-select-mode'. * progmodes/executable.el (executable-prefix): Set to "#!" instead of "#! ". http://www.in-ulm.de/~mascheck/various/shebang/#details === modified file 'lisp/misc.el' --- lisp/misc.el 2012-04-10 14:16:05 +0000 +++ lisp/misc.el 2012-08-22 17:12:35 +0000 @@ -99,14 +99,14 @@ (defun forward-to-word (arg) "Move forward until encountering the beginning of a word. With argument, do this that many times." - (interactive "p") + (interactive "^p") (or (re-search-forward (if (> arg 0) "\\W\\b" "\\b\\W") nil t arg) (goto-char (if (> arg 0) (point-max) (point-min))))) (defun backward-to-word (arg) "Move backward until encountering the end of a word. With argument, do this that many times." - (interactive "p") + (interactive "^p") (forward-to-word (- arg))) ;;;###autoload ------------------------------------------------------------ revno: 109752 committer: Bastien Guerry branch nick: trunk timestamp: Wed 2012-08-22 18:58:14 +0200 message: Set `executable-prefix' to "#!" instead of "#! ". See http://www.in-ulm.de/~mascheck/various/shebang/#details for details on why the blank space is never needed. Thanks to Leo for the patch. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 09:22:08 +0000 +++ lisp/ChangeLog 2012-08-22 16:58:14 +0000 @@ -1,3 +1,9 @@ +2012-08-22 Bastien Guerry + + * progmodes/executable.el (executable-prefix): Set to "#!" instead + of "#! ". http://www.in-ulm.de/~mascheck/various/shebang/#details + gives details on why the space is never needed. + 2012-08-22 Martin Rudalics * window.el (walk-window-tree, window-with-parameter): New @@ -400,7 +406,7 @@ 2012-08-13 Bastien Guerry - * window.el (special-display-popup-frame): Small docstring + * window.el (special-display-popup-frame): Minor docstring enhancement. (Bug#12172) 2012-08-13 Andreas Schwab === modified file 'lisp/progmodes/executable.el' --- lisp/progmodes/executable.el 2012-04-09 13:05:48 +0000 +++ lisp/progmodes/executable.el 2012-08-22 16:58:14 +0000 @@ -84,7 +84,7 @@ :group 'executable) -(defcustom executable-prefix "#! " +(defcustom executable-prefix "#!" "Interpreter magic number prefix inserted when there was no magic number." :type 'string :group 'executable) ------------------------------------------------------------ revno: 109751 committer: Dan Nicolaescu branch nick: trunk timestamp: Wed 2012-08-22 12:05:04 -0400 message: * frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_NS_P): Change to compile time tests instead of run time tests on systems that do not use them. (FRAME_MAC_P): Remove leftover from deleted code. * frame.c (syms_of_frame): Remove leftover from deleted code. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-22 09:55:35 +0000 +++ src/ChangeLog 2012-08-22 16:05:04 +0000 @@ -1,3 +1,11 @@ +2012-08-22 Dan Nicolaescu + + * frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_NS_P): Change to + compile time tests instead of run time tests on systems that do + not use them. + (FRAME_MAC_P): Remove leftover from deleted code. + * frame.c (syms_of_frame): Remove leftover from deleted code. + 2012-08-22 Jan Djärv * nsterm.m (insertText:): Don't clear modifiers if code is space. === modified file 'src/frame.c' --- src/frame.c 2012-08-18 06:06:39 +0000 +++ src/frame.c 2012-08-22 16:05:04 +0000 @@ -4247,7 +4247,6 @@ DEFSYM (Qx, "x"); DEFSYM (Qw32, "w32"); DEFSYM (Qpc, "pc"); - DEFSYM (Qmac, "mac"); DEFSYM (Qns, "ns"); DEFSYM (Qvisible, "visible"); DEFSYM (Qbuffer_predicate, "buffer-predicate"); === modified file 'src/frame.h' --- src/frame.h 2012-08-17 21:52:15 +0000 +++ src/frame.h 2012-08-22 16:05:04 +0000 @@ -621,11 +621,21 @@ #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial) #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap) #define FRAME_X_P(f) ((f)->output_method == output_x_window) +#ifndef WINDOWSNT +#define FRAME_W32_P(f) (0) +#else #define FRAME_W32_P(f) ((f)->output_method == output_w32) +#endif +#ifndef MSDOS +#define FRAME_MSDOS_P(f) (0) +#else #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw) -#define FRAME_MAC_P(f) ((f)->output_method == output_mac) +#endif +#ifndef HAVE_NS +#define FRAME_NS_P(f) (0) +#else #define FRAME_NS_P(f) ((f)->output_method == output_ns) - +#endif /* FRAME_WINDOW_P tests whether the frame is a window, and is defined to be the predicate for the window system being used. */ ------------------------------------------------------------ revno: 109750 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2012-08-22 13:30:25 +0200 message: nt/config.nt: Sync with autogen/config.in. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-08-17 10:51:29 +0000 +++ nt/ChangeLog 2012-08-22 11:30:25 +0000 @@ -1,3 +1,7 @@ +2012-08-22 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + 2012-08-17 Juanma Barranquero * config.nt: Sync with autogen/config.in. === modified file 'nt/config.nt' --- nt/config.nt 2012-08-17 10:51:29 +0000 +++ nt/config.nt 2012-08-22 11:30:25 +0000 @@ -1563,20 +1563,34 @@ #if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline -# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ -# define _GL_INLINE_HEADER_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ - _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") -# define _GL_INLINE_HEADER_END \ - _Pragma ("GCC diagnostic pop") +#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# if __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline # endif +# define _GL_EXTERN_INLINE extern #else # define _GL_INLINE static inline # define _GL_EXTERN_INLINE static inline #endif -#ifndef _GL_INLINE_HEADER_BEGIN +#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +# if __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else # define _GL_INLINE_HEADER_BEGIN # define _GL_INLINE_HEADER_END #endif ------------------------------------------------------------ revno: 109749 committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2012-08-22 10:37:55 +0000 message: [Gnus] Enable posting-style group parameter to hold non-ASCII string values diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-08-21 01:23:57 +0000 +++ lisp/gnus/ChangeLog 2012-08-22 10:37:55 +0000 @@ -1,3 +1,12 @@ +2012-08-22 Katsumi Yamaoka + + * gnus-cus.el (gnus-group-customize): Decode values posting-style holds. + (gnus-group-customize-done): Encode values posting-style holds. + + * gnus-msg.el (gnus-summary-resend-message) + (gnus-configure-posting-styles): Decode values posting-style group + parameter holds. + 2012-08-21 Katsumi Yamaoka * gnus-msg.el (gnus-summary-resend-message): Honor posting-style for === modified file 'lisp/gnus/gnus-cus.el' --- lisp/gnus/gnus-cus.el 2012-01-19 07:21:25 +0000 +++ lisp/gnus/gnus-cus.el 2012-08-22 10:37:55 +0000 @@ -417,6 +417,11 @@ (delq elem tmp)) (setq tmp (cdr tmp)))) + ;; Decode values posting-style holds. + (dolist (style (cdr (assq 'posting-style values))) + (when (stringp (cadr style)) + (setcdr style (list (mm-decode-coding-string (cadr style) 'utf-8))))) + (setq gnus-custom-params (apply 'widget-create 'group :value values @@ -487,14 +492,17 @@ (defun gnus-group-customize-done (&rest ignore) "Apply changes and bury the buffer." (interactive) - (if gnus-custom-topic - (gnus-topic-set-parameters gnus-custom-topic - (widget-value gnus-custom-params)) - (gnus-group-edit-group-done 'params gnus-custom-group - (widget-value gnus-custom-params)) - (gnus-group-edit-group-done 'method gnus-custom-group - (widget-value gnus-custom-method))) - (bury-buffer)) + (let ((params (widget-value gnus-custom-params))) + ;; Encode values posting-style holds. + (dolist (style (cdr (assq 'posting-style params))) + (when (stringp (cadr style)) + (setcdr style (list (mm-encode-coding-string (cadr style) 'utf-8))))) + (if gnus-custom-topic + (gnus-topic-set-parameters gnus-custom-topic params) + (gnus-group-edit-group-done 'params gnus-custom-group params) + (gnus-group-edit-group-done 'method gnus-custom-group + (widget-value gnus-custom-method))) + (bury-buffer))) ;;; Score Customization: === modified file 'lisp/gnus/gnus-msg.el' --- lisp/gnus/gnus-msg.el 2012-08-21 01:23:57 +0000 +++ lisp/gnus/gnus-msg.el 2012-08-22 10:37:55 +0000 @@ -1376,6 +1376,9 @@ (user-full-name user-full-name) (user-mail-address user-mail-address) tem) + (dolist (style styles) + (when (stringp (cadr style)) + (setcdr style (list (mm-decode-coding-string (cadr style) 'utf-8))))) (dolist (style (if styles (append gnus-posting-styles (list (cons ".*" styles))) gnus-posting-styles)) @@ -1807,6 +1810,10 @@ (when gnus-newsgroup-name (let ((tmp-style (gnus-group-find-parameter group 'posting-style t))) (when tmp-style + (dolist (style tmp-style) + (when (stringp (cadr style)) + (setcdr style (list (mm-decode-coding-string (cadr style) + 'utf-8))))) (setq styles (append styles (list (cons ".*" tmp-style))))))) ;; Go through all styles and look for matches. (dolist (style styles) ------------------------------------------------------------ revno: 109748 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-08-22 06:17:28 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/config.in' --- autogen/config.in 2012-08-17 10:17:30 +0000 +++ autogen/config.in 2012-08-22 10:17:28 +0000 @@ -1554,20 +1554,34 @@ #if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline -# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ -# define _GL_INLINE_HEADER_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ - _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") -# define _GL_INLINE_HEADER_END \ - _Pragma ("GCC diagnostic pop") +#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# if __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline # endif +# define _GL_EXTERN_INLINE extern #else # define _GL_INLINE static inline # define _GL_EXTERN_INLINE static inline #endif -#ifndef _GL_INLINE_HEADER_BEGIN +#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +# if __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else # define _GL_INLINE_HEADER_BEGIN # define _GL_INLINE_HEADER_END #endif ------------------------------------------------------------ revno: 109747 committer: Jan D. branch nick: trunk timestamp: Wed 2012-08-22 11:55:35 +0200 message: * nsterm.m (insertText:): Don't clear modifiers if code is space. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-22 07:20:42 +0000 +++ src/ChangeLog 2012-08-22 09:55:35 +0000 @@ -1,3 +1,7 @@ +2012-08-22 Jan Djärv + + * nsterm.m (insertText:): Don't clear modifiers if code is space. + 2012-08-22 Paul Eggert * fontset.c (FONTSET_ADD): Return void, not Lisp_Object. === modified file 'src/nsterm.m' --- src/nsterm.m 2012-08-21 20:50:31 +0000 +++ src/nsterm.m 2012-08-22 09:55:35 +0000 @@ -5091,7 +5091,8 @@ /* TODO: still need this? */ if (code == 0x2DC) code = '~'; /* 0x7E */ - emacs_event->modifiers = 0; + if (code != 32) /* Space */ + emacs_event->modifiers = 0; emacs_event->kind = code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; emacs_event->code = code; ------------------------------------------------------------ revno: 109746 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-08-22 11:22:08 +0200 message: Rewrite handling of side and atomic windows. * window.el (display-buffer-in-atom-window, window--major-non-side-window) (window--major-side-window, display-buffer-in-major-side-window) (delete-side-window, display-buffer-in-side-window): New functions. (window--side-check, window-deletable-p, delete-window) (delete-other-windows, split-window): Handle side windows and atomic windows appropriately. (window--display-buffer): Call display-buffer-record-window also when the window buffer did not change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 08:42:34 +0000 +++ lisp/ChangeLog 2012-08-22 09:22:08 +0000 @@ -7,6 +7,15 @@ (window-in-direction): Simplify and rewrite doc-string. (window--size-ignore): Rename to window--size-ignore-p. Update callers. + (display-buffer-in-atom-window, window--major-non-side-window) + (window--major-side-window, display-buffer-in-major-side-window) + (delete-side-window, display-buffer-in-side-window): New + functions. + (window--side-check, window-deletable-p, delete-window) + (delete-other-windows, split-window): Handle side windows and + atomic windows appropriately. + (window--display-buffer): Call display-buffer-record-window also + when the window buffer did not change. 2012-08-22 Christopher Schmidt === modified file 'lisp/window.el' --- lisp/window.el 2012-08-22 08:42:34 +0000 +++ lisp/window.el 2012-08-22 09:22:08 +0000 @@ -357,6 +357,45 @@ window t) window)) +(defun display-buffer-in-atom-window (buffer alist) + "Display BUFFER in an atomic window. +This function displays BUFFER in a new window that will be +combined with an existing window to form an atomic window. If +the existing window is already part of an atomic window, add the +new window to that atomic window. Operations like `split-window' +or `delete-window', when applied to a constituent of an atomic +window, are applied atomically to the root of that atomic window. + +ALIST is an association list of symbols and values. The +following symbols can be used. + +`window' specifies the existing window the new window shall be + combined with. Use `window-atom-root' to make the new window a + sibling of an atomic window's root. If an internal window is + specified here, all children of that window become part of the + atomic window too. If no window is specified, the new window + becomes a sibling of the selected window. + +`side' denotes the side of the existing window where the new + window shall be located. Valid values are `below', `right', + `above' and `left'. The default is `below'. + +The return value is the new window, nil when creating that window +failed." + (let ((ignore-window-parameters t) + (window-combination-limit t) + (window (cdr (assq 'window alist))) + (side (cdr (assq 'side alist))) + new) + (setq window (window-normalize-window window)) + ;; Split off new window + (when (setq new (split-window window nil side)) + ;; Make sure we have a valid atomic window. + (window-make-atom (window-parent window)) + ;; Display BUFFER in NEW and return NEW. + (window--display-buffer + buffer new 'window display-buffer-mark-dedicated)))) + (defun window--atom-check-1 (window) "Subroutine of `window--atom-check'." (when window @@ -446,23 +485,273 @@ (integer :tag "Number" :value 3 :size 5))) :group 'windows) +(defun window--major-non-side-window (&optional frame) + "Return the major non-side window of frame FRAME. +The optional argument FRAME must be a live frame and defaults to +the selected one. + +If FRAME has at least one side window, the major non-side window +is either an internal non-side window such that all other +non-side windows on FRAME descend from it, or the single live +non-side window of FRAME. If FRAME has no side windows, return +its root window." + (let ((frame (window-normalize-frame frame)) + major sibling) + ;; Set major to the _last_ window found by `walk-window-tree' that + ;; is not a side window but has a side window as its sibling. + (walk-window-tree + (lambda (window) + (and (not (window-parameter window 'window-side)) + (or (and (setq sibling (window-prev-sibling window)) + (window-parameter sibling 'window-side)) + (and (setq sibling (window-next-sibling window)) + (window-parameter sibling 'window-side))) + (setq major window))) + frame t) + (or major (frame-root-window frame)))) + +(defun window--major-side-window (side) + "Return major side window on SIDE. +SIDE must be one of the symbols `left', `top', `right' or +`bottom'. Return nil if no such window exists." + (let ((root (frame-root-window)) + window) + ;; (1) If a window on the opposite side exists, return that window's + ;; sibling. + ;; (2) If the new window shall span the entire side, return the + ;; frame's root window. + ;; (3) If a window on an orthogonal side exists, return that + ;; window's sibling. + ;; (4) Otherwise return the frame's root window. + (cond + ((or (and (eq side 'left) + (setq window (window-with-parameter 'window-side 'right nil t))) + (and (eq side 'top) + (setq window (window-with-parameter 'window-side 'bottom nil t)))) + (window-prev-sibling window)) + ((or (and (eq side 'right) + (setq window (window-with-parameter 'window-side 'left nil t))) + (and (eq side 'bottom) + (setq window (window-with-parameter 'window-side 'top nil t)))) + (window-next-sibling window)) + ((memq side '(left right)) + (cond + (window-sides-vertical + root) + ((setq window (window-with-parameter 'window-side 'top nil t)) + (window-next-sibling window)) + ((setq window (window-with-parameter 'window-side 'bottom nil t)) + (window-prev-sibling window)) + (t root))) + ((memq side '(top bottom)) + (cond + ((not window-sides-vertical) + root) + ((setq window (window-with-parameter 'window-side 'left nil t)) + (window-next-sibling window)) + ((setq window (window-with-parameter 'window-side 'right nil t)) + (window-prev-sibling window)) + (t root)))))) + +(defun display-buffer-in-major-side-window (buffer side slot &optional alist) + "Display BUFFER in a new window on SIDE of the selected frame. +SIDE must be one of `left', `top', `right' or `bottom'. SLOT +specifies the slot to use. ALIST is an association list of +symbols and values as passed to `display-buffer-in-side-window'. +This function may be called only if no window on SIDE exists yet. +The new window automatically becomes the \"major\" side window on +SIDE. Return the new window, nil if its creation window failed." + (let* ((root (frame-root-window)) + (left-or-right (memq side '(left right))) + (size (or (assq 'size alist) + (/ (window-total-size (frame-root-window) left-or-right) + ;; By default use a fourth of the size of the + ;; frame's root window. This has to be made + ;; customizable via ALIST. + 4))) + (major (window--major-side-window side)) + (selected-window (selected-window)) + (on-side (cond + ((eq side 'top) 'above) + ((eq side 'bottom) 'below) + (t side))) + ;; The following two bindings will tell `split-window' to take + ;; the space for the new window from `major' and not make a new + ;; parent window unless needed. + (window-combination-resize 'side) + (window-combination-limit nil) + (new (split-window major (- size) on-side)) + fun) + (when new + ;; Initialize `window-side' parameter of new window to SIDE. + (set-window-parameter new 'window-side side) + ;; Install `window-slot' parameter of new window. + (set-window-parameter new 'window-slot slot) + ;; Install `delete-window' parameter thus making sure that when + ;; the new window is deleted, a side window on the opposite side + ;; does not get resized. + (set-window-parameter new 'delete-window 'delete-side-window) + ;; Install BUFFER in new window and return NEW. + (window--display-buffer buffer new 'window 'side)))) + +(defun delete-side-window (window) + "Delete side window WINDOW." + (let ((window-combination-resize + (window-parameter (window-parent window) 'window-side)) + (ignore-window-parameters t)) + (delete-window window))) + +(defun display-buffer-in-side-window (buffer alist) + "Display BUFFER in a window on side SIDE of the selected frame. +ALIST is an association list of symbols and values. The +following symbols can be used: + +`side' denotes the side of the existing window where the new + window shall be located. Valid values are `bottom', `right', + `top' and `left'. The default is `bottom'. + +`slot' if non-nil, specifies the window slot where to display + BUFFER. A value of zero or nil means use the middle slot on + the specified side. A negative value means use a slot + preceding (that is, above or on the left of) the middle slot. + A positive value means use a slot following (that is, below or + on the right of) the middle slot. The default is zero." + (let ((side (or (cdr (assq 'side alist)) 'bottom)) + (slot (or (cdr (assq 'slot alist)) 0)) + new) + (cond + ((not (memq side '(top bottom left right))) + (error "Invalid side %s specified" side)) + ((not (numberp slot)) + (error "Invalid slot %s specified" slot))) + + (let* ((major (window-with-parameter 'window-side side nil t)) + ;; `major' is the major window on SIDE, `windows' the list of + ;; life windows on SIDE. + (windows + (when major + (let (windows) + (walk-window-tree + (lambda (window) + (when (eq (window-parameter window 'window-side) side) + (setq windows (cons window windows))))) + (nreverse windows)))) + (slots (when major (max 1 (window-child-count major)))) + (max-slots + (nth (cond + ((eq side 'left) 0) + ((eq side 'top) 1) + ((eq side 'right) 2) + ((eq side 'bottom) 3)) + window-sides-slots)) + (selected-window (selected-window)) + window this-window this-slot prev-window next-window + best-window best-slot abs-slot new-window) + + (cond + ((and (numberp max-slots) (<= max-slots 0)) + ;; No side-slots available on this side. Don't create an error, + ;; just return nil. + nil) + ((not windows) + ;; No major window exists on this side, make one. + (display-buffer-in-major-side-window buffer side slot alist)) + (t + ;; Scan windows on SIDE. + (catch 'found + (dolist (window windows) + (setq this-slot (window-parameter window 'window-slot)) + (cond + ;; The following should not happen and probably be checked + ;; by window--side-check. + ((not (numberp this-slot))) + ((= this-slot slot) + ;; A window with a matching slot has been found. + (setq this-window window) + (throw 'found t)) + (t + ;; Check if this window has a better slot value wrt the + ;; slot of the window we want. + (setq abs-slot + (if (or (and (> this-slot 0) (> slot 0)) + (and (< this-slot 0) (< slot 0))) + (abs (- slot this-slot)) + (+ (abs slot) (abs this-slot)))) + (unless (and best-slot (<= best-slot abs-slot)) + (setq best-window window) + (setq best-slot abs-slot)) + (cond + ((<= this-slot slot) + (setq prev-window window)) + ((not next-window) + (setq next-window window))))))) + + ;; `this-window' is the first window with the same SLOT. + ;; `prev-window' is the window with the largest slot < SLOT. A new + ;; window will be created after it. + ;; `next-window' is the window with the smallest slot > SLOT. A new + ;; window will be created before it. + ;; `best-window' is the window with the smallest absolute difference + ;; of its slot and SLOT. + + ;; Note: We dedicate the window used softly to its buffer to + ;; avoid that "other" (non-side) buffer display functions steal + ;; it from us. This must eventually become customizable via + ;; ALIST (or, better, avoided in the "other" functions). + (or (and this-window + ;; Reuse `this-window'. + (window--display-buffer buffer this-window 'reuse 'side)) + (and (or (not max-slots) (< slots max-slots)) + (or (and next-window + ;; Make new window before `next-window'. + (let ((next-side + (if (memq side '(left right)) 'above 'left)) + (window-combination-resize 'side)) + (setq window (split-window next-window nil next-side)) + ;; When the new window is deleted, its space + ;; is returned to other side windows. + (set-window-parameter + window 'delete-window 'delete-side-window) + window)) + (and prev-window + ;; Make new window after `prev-window'. + (let ((prev-side + (if (memq side '(left right)) 'below 'right)) + (window-combination-resize 'side)) + (setq window (split-window prev-window nil prev-side)) + ;; When the new window is deleted, its space + ;; is returned to other side windows. + (set-window-parameter + window 'delete-window 'delete-side-window) + window))) + (set-window-parameter window 'window-slot slot) + (window--display-buffer buffer window 'window 'side)) + (and best-window + ;; Reuse `best-window'. + (progn + ;; Give best-window the new slot value. + (set-window-parameter best-window 'window-slot slot) + (window--display-buffer buffer best-window 'reuse 'side))))))))) + (defun window--side-check (&optional frame) - "Check the window-side parameter of all windows on FRAME. -FRAME defaults to the selected frame. If the configuration is -invalid, reset all window-side parameters to nil. - -A valid configuration has to preserve the following invariant: - -- If a window has a non-nil window-side parameter, it must have a - parent window and the parent window's window-side parameter - must be either nil or the same as for window. - -- If windows with non-nil window-side parameters exist, there - must be at most one window of each side and non-side with a - parent whose window-side parameter is nil and there must be no - leaf window whose window-side parameter is nil." - (let (normal none left top right bottom - side parent parent-side) + "Check the side window configuration of FRAME. +FRAME defaults to the selected frame. + +A valid side window configuration preserves the following two +invariants: + +- If there exists a window whose window-side parameter is + non-nil, there must exist at least one live window whose + window-side parameter is nil. + +- If a window W has a non-nil window-side parameter (i) it must + have a parent window and that parent's window-side parameter + must be either nil or the same as for W, and (ii) any child + window of W must have the same window-side parameter as W. + +If the configuration is invalid, reset the window-side parameters +of all windows on FRAME to nil." + (let (left top right bottom none side parent parent-side) (when (or (catch 'reset (walk-window-tree (lambda (window) @@ -478,40 +767,34 @@ ;; A parent whose window-side is non-nil must ;; have a child with the same window-side. (throw 'reset t))) - ;; Now check that there's more than one main window - ;; for any of none, left, top, right and bottom. - ((eq side 'none) - (if none - (throw 'reset t) + ((not side) + (when (window-buffer window) + ;; Record that we have at least one non-side, + ;; live window. (setq none t))) + ((if (memq side '(left top)) + (window-prev-sibling window) + (window-next-sibling window)) + ;; Left and top major side windows must not have a + ;; previous sibling, right and bottom major side + ;; windows must not have a next sibling. + (throw 'reset t)) + ;; Now check that there's no more than one major + ;; window for any of left, top, right and bottom. ((eq side 'left) - (if left - (throw 'reset t) - (setq left t))) + (if left (throw 'reset t) (setq left t))) ((eq side 'top) - (if top - (throw 'reset t) - (setq top t))) + (if top (throw 'reset t) (setq top t))) ((eq side 'right) - (if right - (throw 'reset t) - (setq right t))) + (if right (throw 'reset t) (setq right t))) ((eq side 'bottom) - (if bottom - (throw 'reset t) - (setq bottom t))) - ((window-buffer window) - ;; A leaf window without window-side parameter, - ;; record its existence. - (setq normal t)))) + (if bottom (throw 'reset t) (setq bottom t))) + (t + (throw 'reset t)))) frame t)) - (if none - ;; At least one non-side window exists, so there must - ;; be at least one side-window and no normal window. - (or (not (or left top right bottom)) normal) - ;; No non-side window exists, so there must be no side - ;; window either. - (or left top right bottom))) + ;; If there's a side window, there must be at least one + ;; non-side window. + (and (or left top right bottom) (not none))) (walk-window-tree (lambda (window) (set-window-parameter window 'window-side nil)) @@ -2393,8 +2676,7 @@ (when (window-parameter window 'window-atom) (setq window (window-atom-root window)))) - (let ((parent (window-parent window)) - (frame (window-frame window))) + (let ((frame (window-frame window))) (cond ((frame-root-window-p window) ;; WINDOW's frame can be deleted only if there are other frames @@ -2405,10 +2687,9 @@ (and minibuf (eq frame (window-frame minibuf))))) 'frame)) ((or ignore-window-parameters - (not (eq (window-parameter window 'window-side) 'none)) - (and parent (eq (window-parameter parent 'window-side) 'none))) - ;; WINDOW can be deleted unless it is the main window of its - ;; frame. + (not (eq window (window--major-non-side-window frame)))) + ;; WINDOW can be deleted unless it is the major non-side window of + ;; its frame. t)))) (defun window--in-subtree-p (window root) @@ -2459,13 +2740,13 @@ ((and (window-parameter window 'window-atom) (setq atom-root (window-atom-root window)) (not (eq atom-root window))) - (throw 'done (delete-window atom-root))) - ((and (eq (window-parameter window 'window-side) 'none) - (or (not parent) - (not (eq (window-parameter parent 'window-side) 'none)))) - (error "Attempt to delete last non-side window")) + (if (eq atom-root (frame-root-window frame)) + (error "Root of atomic window is root window of its frame") + (throw 'done (delete-window atom-root)))) ((not parent) - (error "Attempt to delete minibuffer or sole ordinary window"))) + (error "Attempt to delete minibuffer or sole ordinary window")) + ((eq window (window--major-non-side-window frame)) + (error "Attempt to delete last non-side window"))) (let* ((horizontal (window-left-child parent)) (size (window-total-size window horizontal)) @@ -2539,13 +2820,19 @@ ((and (window-parameter window 'window-atom) (setq atom-root (window-atom-root window)) (not (eq atom-root window))) - (throw 'done (delete-other-windows atom-root))) - ((eq window-side 'none) - ;; Set side-main to the major non-side window. - (setq side-main (window-with-parameter 'window-side 'none frame t))) + (if (eq atom-root (frame-root-window frame)) + (error "Root of atomic window is root window of its frame") + (throw 'done (delete-other-windows atom-root)))) ((memq window-side window-sides) - (error "Cannot make side window the only window"))) - ;; If WINDOW is the main non-side window, do nothing. + (error "Cannot make side window the only window")) + ((and (window-minibuffer-p window) + (not (eq window (frame-root-window window)))) + (error "Can't expand minibuffer to full frame"))) + + ;; If WINDOW is the major non-side window, do nothing. + (if (window-with-parameter 'window-side) + (setq side-main (window--major-non-side-window frame)) + (setq side-main (frame-root-window frame))) (unless (eq window side-main) (delete-other-windows-internal window side-main) (run-window-configuration-change-hook frame) @@ -3204,14 +3491,16 @@ ((not side) 'below) ((memq side '(below above right left)) side) (t 'right))) - (horizontal (not (memq side '(nil below above)))) + (horizontal (not (memq side '(below above)))) (frame (window-frame window)) (parent (window-parent window)) (function (window-parameter window 'split-window)) (window-side (window-parameter window 'window-side)) - ;; Rebind `window-combination-limit' since in some cases we may - ;; have to override its value. + ;; Rebind `window-combination-limit' and + ;; `window-combination-resize' since in some cases we may have + ;; to override their value. (window-combination-limit window-combination-limit) + (window-combination-resize window-combination-resize) atom-root) (window--check frame) @@ -3229,20 +3518,32 @@ ((and (window-parameter window 'window-atom) (setq atom-root (window-atom-root window)) (not (eq atom-root window))) - (throw 'done (split-window atom-root size side)))) - - (when (and window-side - (or (not parent) - (not (window-parameter parent 'window-side)))) - ;; WINDOW is a side root window. To make sure that a new parent - ;; window gets created set `window-combination-limit' to t. - (setq window-combination-limit t)) - - (when (and window-combination-resize size (> size 0)) - ;; If `window-combination-resize' is non-nil and SIZE is a - ;; non-negative integer, we cannot reasonably resize other - ;; windows. Rather bind `window-combination-limit' to t to make - ;; sure that subsequent window deletions are handled correctly. + (throw 'done (split-window atom-root size side))) + ;; If WINDOW is a side window or its first or last child is a + ;; side window, throw an error unless `window-combination-resize' + ;; equals 'side. + ((and (not (eq window-combination-resize 'side)) + (or (window-parameter window 'window-side) + (and (window-child window) + (or (window-parameter + (window-child window) 'window-side) + (window-parameter + (window-last-child window) 'window-side))))) + (error "Cannot split side window or parent of side window")) + ;; If `window-combination-resize' is 'side and window has a side + ;; window sibling, bind `window-combination-limit' to t. + ((and (not (eq window-combination-resize 'side)) + (or (and (window-prev-sibling window) + (window-parameter + (window-prev-sibling window) 'window-side)) + (and (window-next-sibling window) + (window-parameter + (window-next-sibling window) 'window-side)))) + (setq window-combination-limit t))) + + ;; If `window-combination-resize' is t and SIZE is non-negative, + ;; bind `window-combination-limit' to t. + (when (and (eq window-combination-resize t) size (> size 0)) (setq window-combination-limit t)) (let* ((parent-size @@ -3252,7 +3553,10 @@ ;; `resize' non-nil means we are supposed to resize other ;; windows in WINDOW's combination. (resize - (and window-combination-resize (not window-combination-limit) + (and window-combination-resize + (or (window-parameter window 'window-side) + (not (eq window-combination-resize 'side))) + (not window-combination-limit) ;; Resize makes sense in iso-combinations only. (window-combined-p window horizontal))) ;; `old-size' is the current size of WINDOW. @@ -3363,10 +3667,21 @@ new-normal))) (let* ((new (split-window-internal window new-size side new-normal))) - ;; Inherit window-side parameters, if any. - (when (and window-side new-parent) - (set-window-parameter (window-parent new) 'window-side window-side) - (set-window-parameter new 'window-side window-side)) + ;; Assign window-side parameters, if any. + (when (eq window-combination-resize 'side) + (let ((window-side + (cond + (window-side window-side) + ((eq side 'above) 'top) + ((eq side 'below) 'bottom) + (t side)))) + ;; We made a new side window. + (set-window-parameter new 'window-side window-side) + (when (and new-parent (window-parameter window 'window-side)) + ;; We've been splitting a side root window. Give the + ;; new parent the same window-side parameter. + (set-window-parameter + (window-parent new) 'window-side window-side)))) (run-window-configuration-change-hook frame) (window--check frame) @@ -4621,9 +4936,9 @@ `window-dedicated-p' to DEDICATED if non-nil. Return WINDOW if BUFFER and WINDOW are live." (when (and (buffer-live-p buffer) (window-live-p window)) + (display-buffer-record-window type window buffer) (unless (eq buffer (window-buffer window)) (set-window-dedicated-p window nil) - (display-buffer-record-window type window buffer) (set-window-buffer window buffer) (when dedicated (set-window-dedicated-p window dedicated)) ------------------------------------------------------------ revno: 109745 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-08-22 10:42:34 +0200 message: Rename window--size-ignore to window--size-ignore-p. * window.el (window--size-ignore): Rename to window--size-ignore-p. Update callers. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 08:30:54 +0000 +++ lisp/ChangeLog 2012-08-22 08:42:34 +0000 @@ -5,6 +5,8 @@ should run on the minibuffer window. (window-at-side-list): Don't operate on minibuffer window. (window-in-direction): Simplify and rewrite doc-string. + (window--size-ignore): Rename to window--size-ignore-p. Update + callers. 2012-08-22 Christopher Schmidt === modified file 'lisp/window.el' --- lisp/window.el 2012-08-22 08:30:54 +0000 +++ lisp/window.el 2012-08-22 08:42:34 +0000 @@ -535,7 +535,7 @@ window).") (make-variable-buffer-local 'window-size-fixed) -(defun window--size-ignore (window ignore) +(defun window--size-ignore-p (window ignore) "Return non-nil if IGNORE says to ignore size restrictions for WINDOW." (if (window-valid-p ignore) (eq window ignore) ignore)) @@ -578,7 +578,7 @@ value) (with-current-buffer (window-buffer window) (cond - ((and (not (window--size-ignore window ignore)) + ((and (not (window--size-ignore-p window ignore)) (window-size-fixed-p window horizontal)) ;; The minimum size of a fixed size window is its size. (window-total-size window horizontal)) @@ -607,7 +607,7 @@ (ceiling (or (frame-parameter frame 'scroll-bar-width) 14) (frame-char-width))) (t 0))) - (if (and (not (window--size-ignore window ignore)) + (if (and (not (window--size-ignore-p window ignore)) (numberp window-min-width)) window-min-width 0)))) @@ -617,7 +617,7 @@ (max (+ window-safe-min-height (if header-line-format 1 0) (if mode-line-format 1 0)) - (if (and (not (window--size-ignore window ignore)) + (if (and (not (window--size-ignore-p window ignore)) (numberp window-min-height)) window-min-height 0)))))))) @@ -656,7 +656,7 @@ (max (- (window-min-size window horizontal ignore) (window-total-size window horizontal)) delta)) - ((window--size-ignore window ignore) + ((window--size-ignore-p window ignore) delta) ((> delta 0) (if (window-size-fixed-p window horizontal) @@ -738,7 +738,7 @@ ((eq sub window) (setq skip (eq trail 'before))) (skip) - ((and (not (window--size-ignore window ignore)) + ((and (not (window--size-ignore-p window ignore)) (window-size-fixed-p sub horizontal))) (t ;; We found a non-fixed-size child window. @@ -828,7 +828,7 @@ ;; child window is fixed-size. (while sub (when (and (not (eq sub window)) - (not (window--size-ignore sub ignore)) + (not (window--size-ignore-p sub ignore)) (window-size-fixed-p sub horizontal)) (throw 'fixed delta)) (setq sub (window-right sub)))) @@ -868,7 +868,7 @@ WINDOW itself (and its child windows) can be enlarged; check only whether other windows can be shrunk appropriately." (setq window (window-normalize-window window)) - (if (and (not (window--size-ignore window ignore)) + (if (and (not (window--size-ignore-p window ignore)) (not nodown) (window-size-fixed-p window horizontal)) ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed ;; size. @@ -1871,7 +1871,7 @@ ;; Make sure this sibling is left alone when ;; resizing its siblings. (set-window-new-normal sub 'ignore)) - ((or (window--size-ignore sub ignore) + ((or (window--size-ignore-p sub ignore) (not (window-size-fixed-p sub horizontal))) ;; Set this-delta to t to signal that we found a sibling ;; of WINDOW whose size is not fixed. ------------------------------------------------------------ revno: 109744 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-08-22 10:30:54 +0200 message: Let walk-window-tree and window-with-parameter operate on minibuffer windows too. * window.el (walk-window-tree, window-with-parameter): New optional argument MINIBUF to control whether these functions should run on the minibuffer window. (window-at-side-list): Don't operate on minibuffer window. (window-in-direction): Simplify and rewrite doc-string. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 07:02:15 +0000 +++ lisp/ChangeLog 2012-08-22 08:30:54 +0000 @@ -1,3 +1,11 @@ +2012-08-22 Martin Rudalics + + * window.el (walk-window-tree, window-with-parameter): New + optional argument MINIBUF to control whether these functions + should run on the minibuffer window. + (window-at-side-list): Don't operate on minibuffer window. + (window-in-direction): Simplify and rewrite doc-string. + 2012-08-22 Christopher Schmidt * help-fns.el (help-fns--key-bindings): === modified file 'lisp/window.el' --- lisp/window.el 2012-08-21 09:27:07 +0000 +++ lisp/window.el 2012-08-22 08:30:54 +0000 @@ -271,19 +271,32 @@ (setq walk-window-tree-window (window-right walk-window-tree-window)))))) -(defun walk-window-tree (fun &optional frame any) +(defun walk-window-tree (fun &optional frame any minibuf) "Run function FUN on each live window of FRAME. FUN must be a function with one argument - a window. FRAME must be a live frame and defaults to the selected one. ANY, if -non-nil means to run FUN on all live and internal windows of +non-nil, means to run FUN on all live and internal windows of FRAME. +Optional argument MINIBUF t means run FUN on FRAME's minibuffer +window even if it isn't active. MINIBUF nil or omitted means run +FUN on FRAME's minibuffer window only if it's active. In both +cases the minibuffer window must be part of FRAME. MINIBUF +neither nil nor t means never run FUN on the minibuffer window. + This function performs a pre-order, depth-first traversal of the window tree. If FUN changes the window tree, the result is unpredictable." - (let ((walk-window-tree-frame (window-normalize-frame frame))) - (walk-window-tree-1 - fun (frame-root-window walk-window-tree-frame) any))) + (setq frame (window-normalize-frame frame)) + (walk-window-tree-1 fun (frame-root-window frame) any) + (when (memq minibuf '(nil t)) + ;; Run FUN on FRAME's minibuffer window if requested. + (let ((minibuffer-window (minibuffer-window frame))) + (when (and (window-live-p minibuffer-window) + (eq (window-frame minibuffer-window) frame) + (or (eq minibuf t) + (minibuffer-window-active-p minibuffer-window))) + (funcall fun minibuffer-window))))) (defun walk-window-subtree (fun &optional window any) "Run function FUN on the subtree of windows rooted at WINDOW. @@ -299,13 +312,19 @@ (setq window (window-normalize-window window)) (walk-window-tree-1 fun window any t)) -(defun window-with-parameter (parameter &optional value frame any) +(defun window-with-parameter (parameter &optional value frame any minibuf) "Return first window on FRAME with PARAMETER non-nil. FRAME defaults to the selected frame. Optional argument VALUE non-nil means only return a window whose window-parameter value for PARAMETER equals VALUE (comparison is done with `equal'). Optional argument ANY non-nil means consider internal windows -too." +too. + +Optional argument MINIBUF t means consider FRAME's minibuffer +window even if it isn't active. MINIBUF nil or omitted means +consider FRAME's minibuffer window only if it's active. In both +cases the minibuffer window must be part of FRAME. MINIBUF +neither nil nor t means never consider the minibuffer window." (let (this-value) (catch 'found (walk-window-tree @@ -313,7 +332,7 @@ (when (and (setq this-value (window-parameter window parameter)) (or (not value) (equal value this-value))) (throw 'found window))) - frame any)))) + frame any minibuf)))) ;;; Atomic windows. (defun window-atom-root (&optional window) @@ -1088,7 +1107,7 @@ (lambda (window) (when (window-at-side-p window side) (setq windows (cons window windows)))) - frame) + frame nil 'nomini) (nreverse windows))) (defun window--in-direction-2 (window posn &optional horizontal) @@ -1103,12 +1122,25 @@ (- left posn) (- posn left (window-total-width window)))))) +;; Predecessors to the below have been devised by Julian Assange in +;; change-windows-intuitively.el and Hovav Shacham in windmove.el. +;; Neither of these allow to selectively ignore specific windows +;; (windows whose `no-other-window' parameter is non-nil) as targets of +;; the movement. (defun window-in-direction (direction &optional window ignore) "Return window in DIRECTION as seen from WINDOW. +More precisely, return the nearest window in direction DIRECTION +as seen from the position of `window-point' in window WINDOW. DIRECTION must be one of `above', `below', `left' or `right'. WINDOW must be a live window and defaults to the selected one. -IGNORE non-nil means a window can be returned even if its -`no-other-window' parameter is non-nil." + +Do not return a window whose `no-other-window' parameter is +non-nil. If the nearest window's `no-other-window' parameter is +non-nil, try to find another window in the indicated direction. +If, however, the optional argument IGNORE is non-nil, return that +window even if its `no-other-window' parameter is non-nil. + +Return nil if no suitable window can be found." (setq window (window-normalize-window window t)) (unless (memq direction '(above below left right)) (error "Wrong direction %s" direction)) @@ -1195,7 +1227,7 @@ (setq best-edge-2 w-top) (setq best-diff-2 best-diff-2-new) (setq best-2 w))))))) - (window-frame window)) + frame) (or best best-2))) (defun get-window-with-predicate (predicate &optional minibuf all-frames default) ------------------------------------------------------------ revno: 109743 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-08-22 00:20:42 -0700 message: * fontset.c (FONTSET_ADD): Return void, not Lisp_Object. Otherwise, the compiler complains about (A?B:C) where B is void and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12. (fontset_add): Return void, for FONTSET_ADD. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-21 23:39:56 +0000 +++ src/ChangeLog 2012-08-22 07:20:42 +0000 @@ -1,3 +1,10 @@ +2012-08-22 Paul Eggert + + * fontset.c (FONTSET_ADD): Return void, not Lisp_Object. + Otherwise, the compiler complains about (A?B:C) where B is void + and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12. + (fontset_add): Return void, for FONTSET_ADD. + 2012-08-21 Paul Eggert * alloc.c: Use bool for booleans. === modified file 'src/fontset.c' --- src/fontset.c 2012-08-21 23:09:01 +0000 +++ src/fontset.c 2012-08-22 07:20:42 +0000 @@ -185,8 +185,7 @@ /* Prototype declarations for static functions. */ -static Lisp_Object fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object); +static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, int, int); static void reorder_font_vector (Lisp_Object, struct font *); @@ -356,11 +355,12 @@ ? (NILP (range) \ ? (set_fontset_fallback \ (fontset, Fmake_vector (make_number (1), (elt)))) \ - : Fset_char_table_range ((fontset), (range), \ - Fmake_vector (make_number (1), (elt)))) \ + : ((void) \ + Fset_char_table_range (fontset, range, \ + Fmake_vector (make_number (1), elt)))) \ : fontset_add ((fontset), (range), (elt), (add))) -static Lisp_Object +static void fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add) { Lisp_Object args[2]; @@ -389,7 +389,6 @@ set_fontset_fallback (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args)); } - return Qnil; } static int ------------------------------------------------------------ revno: 109742 fixes bug: http://debbugs.gnu.org/12174 author: Christopher Schmidt committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-08-22 00:02:15 -0700 message: * help-fns.el (help-fns--key-bindings): Abbreviate non-symbol remap targets. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 06:59:38 +0000 +++ lisp/ChangeLog 2012-08-22 07:02:15 +0000 @@ -1,3 +1,8 @@ +2012-08-22 Christopher Schmidt + + * help-fns.el (help-fns--key-bindings): + Abbreviate non-symbol remap targets. (Bug#12174) + 2012-08-22 Martin Rudalics * dired.el (dired-mark-remembered): Don't clobber point. === modified file 'lisp/help-fns.el' --- lisp/help-fns.el 2012-08-06 21:05:48 +0000 +++ lisp/help-fns.el 2012-08-22 07:02:15 +0000 @@ -397,9 +397,11 @@ (if (member (event-modifiers (aref key 0)) '(nil (shift))) (push key non-modified-keys))) (when remapped - (princ "Its keys are remapped to `") - (princ (symbol-name remapped)) - (princ "'.\n")) + (princ "Its keys are remapped to ") + (princ (if (symbolp remapped) + (concat "`" (symbol-name remapped) "'") + "an anonymous command")) + (princ ".\n")) (when keys (princ (if remapped ------------------------------------------------------------ revno: 109741 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-08-22 08:59:38 +0200 message: In dired-mark-remembered don't clobber point (Bug#11795). * dired.el (dired-mark-remembered): Don't clobber point. (Bug#11795) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-22 06:47:00 +0000 +++ lisp/ChangeLog 2012-08-22 06:59:38 +0000 @@ -1,3 +1,8 @@ +2012-08-22 Martin Rudalics + + * dired.el (dired-mark-remembered): Don't clobber point. + (Bug#11795) + 2012-08-22 Glenn Morris * progmodes/bug-reference.el (bug-reference): New custom group. === modified file 'lisp/dired.el' --- lisp/dired.el 2012-08-15 16:29:11 +0000 +++ lisp/dired.el 2012-08-22 06:59:38 +0000 @@ -1331,16 +1331,16 @@ "Mark all files remembered in ALIST. Each element of ALIST looks like (FILE . MARKERCHAR)." (let (elt fil chr) - (while alist - (setq elt (car alist) - alist (cdr alist) - fil (car elt) - chr (cdr elt)) - (if (dired-goto-file fil) - (save-excursion - (beginning-of-line) - (delete-char 1) - (insert chr)))))) + (save-excursion + (while alist + (setq elt (car alist) + alist (cdr alist) + fil (car elt) + chr (cdr elt)) + (when (dired-goto-file fil) + (beginning-of-line) + (delete-char 1) + (insert chr)))))) (defun dired-remember-hidden () "Return a list of names of subdirs currently hidden."