Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 104534. ------------------------------------------------------------ revno: 104534 author: Ivan Kanis committer: Glenn Morris branch nick: trunk timestamp: Tue 2011-06-07 23:57:38 -0700 message: * lisp/calendar/appt.el (appt-check): Move some initializations into the let. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-06-08 05:40:45 +0000 +++ lisp/ChangeLog 2011-06-08 06:57:38 +0000 @@ -1,3 +1,7 @@ +2011-06-08 Ivan Kanis + + * calendar/appt.el (appt-check): Move some initializations into the let. + 2011-06-08 Martin Rudalics * window.el (window-height): Defalias to window-total-height. === modified file 'lisp/calendar/appt.el' --- lisp/calendar/appt.el 2011-05-17 04:05:39 +0000 +++ lisp/calendar/appt.el 2011-06-08 06:57:38 +0000 @@ -285,11 +285,11 @@ (let* ((min-to-app -1) (prev-appt-mode-string appt-mode-string) (prev-appt-display-count appt-display-count) - now now-mins appt-mins appt-warn-time) + ;; Convert current time to minutes after midnight (12.01am = 1). + (now (decode-time)) + (now-mins (+ (* 60 (nth 2 now)) (nth 1 now))) + appt-mins appt-warn-time) (save-excursion ; FIXME ? - ;; Convert current time to minutes after midnight (12.01am = 1). - (setq now (decode-time) - now-mins (+ (* 60 (nth 2 now)) (nth 1 now))) ;; At first check in any day, update appointments to today's list. (if (or force ; eg initialize, diary save (null appt-prev-comp-time) ; first check ------------------------------------------------------------ revno: 104533 committer: Glenn Morris branch nick: trunk timestamp: Tue 2011-06-07 23:53:00 -0700 message: ChangeLog fixes. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2011-06-07 04:16:37 +0000 +++ etc/ChangeLog 2011-06-08 06:53:00 +0000 @@ -100,19 +100,24 @@ 2011-02-17 Ken Manheimer - * etc/images/icons/allout-widgets/dark-bg, - * etc/images/icons/allout-widgets/light-bg, - * encrypted-locked.{xpm,png}, unlocked-encrypted.{xpm,png}: + * images/icons/allout-widgets/dark-bg/encrypted-locked.png: + * images/icons/allout-widgets/dark-bg/encrypted-locked.xpm: + * images/icons/allout-widgets/dark-bg/unlocked-encrypted.png: + * images/icons/allout-widgets/dark-bg/unlocked-encrypted.xpm: + * images/icons/allout-widgets/light-bg/encrypted-locked.png: + * images/icons/allout-widgets/light-bg/encrypted-locked.xpm: + * images/icons/allout-widgets/light-bg/unlocked-encrypted.png: + * images/icons/allout-widgets/light-bg/unlocked-encrypted.xpm: Reorganize icon directories and files to reconcile against windows short-filename clashes. 2011-02-16 Ken Manheimer - * etc/images/icons/allout-widgets-dark-bg, - * etc/images/icons/allout-widgets-light-bg: Icons for new + * images/icons/allout-widgets-dark-bg, + * images/icons/allout-widgets-light-bg: Icons for new allout-widgets.el. - * etc/images/icons/README: Include coypright and GPL 3 license for + * images/icons/README: Include coypright and GPL 3 license for new icons. 2011-02-16 Michael Albinus ------------------------------------------------------------ revno: 104532 committer: Glenn Morris branch nick: trunk timestamp: Tue 2011-06-07 23:51:26 -0700 message: Move ChangeLog entry to the right file. diff: === modified file 'ChangeLog' --- ChangeLog 2011-06-07 04:16:37 +0000 +++ ChangeLog 2011-06-08 06:51:26 +0000 @@ -26,7 +26,7 @@ 2011-05-27 Paul Eggert - * doc/misc/texinfo.tex, lib/getopt.c, lib/intprops.h: Merge from gnulib. + * lib/getopt.c, lib/intprops.h: Merge from gnulib. 2011-05-24 Glenn Morris === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2011-05-31 22:08:51 +0000 +++ doc/misc/ChangeLog 2011-06-08 06:51:26 +0000 @@ -4,6 +4,10 @@ `gnus-registry-article-marks-to-{chars,names}' instead of `gnus-registry-user-format-function-{M,M2}'. +2011-05-27 Paul Eggert + + * texinfo.tex: Merge from gnulib. + 2011-05-18 Teodor Zlatanov * gnus.texi (Gnus Registry Setup): Rename from "Setup". ------------------------------------------------------------ revno: 104531 committer: martin rudalics branch nick: trunk timestamp: Wed 2011-06-08 07:40:45 +0200 message: window-height, window-width, and window-full-width-p are now in window.el. * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p): Remove. * window.el (window-height): Defalias to window-total-height. (window-width): Defalias to window-body-width. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-06-07 18:32:12 +0000 +++ lisp/ChangeLog 2011-06-08 05:40:45 +0000 @@ -1,3 +1,8 @@ +2011-06-08 Martin Rudalics + + * window.el (window-height): Defalias to window-total-height. + (window-width): Defalias to window-body-width. + 2011-06-07 Chong Yidong * image-mode.el (image-toggle-animation): New command. === modified file 'lisp/window.el' --- lisp/window.el 2011-06-07 13:50:31 +0000 +++ lisp/window.el 2011-06-08 05:40:45 +0000 @@ -900,6 +900,9 @@ `line-spacing' when calculating the number of lines in WINDOW." (window-total-size window)) +;; Eventually we should make `window-height' obsolete. +(defalias 'window-height 'window-total-height) + ;; See discussion in bug#4543. (defsubst window-full-height-p (&optional window) "Return t if WINDOW is as high as the containing frame. @@ -951,6 +954,9 @@ display margins either." (window-body-size window t)) +;; Eventually we should make `window-height' obsolete. +(defalias 'window-width 'window-body-width) + (defun one-window-p (&optional nomini all-frames) "Return non-nil if the selected window is the only window. Optional arg NOMINI non-nil means don't count the minibuffer === modified file 'src/ChangeLog' --- src/ChangeLog 2011-06-07 13:23:08 +0000 +++ src/ChangeLog 2011-06-08 05:40:45 +0000 @@ -1,3 +1,8 @@ +2011-06-08 Martin Rudalics + + * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p): + Remove. + 2011-06-07 Martin Rudalics * window.c (Fwindow_total_size, Fwindow_left_column) === modified file 'src/window.c' --- src/window.c 2011-06-07 13:23:08 +0000 +++ src/window.c 2011-06-08 05:40:45 +0000 @@ -800,39 +800,6 @@ return make_number (window_body_cols (w)); } -DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, - doc: /* Return the number of lines in WINDOW. -WINDOW defaults to the selected window. - -The return value includes WINDOW's mode line and header line, if any. - -Note: The function does not take into account the value of `line-spacing' -when calculating the number of lines in WINDOW. */) - (Lisp_Object window) -{ - return decode_any_window (window)->total_lines; -} - -DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0, - doc: /* Return the number of display columns in WINDOW. -WINDOW defaults to the selected window. - -Note: The return value is the number of columns available for text in -WINDOW. If you want to find out how many columns WINDOW takes up, use -(let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) - (Lisp_Object window) -{ - return make_number (window_body_cols (decode_any_window (window))); -} - -DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0, - doc: /* Return t if WINDOW is as wide as its frame. -WINDOW defaults to the selected window. */) - (Lisp_Object window) -{ - return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil; -} - DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, doc: /* Return the number of columns by which WINDOW is scrolled from left margin. WINDOW defaults to the selected window. */) @@ -7325,9 +7292,6 @@ defsubr (&Swindow_left_column); defsubr (&Swindow_total_size); defsubr (&Swindow_body_size); - defsubr (&Swindow_height); - defsubr (&Swindow_width); - defsubr (&Swindow_full_width_p); defsubr (&Swindow_hscroll); defsubr (&Sset_window_hscroll); defsubr (&Swindow_redisplay_end_trigger); ------------------------------------------------------------ revno: 104530 committer: Chong Yidong branch nick: trunk timestamp: Tue 2011-06-07 14:32:12 -0400 message: Some changes and re-organization for animated gif support. * lisp/image.el (image-animate-max-time): Moved to image-mode.el. (create-animated-image): Remove unnecessary function. (image-animate): Rename from image-animate-start. New arg. (image-animate-stop): Removed; just use image-animate-timer. (image-animate-timer): Use car-safe. (image-animate-timeout): Rename argument. * lisp/image-mode.el (image-toggle-animation): New command. (image-mode-map): Bind it to RET. (image-mode): Update message. (image-toggle-display-image): Avoid a spurious cache flush. (image-transform-rotation): Doc fix. (image-transform-properties): Return quickly in the normal case. (image-animate-loop): Rename from image-animate-max-time. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-06-07 04:16:37 +0000 +++ etc/NEWS 2011-06-07 18:32:12 +0000 @@ -693,6 +693,14 @@ *** An API for manipulating SQL product definitions has been added. +** Image mode + +*** RET (`image-toggle-animation') toggles animation, if the displayed +image can be animated. + +*** Option `image-animate-loop', if non-nil, loops the animation. +If nil, `image-toggle-animation' plays the animation once. + ** sregex.el is now obsolete, since rx.el is a strict superset. ** s-region.el and pc-select are now declared obsolete, @@ -980,12 +988,14 @@ ** Image API -*** When the image type is one of listed in `image-animated-types' -and the number of sub-images in the image is more than one, then the -new function `create-animated-image' creates an animated image where -sub-images are displayed successively with the duration defined by -`image-animate-max-time' and the delay between sub-images defined -by the Graphic Control Extension of the image. +*** Animated images support (currently animated gifs only). + +**** `image-animated-p' returns non-nil if an image can be animated. + +**** `image-animate' animates a supplied image spec. + +**** `image-animate-timer' returns the timer object for an image that +is being animated. *** `image-extension-data' is renamed to `image-metadata'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-06-07 13:50:31 +0000 +++ lisp/ChangeLog 2011-06-07 18:32:12 +0000 @@ -1,3 +1,20 @@ +2011-06-07 Chong Yidong + + * image-mode.el (image-toggle-animation): New command. + (image-mode-map): Bind it to RET. + (image-mode): Update message. + (image-toggle-display-image): Avoid a spurious cache flush. + (image-transform-rotation): Doc fix. + (image-transform-properties): Return quickly in the normal case. + (image-animate-loop): Rename from image-animate-max-time. + + * image.el (image-animate-max-time): Moved to image-mode.el. + (create-animated-image): Remove unnecessary function. + (image-animate): Rename from image-animate-start. New arg. + (image-animate-stop): Removed; just use image-animate-timer. + (image-animate-timer): Use car-safe. + (image-animate-timeout): Rename argument. + 2011-06-07 Martin Rudalics * window.el (get-lru-window, get-largest-window): Move here from === modified file 'lisp/image-mode.el' --- lisp/image-mode.el 2011-05-29 21:35:35 +0000 +++ lisp/image-mode.el 2011-06-07 18:32:12 +0000 @@ -308,6 +308,7 @@ (define-key map "\C-c\C-c" 'image-toggle-display) (define-key map (kbd "SPC") 'image-scroll-up) (define-key map (kbd "DEL") 'image-scroll-down) + (define-key map (kbd "RET") 'image-toggle-animation) (define-key map [remap forward-char] 'image-forward-hscroll) (define-key map [remap backward-char] 'image-backward-hscroll) (define-key map [remap right-char] 'image-forward-hscroll) @@ -373,16 +374,26 @@ (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) (add-hook 'after-revert-hook 'image-after-revert-hook nil t) (run-mode-hooks 'image-mode-hook) - (message "%s" (concat - (substitute-command-keys - "Type \\[image-toggle-display] to view the image as ") - (if (image-get-display-property) - "text" "an image") "."))) + (let ((image (image-get-display-property)) + (msg1 (substitute-command-keys + "Type \\[image-toggle-display] to view the image as "))) + (cond + ((null image) + (message "%s" (concat msg1 "an image."))) + ((image-animated-p image) + (message "%s" + (concat msg1 "text, or " + (substitute-command-keys + "\\[image-toggle-animation] to animate.")))) + (t + (message "%s" (concat msg1 "text.")))))) + (error (image-mode-as-text) (funcall (if (called-interactively-p 'any) 'error 'message) "Cannot display image: %s" (cdr err))))) + ;;;###autoload (define-minor-mode image-minor-mode "Toggle Image minor mode. @@ -484,25 +495,20 @@ (buffer-substring-no-properties (point-min) (point-max))) filename)) (type (image-type file-or-data nil data-p)) - ;; Don't use create-animated-image here; that would start the - ;; timer, which works by altering the spec destructively. - ;; But we still need to append the transformation properties, - ;; which would make a new list. (image (create-image file-or-data type data-p)) (inhibit-read-only t) (buffer-undo-list t) (modified (buffer-modified-p)) props) + ;; Discard any stale image data before looking it up again. + (image-flush image) (setq image (append image (image-transform-properties image))) (setq props `(display ,image intangible ,image rear-nonsticky (display intangible) read-only t front-sticky (read-only))) - (image-flush image) - ;; Begin the animation, if any. - (image-animate-start image) (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file (add-text-properties (point-min) (point-max) props) @@ -545,6 +551,37 @@ (image-toggle-display-image))) +;;; Animated images + +(defcustom image-animate-loop nil + "Whether to play animated images on a loop in Image mode." + :type 'boolean + :version "24.1" + :group 'image) + +(defun image-toggle-animation () + "Start or stop animating the current image." + (interactive) + (let ((image (image-get-display-property)) + animation) + (cond + ((null image) + (error "No image is present")) + ((null (setq animation (image-animated-p image))) + (message "No image animation.")) + (t + (let ((timer (image-animate-timer image))) + (if timer + (cancel-timer timer) + (let ((index (plist-get (cdr image) :index))) + ;; If we're at the end, restart. + (and index + (>= index (1- (car animation))) + (setq index nil)) + (image-animate image index + (if image-animate-loop t))))))))) + + ;;; Support for bookmark.el (declare-function bookmark-make-record-default "bookmark" (&optional no-file no-context posn)) @@ -589,33 +626,38 @@ - `fit-width', meaning to fit the image to the window width. - A number, which is a scale factor (the default size is 100).") -(defvar image-transform-rotation 0.0) +(defvar image-transform-rotation 0.0 + "Rotation angle for the image in the current Image mode buffer.") -(defun image-transform-properties (display) - "Return rescaling/rotation properties for the Image mode buffer. -These properties are suitable for appending to an image spec; -they are determined by the variables `image-transform-resize' and -`image-transform-rotation'. +(defun image-transform-properties (spec) + "Return rescaling/rotation properties for image SPEC. +These properties are determined by the Image mode variables +`image-transform-resize' and `image-transform-rotation'. The +return value is suitable for appending to an image spec. Recaling and rotation properties only take effect if Emacs is compiled with ImageMagick support." - (let* ((size (image-size display t)) - (height - (cond - ((numberp image-transform-resize) - (unless (= image-transform-resize 100) - (* image-transform-resize (cdr size)))) - ((eq image-transform-resize 'fit-height) - (- (nth 3 (window-inside-pixel-edges)) - (nth 1 (window-inside-pixel-edges)))))) - (width (if (eq image-transform-resize 'fit-width) - (- (nth 2 (window-inside-pixel-edges)) - (nth 0 (window-inside-pixel-edges)))))) - ;;TODO fit-to-* should consider the rotation angle - `(,@(if height (list :height height)) - ,@(if width (list :width width)) - ,@(if (not (equal 0.0 image-transform-rotation)) - (list :rotation image-transform-rotation))))) + (when (or image-transform-resize + (not (equal image-transform-rotation 0.0))) + ;; Note: `image-size' looks up and thus caches the untransformed + ;; image. There's no easy way to prevent that. + (let* ((size (image-size spec t)) + (height + (cond + ((numberp image-transform-resize) + (unless (= image-transform-resize 100) + (* image-transform-resize (cdr size)))) + ((eq image-transform-resize 'fit-height) + (- (nth 3 (window-inside-pixel-edges)) + (nth 1 (window-inside-pixel-edges)))))) + (width (if (eq image-transform-resize 'fit-width) + (- (nth 2 (window-inside-pixel-edges)) + (nth 0 (window-inside-pixel-edges)))))) + ;;TODO fit-to-* should consider the rotation angle + `(,@(if height (list :height height)) + ,@(if width (list :width width)) + ,@(if (not (equal 0.0 image-transform-rotation)) + (list :rotation image-transform-rotation)))))) (defun image-transform-set-scale (scale) "Prompt for a number, and resize the current image by that amount. === modified file 'lisp/image.el' --- lisp/image.el 2011-05-29 21:35:35 +0000 +++ lisp/image.el 2011-06-07 18:32:12 +0000 @@ -590,43 +590,45 @@ ;;; Animated image API -(defcustom image-animate-max-time nil - "Time in seconds to animate images. -If the value is nil, play animations once. -If the value is t, loop forever." - :type '(choice (const :tag "Play once" nil) - (const :tag "Loop forever" t) - integer) - :version "24.1" - :group 'image) - (defconst image-animated-types '(gif) "List of supported animated image types.") -;;;###autoload -(defun create-animated-image (file-or-data &optional type data-p &rest props) - "Create an animated image, and begin animating it. -FILE-OR-DATA is an image file name or image data. -Optional TYPE is a symbol describing the image type. If TYPE is omitted -or nil, try to determine the image type from its first few bytes -of image data. If that doesn't work, and FILE-OR-DATA is a file name, -use its file extension as image type. -Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data. -Optional PROPS are additional image attributes to assign to the image, -like, e.g. `:mask MASK'. -Value is the image created, or nil if images of type TYPE are not supported. - -Images should not be larger than specified by `max-image-size'." - (setq type (image-type file-or-data type data-p)) - (when (image-type-available-p type) - (let* ((animate (memq type image-animated-types)) - (image - (append (list 'image :type type (if data-p :data :file) file-or-data) - (if animate '(:index 0)) - props))) - (if animate - (image-animate-start image)) - image))) +(defun image-animated-p (image) + "Return non-nil if image can be animated. +Actually, the return value is a cons (NIMAGES . DELAY), where +NIMAGES is the number of sub-images in the animated image and +DELAY is the delay in 100ths of a second until the next sub-image +shall be displayed." + (cond + ((eq (plist-get (cdr image) :type) 'gif) + (let* ((metadata (image-metadata image)) + (images (plist-get metadata 'count)) + (extdata (plist-get metadata 'extension-data)) + (anim (plist-get extdata #xF9)) + (tmo (and (integerp images) (> images 1) + (stringp anim) (>= (length anim) 4) + (+ (aref anim 1) (* (aref anim 2) 256))))) + (when tmo + (if (eq tmo 0) (setq tmo 10)) + (cons images tmo)))))) + +(defun image-animate (image &optional index limit) + "Start animating IMAGE. +Animation occurs by destructively altering the IMAGE spec list. + +With optional INDEX, begin animating from that animation frame. +LIMIT specifies how long to animate the image. If omitted or +nil, play the animation until the end. If t, loop forever. If a +number, play until that number of seconds has elapsed." + (let ((anim (image-animated-p image)) + delay timer) + (when anim + (if (setq timer (image-animate-timer image)) + (cancel-timer timer)) + (setq delay (max (* (cdr anim) 0.01) 0.025)) + (run-with-timer 0.2 nil #'image-animate-timeout + image (or index 0) (car anim) + delay 0 limit)))) (defun image-animate-timer (image) "Return the animation timer for image IMAGE." @@ -635,78 +637,37 @@ (while tail (setq timer (car tail) tail (cdr tail)) - (if (and (eq (aref timer 5) #'image-animate-timeout) - (consp (aref timer 6)) - (eq (car (aref timer 6)) image)) + (if (and (eq (aref timer 5) 'image-animate-timeout) + (eq (car-safe (aref timer 6)) image)) (setq tail nil) (setq timer nil))) timer)) -(defun image-animate-start (image) - "Start animating the image IMAGE. -The variable `image-animate-max-time' determines how long to -animate for." - (let ((anim (image-animated-p image)) - delay ; in seconds - timer) - (when anim - (if (setq timer (image-animate-timer image)) - (cancel-timer timer)) - (setq delay (max (* (cdr anim) 0.01) 0.025)) - (run-with-timer 0.2 nil #'image-animate-timeout - image 0 (car anim) - delay 0 image-animate-max-time)))) - -(defun image-animate-stop (image) - "Stop animation of image." - (let ((timer (image-animate-timer image))) - (when timer - (cancel-timer timer)))) - -(defun image-animate-timeout (image n count delay time-elapsed max) +(defun image-animate-timeout (image n count delay time-elapsed limit) "Display animation frame N of IMAGE. N=0 refers to the initial animation frame. COUNT is the total number of frames in the animation. DELAY is the time between animation frames, in seconds. TIME-ELAPSED is the total time that has elapsed since `image-animate-start' was called. -MAX determines when to stop. If t, loop forever. If nil, stop +LIMIT determines when to stop. If t, loop forever. If nil, stop after displaying the last animation frame. Otherwise, stop - after MAX seconds have elapsed." + after LIMIT seconds have elapsed." (let (done) (plist-put (cdr image) :index n) (force-window-update) (setq n (1+ n)) (if (>= n count) - (if max + (if limit (setq n 0) (setq done t))) (setq time-elapsed (+ delay time-elapsed)) - (if (numberp max) - (setq done (>= time-elapsed max))) + (if (numberp limit) + (setq done (>= time-elapsed limit))) (unless done (run-with-timer delay nil 'image-animate-timeout image n count delay - time-elapsed max)))) - -(defun image-animated-p (image) - "Return non-nil if image is animated. -Actually, return value is a cons (IMAGES . DELAY) where IMAGES -is the number of sub-images in the animated image, and DELAY -is the delay in 100ths of a second until the next sub-image -shall be displayed." - (cond - ((eq (plist-get (cdr image) :type) 'gif) - (let* ((metadata (image-metadata image)) - (images (plist-get metadata 'count)) - (extdata (plist-get metadata 'extension-data)) - (anim (plist-get extdata #xF9)) - (tmo (and (integerp images) (> images 1) - (stringp anim) (>= (length anim) 4) - (+ (aref anim 1) (* (aref anim 2) 256))))) - (when tmo - (if (eq tmo 0) (setq tmo 10)) - (cons images tmo)))))) + time-elapsed limit)))) (defcustom imagemagick-types-inhibit ------------------------------------------------------------ revno: 104529 [merge] committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2011-06-07 16:57:44 +0300 message: Fix the MS-DOS build broken by STRING_BYTES_MAX. msdos/sedlibmk.inp (PTRDIFF_T_SUFFIX): Edit to nothing. diff: === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2011-05-28 10:00:09 +0000 +++ msdos/ChangeLog 2011-06-07 13:55:22 +0000 @@ -1,3 +1,7 @@ +2011-06-07 Eli Zaretskii + + * sedlibmk.inp (PTRDIFF_T_SUFFIX): Edit to nothing. + 2011-05-28 Eli Zaretskii * sed1v2.inp: Edit "make-docfile -d FOO" commands to chdir back to === modified file 'msdos/sedlibmk.inp' --- msdos/sedlibmk.inp 2011-05-28 10:00:09 +0000 +++ msdos/sedlibmk.inp 2011-06-07 13:55:22 +0000 @@ -424,6 +424,7 @@ /^PRAGMA_COLUMNS *=/s/@[^@\n]*@// /^PRAGMA_SYSTEM_HEADER *=/s/@[^@\n]*@/\\\#pragma GCC system_header/ /^PTHREAD_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/ +/^PTRDIFF_T_SUFFIX *=/s/@[^@\n]*@// /^RANLIB *=/s/@[^@\n]*@/ranlib/ /^REPLACE_CALLOC *=/s/@REPLACE_CALLOC@/0/ /^REPLACE_CANONICALIZE_FILE_NAME *=/s/@REPLACE_CANONICALIZE_FILE_NAME@/0/ ------------------------------------------------------------ revno: 104528 committer: martin rudalics branch nick: trunk timestamp: Tue 2011-06-07 15:50:31 +0200 message: Add and rewrite window size functions in window.el. * window.el (window-safe-min-height, window-safe-min-width): New constants. (window-size-ignore, window-min-size, window-min-size-1) (window-sizable, window-sizable-p, window-size-fixed-1) (window-size-fixed-p, window-min-delta-1, window-min-delta) (window-max-delta-1, window-max-delta, window-resizable) (window-resizable-p, window-total-height, window-total-width) (window-body-width): New functions. (window-full-height-p, window-full-width-p): Rewrite using window-total-size. (window-body-height): Rewrite using window-body-size. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-06-07 13:23:08 +0000 +++ lisp/ChangeLog 2011-06-07 13:50:31 +0000 @@ -5,6 +5,16 @@ doc-strings. (get-buffer-window-list): Rewrite using window-list-1. Rephrase doc-string. + (window-safe-min-height, window-safe-min-width): New constants. + (window-size-ignore, window-min-size, window-min-size-1) + (window-sizable, window-sizable-p, window-size-fixed-1) + (window-size-fixed-p, window-min-delta-1, window-min-delta) + (window-max-delta-1, window-max-delta, window-resizable) + (window-resizable-p, window-total-height, window-total-width) + (window-body-width): New functions. + (window-full-height-p, window-full-width-p): Rewrite using + window-total-size. + (window-body-height): Rewrite using window-body-size. 2011-06-06 Martin Rudalics === modified file 'lisp/window.el' --- lisp/window.el 2011-06-07 13:23:08 +0000 +++ lisp/window.el 2011-06-07 13:50:31 +0000 @@ -157,6 +157,14 @@ An application may bind this to a non-nil value around calls to these functions to inhibit processing of window parameters.") +(defconst window-safe-min-height 1 + "The absolut minimum number of lines of a window. +Anything less might crash Emacs.") + +(defconst window-safe-min-width 2 + "The absolut minimum number of columns of a window. +Anything less might crash Emacs.") + (defun window-iso-combination-p (&optional window horizontal) "If WINDOW is a vertical combination return WINDOW's first child. WINDOW can be any window and defaults to the selected one. @@ -491,32 +499,457 @@ window).") (make-variable-buffer-local 'window-size-fixed) -(defun window-body-height (&optional window) - "Return number of lines in WINDOW available for actual buffer text. -WINDOW defaults to the selected window. - -The return value does not include the mode line or the header +(defsubst window-size-ignore (window ignore) + "Return non-nil if IGNORE says to ignore size restrictions for WINDOW." + (if (window-any-p ignore) (eq window ignore) ignore)) + +(defun window-min-size (&optional window horizontal ignore) + "Return the minimum number of lines of WINDOW. +WINDOW can be an arbitrary window and defaults to the selected +one. Optional argument HORIZONTAL non-nil means return the +minimum number of columns of WINDOW. + +Optional argument IGNORE non-nil means ignore any restrictions +imposed by fixed size windows, `window-min-height' or +`window-min-width' settings. IGNORE equal `safe' means live +windows may get as small as `window-safe-min-height' lines and +`window-safe-min-width' columns. IGNORE a window means ignore +restrictions for that window only." + (window-min-size-1 + (normalize-any-window window) horizontal ignore)) + +(defun window-min-size-1 (window horizontal ignore) + "Internal function of `window-min-size'." + (let ((sub (window-child window))) + (if sub + (let ((value 0)) + ;; WINDOW is an internal window. + (if (window-iso-combined-p sub horizontal) + ;; The minimum size of an iso-combination is the sum of + ;; the minimum sizes of its subwindows. + (while sub + (setq value (+ value + (window-min-size-1 sub horizontal ignore))) + (setq sub (window-right sub))) + ;; The minimum size of an ortho-combination is the maximum of + ;; the minimum sizes of its subwindows. + (while sub + (setq value (max value + (window-min-size-1 sub horizontal ignore))) + (setq sub (window-right sub)))) + value) + (with-current-buffer (window-buffer window) + (cond + ((and (not (window-size-ignore window ignore)) + (window-size-fixed-p window horizontal)) + ;; The minimum size of a fixed size window is its size. + (window-total-size window horizontal)) + ((or (eq ignore 'safe) (eq ignore window)) + ;; If IGNORE equals `safe' or WINDOW return the safe values. + (if horizontal window-safe-min-width window-safe-min-height)) + (horizontal + ;; For the minimum width of a window take fringes and + ;; scroll-bars into account. This is questionable and should + ;; be removed as soon as we are able to split (and resize) + ;; windows such that the new (or resized) windows can get a + ;; size less than the user-specified `window-min-height' and + ;; `window-min-width'. + (let ((frame (window-frame window)) + (fringes (window-fringes window)) + (scroll-bars (window-scroll-bars window))) + (max + (+ window-safe-min-width + (ceiling (car fringes) (frame-char-width frame)) + (ceiling (cadr fringes) (frame-char-width frame)) + (cond + ((memq (nth 2 scroll-bars) '(left right)) + (nth 1 scroll-bars)) + ((memq (frame-parameter frame 'vertical-scroll-bars) + '(left right)) + (ceiling (or (frame-parameter frame 'scroll-bar-width) 14) + (frame-char-width))) + (t 0))) + (if (and (not (window-size-ignore window ignore)) + (numberp window-min-width)) + window-min-width + 0)))) + (t + ;; For the minimum height of a window take any mode- or + ;; header-line into account. + (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)) + (numberp window-min-height)) + window-min-height + 0)))))))) + +(defun window-sizable (window delta &optional horizontal ignore) + "Return DELTA if DELTA lines can be added to WINDOW. +Optional argument HORIZONTAL non-nil means return DELTA if DELTA +columns can be added to WINDOW. A return value of zero means +that no lines (or columns) can be added to WINDOW. + +This function looks only at WINDOW and its subwindows. The +function `window-resizable' looks at other windows as well. + +DELTA positive means WINDOW shall be enlarged by DELTA lines or +columns. If WINDOW cannot be enlarged by DELTA lines or columns +return the maximum value in the range 0..DELTA by which WINDOW +can be enlarged. + +DELTA negative means WINDOW shall be shrunk by -DELTA lines or +columns. If WINDOW cannot be shrunk by -DELTA lines or columns, +return the minimum value in the range DELTA..0 by which WINDOW +can be shrunk. + +Optional argument IGNORE non-nil means ignore any restrictions +imposed by fixed size windows, `window-min-height' or +`window-min-width' settings. IGNORE equal `safe' means live +windows may get as small as `window-safe-min-height' lines and +`window-safe-min-width' columns. IGNORE any window means ignore +restrictions for that window only." + (setq window (normalize-any-window window)) + (cond + ((< delta 0) + (max (- (window-min-size window horizontal ignore) + (window-total-size window horizontal)) + delta)) + ((window-size-ignore window ignore) + delta) + ((> delta 0) + (if (window-size-fixed-p window horizontal) + 0 + delta)) + (t 0))) + +(defsubst window-sizable-p (window delta &optional horizontal ignore) + "Return t if WINDOW can be resized by DELTA lines. +For the meaning of the arguments of this function see the +doc-string of `window-sizable'." + (setq window (normalize-any-window window)) + (if (> delta 0) + (>= (window-sizable window delta horizontal ignore) delta) + (<= (window-sizable window delta horizontal ignore) delta))) + +(defun window-size-fixed-1 (window horizontal) + "Internal function for `window-size-fixed-p'." + (let ((sub (window-child window))) + (catch 'fixed + (if sub + ;; WINDOW is an internal window. + (if (window-iso-combined-p sub horizontal) + ;; An iso-combination is fixed size if all its subwindows + ;; are fixed-size. + (progn + (while sub + (unless (window-size-fixed-1 sub horizontal) + ;; We found a non-fixed-size subwindow, so WINDOW's + ;; size is not fixed. + (throw 'fixed nil)) + (setq sub (window-right sub))) + ;; All subwindows are fixed-size, so WINDOW's size is + ;; fixed. + (throw 'fixed t)) + ;; An ortho-combination is fixed-size if at least one of its + ;; subwindows is fixed-size. + (while sub + (when (window-size-fixed-1 sub horizontal) + ;; We found a fixed-size subwindow, so WINDOW's size is + ;; fixed. + (throw 'fixed t)) + (setq sub (window-right sub)))) + ;; WINDOW is a live window. + (with-current-buffer (window-buffer window) + (if horizontal + (memq window-size-fixed '(width t)) + (memq window-size-fixed '(height t)))))))) + +(defun window-size-fixed-p (&optional window horizontal) + "Return non-nil if WINDOW's height is fixed. +WINDOW can be an arbitrary window and defaults to the selected +window. Optional argument HORIZONTAL non-nil means return +non-nil if WINDOW's width is fixed. + +If this function returns nil, this does not necessarily mean that +WINDOW can be resized in the desired direction. The functions +`window-resizable' and `window-resizable-p' will tell that." + (window-size-fixed-1 + (normalize-any-window window) horizontal)) + +(defun window-min-delta-1 (window delta &optional horizontal ignore trail noup) + "Internal function for `window-min-delta'." + (if (not (window-parent window)) + ;; If we can't go up, return zero. + 0 + ;; Else try to find a non-fixed-size sibling of WINDOW. + (let* ((parent (window-parent window)) + (sub (window-child parent))) + (catch 'done + (if (window-iso-combined-p sub horizontal) + ;; In an iso-combination throw DELTA if we find at least one + ;; subwindow and that subwindow is either not of fixed-size + ;; or we can ignore fixed-sizeness. + (let ((skip (eq trail 'after))) + (while sub + (cond + ((eq sub window) + (setq skip (eq trail 'before))) + (skip) + ((and (not (window-size-ignore window ignore)) + (window-size-fixed-p sub horizontal))) + (t + ;; We found a non-fixed-size subwindow. + (throw 'done delta))) + (setq sub (window-right sub)))) + ;; In an ortho-combination set DELTA to the minimum value by + ;; which other subwindows can shrink. + (while sub + (unless (eq sub window) + (setq delta + (min delta + (- (window-total-size sub horizontal) + (window-min-size sub horizontal ignore))))) + (setq sub (window-right sub)))) + (if noup + delta + (window-min-delta-1 parent delta horizontal ignore trail)))))) + +(defun window-min-delta (&optional window horizontal ignore trail noup nodown) + "Return number of lines by which WINDOW can be shrunk. +WINDOW can be an arbitrary window and defaults to the selected +window. Return zero if WINDOW cannot be shrunk. + +Optional argument HORIZONTAL non-nil means return number of +columns by which WINDOW can be shrunk. + +Optional argument IGNORE non-nil means ignore any restrictions +imposed by fixed size windows, `window-min-height' or +`window-min-width' settings. IGNORE a window means ignore +restrictions for that window only. IGNORE equal `safe' means +live windows may get as small as `window-safe-min-height' lines +and `window-safe-min-width' columns. + +Optional argument TRAIL `before' means only windows to the left +of or above WINDOW can be enlarged. Optional argument TRAIL +`after' means only windows to the right of or below WINDOW can be +enlarged. + +Optional argument NOUP non-nil means don't go up in the window +tree but try to enlarge windows within WINDOW's combination only. + +Optional argument NODOWN non-nil means don't check whether WINDOW +itself \(and its subwindows) can be shrunk; check only whether at +least one other windows can be enlarged appropriately." + (setq window (normalize-any-window window)) + (let ((size (window-total-size window horizontal)) + (minimum (window-min-size window horizontal ignore))) + (cond + (nodown + ;; If NODOWN is t, try to recover the entire size of WINDOW. + (window-min-delta-1 window size horizontal ignore trail noup)) + ((= size minimum) + ;; If NODOWN is nil and WINDOW's size is already at its minimum, + ;; there's nothing to recover. + 0) + (t + ;; Otherwise, try to recover whatever WINDOW is larger than its + ;; minimum size. + (window-min-delta-1 + window (- size minimum) horizontal ignore trail noup))))) + +(defun window-max-delta-1 (window delta &optional horizontal ignore trail noup) + "Internal function of `window-max-delta'." + (if (not (window-parent window)) + ;; Can't go up. Return DELTA. + delta + (let* ((parent (window-parent window)) + (sub (window-child parent))) + (catch 'fixed + (if (window-iso-combined-p sub horizontal) + ;; For an iso-combination calculate how much we can get from + ;; other subwindows. + (let ((skip (eq trail 'after))) + (while sub + (cond + ((eq sub window) + (setq skip (eq trail 'before))) + (skip) + (t + (setq delta + (+ delta + (- (window-total-size sub horizontal) + (window-min-size sub horizontal ignore)))))) + (setq sub (window-right sub)))) + ;; For an ortho-combination throw DELTA when at least one + ;; subwindow is fixed-size. + (while sub + (when (and (not (eq sub window)) + (not (window-size-ignore sub ignore)) + (window-size-fixed-p sub horizontal)) + (throw 'fixed delta)) + (setq sub (window-right sub)))) + (if noup + ;; When NOUP is nil, DELTA is all we can get. + delta + ;; Else try with parent of WINDOW, passing the DELTA we + ;; recovered so far. + (window-max-delta-1 parent delta horizontal ignore trail)))))) + +(defun window-max-delta (&optional window horizontal ignore trail noup nodown) + "Return maximum number of lines WINDOW by which WINDOW can be enlarged. +WINDOW can be an arbitrary window and defaults to the selected +window. The return value is zero if WINDOW cannot be enlarged. + +Optional argument HORIZONTAL non-nil means return maximum number +of columns by which WINDOW can be enlarged. + +Optional argument IGNORE non-nil means ignore any restrictions +imposed by fixed size windows, `window-min-height' or +`window-min-width' settings. IGNORE a window means ignore +restrictions for that window only. IGNORE equal `safe' means +live windows may get as small as `window-safe-min-height' lines +and `window-safe-min-width' columns. + +Optional argument TRAIL `before' means only windows to the left +of or below WINDOW can be shrunk. Optional argument TRAIL +`after' means only windows to the right of or above WINDOW can be +shrunk. + +Optional argument NOUP non-nil means don't go up in the window +tree but try to obtain the entire space from windows within +WINDOW's combination. + +Optional argument NODOWN non-nil means do not check whether +WINDOW itself \(and its subwindows) can be enlarged; check only +whether other windows can be shrunk appropriately." + (setq window (normalize-any-window window)) + (if (and (not (window-size-ignore window ignore)) + (not nodown) (window-size-fixed-p window horizontal)) + ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed + ;; size. + 0 + ;; WINDOW has no fixed size. + (window-max-delta-1 window 0 horizontal ignore trail noup))) + +;; Make NOUP also inhibit the min-size check. +(defun window-resizable (window delta &optional horizontal ignore trail noup nodown) + "Return DELTA if WINDOW can be resized vertically by DELTA lines. +Optional argument HORIZONTAL non-nil means return DELTA if WINDOW +can be resized horizontally by DELTA columns. A return value of +zero means that WINDOW is not resizable. + +DELTA positive means WINDOW shall be enlarged by DELTA lines or +columns. If WINDOW cannot be enlarged by DELTA lines or columns +return the maximum value in the range 0..DELTA by which WINDOW +can be enlarged. + +DELTA negative means WINDOW shall be shrunk by -DELTA lines or +columns. If WINDOW cannot be shrunk by -DELTA lines or columns, +return the minimum value in the range DELTA..0 that can be used +for shrinking WINDOW. + +Optional argument IGNORE non-nil means ignore any restrictions +imposed by fixed size windows, `window-min-height' or +`window-min-width' settings. IGNORE a window means ignore +restrictions for that window only. IGNORE equal `safe' means +live windows may get as small as `window-safe-min-height' lines +and `window-safe-min-width' columns. + +Optional argument TRAIL `before' means only windows to the left +of or below WINDOW can be shrunk. Optional argument TRAIL +`after' means only windows to the right of or above WINDOW can be +shrunk. + +Optional argument NOUP non-nil means don't go up in the window +tree but try to distribute the space among the other windows +within WINDOW's combination. + +Optional argument NODOWN non-nil means don't check whether WINDOW +and its subwindows can be resized." + (setq window (normalize-any-window window)) + (cond + ((< delta 0) + (max (- (window-min-delta window horizontal ignore trail noup nodown)) + delta)) + ((> delta 0) + (min (window-max-delta window horizontal ignore trail noup nodown) + delta)) + (t 0))) + +(defun window-resizable-p (window delta &optional horizontal ignore trail noup nodown) + "Return t if WINDOW can be resized vertically by DELTA lines. +For the meaning of the arguments of this function see the +doc-string of `window-resizable'." + (setq window (normalize-any-window window)) + (if (> delta 0) + (>= (window-resizable window delta horizontal ignore trail noup nodown) + delta) + (<= (window-resizable window delta horizontal ignore trail noup nodown) + delta))) + +(defsubst window-total-height (&optional window) + "Return the total number of lines of WINDOW. +WINDOW can be any window and defaults to the selected one. The +return value includes WINDOW's mode line and header line, if any. +If WINDOW is internal the return value is the sum of the total +number of lines of WINDOW's child windows if these are vertically +combined and the height of WINDOW's first child otherwise. + +Note: This function does not take into account the value of +`line-spacing' when calculating the number of lines in WINDOW." + (window-total-size window)) + +;; See discussion in bug#4543. +(defsubst window-full-height-p (&optional window) + "Return t if WINDOW is as high as the containing frame. +More precisely, return t if and only if the total height of +WINDOW equals the total height of the root window of WINDOW's +frame. WINDOW can be any window and defaults to the selected +one." + (setq window (normalize-any-window window)) + (= (window-total-size window) + (window-total-size (frame-root-window window)))) + +(defsubst window-total-width (&optional window) + "Return the total number of columns of WINDOW. +WINDOW can be any window and defaults to the selected one. The +return value includes any vertical dividers or scrollbars of +WINDOW. If WINDOW is internal, the return value is the sum of +the total number of columns of WINDOW's child windows if these +are horizontally combined and the width of WINDOW's first child +otherwise." + (window-total-size window t)) + +(defsubst window-full-width-p (&optional window) + "Return t if WINDOW is as wide as the containing frame. +More precisely, return t if and only if the total width of WINDOW +equals the total width of the root window of WINDOW's frame. +WINDOW can be any window and defaults to the selected one." + (setq window (normalize-any-window window)) + (= (window-total-size window t) + (window-total-size (frame-root-window window) t))) + +(defsubst window-body-height (&optional window) + "Return the number of lines of WINDOW's body. +WINDOW must be a live window and defaults to the selected one. + +The return value does not include WINDOW's mode line and header line, if any. If a line at the bottom of the window is only -partially visible, that line is included in the return value. -If you do not want to include a partially visible bottom line -in the return value, use `window-text-height' instead." - (or window (setq window (selected-window))) - (if (window-minibuffer-p window) - (window-height window) - (with-current-buffer (window-buffer window) - (max 1 (- (window-height window) - (if mode-line-format 1 0) - (if header-line-format 1 0)))))) - -;; See discussion in bug#4543. -(defun window-full-height-p (&optional window) - "Return non-nil if WINDOW is not the result of a vertical split. -WINDOW defaults to the selected window. (This function is not -appropriate for minibuffers.)" - (unless window - (setq window (selected-window))) - (= (window-height window) - (window-height (frame-root-window (window-frame window))))) +partially visible, that line is included in the return value. If +you do not want to include a partially visible bottom line in the +return value, use `window-text-height' instead." + (window-body-size window)) + +(defsubst window-body-width (&optional window) + "Return the number of columns of WINDOW's body. +WINDOW must be a live window and defaults to the selected one. + +The return value does not include any vertical dividers or scroll +bars owned by WINDOW. On a window-system the return value does +not include the number of columns used for WINDOW's fringes or +display margins either." + (window-body-size window t)) (defun one-window-p (&optional nomini all-frames) "Return non-nil if the selected window is the only window. ------------------------------------------------------------ revno: 104527 committer: martin rudalics branch nick: trunk timestamp: Tue 2011-06-07 15:23:08 +0200 message: Move get-lru-window and get-largest-window to window.el. * window.c (window_loop): Remove handling of GET_LRU_WINDOW and GET_LARGEST_WINDOW. (Fget_lru_window, Fget_largest_window): Move to window.el. * window.el (get-lru-window, get-largest-window): Move here from window.c. Rename first argument to ALL-FRAMES. Rephrase doc-strings. (get-buffer-window-list): Rewrite using window-list-1. Rephrase doc-string. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-06-06 15:21:07 +0000 +++ lisp/ChangeLog 2011-06-07 13:23:08 +0000 @@ -1,3 +1,11 @@ +2011-06-07 Martin Rudalics + + * window.el (get-lru-window, get-largest-window): Move here from + window.c. Rename first argument to ALL-FRAMES. Rephrase + doc-strings. + (get-buffer-window-list): Rewrite using window-list-1. Rephrase + doc-string. + 2011-06-06 Martin Rudalics * window.el (window-right, window-left, window-child) === modified file 'lisp/window.el' --- lisp/window.el 2011-06-06 15:21:07 +0000 +++ lisp/window.el 2011-06-07 13:23:08 +0000 @@ -640,25 +640,112 @@ (defalias 'some-window 'get-window-with-predicate) -;; This should probably be written in C (i.e., without using `walk-windows'). +(defun get-lru-window (&optional all-frames dedicated) + "Return the least recently used window on frames specified by ALL-FRAMES. +Return a full-width window if possible. A minibuffer window is +never a candidate. A dedicated window is never a candidate +unless DEDICATED is non-nil, so if all windows are dedicated, the +value is nil. Avoid returning the selected window if possible. + +The following non-nil values of the optional argument ALL-FRAMES +have special meanings: + +- t means consider all windows on all existing frames. + +- `visible' means consider all windows on all visible frames on + the current terminal. + +- 0 (the number zero) means consider all windows on all visible + and iconified frames on the current terminal. + +- A frame means consider all windows on that frame only. + +Any other value of ALL-FRAMES means consider all windows on the +selected frame and no others." + (let (best-window best-time second-best-window second-best-time time) + (dolist (window (window-list-1 nil nil all-frames)) + (when (or dedicated (not (window-dedicated-p window))) + (setq time (window-use-time window)) + (if (or (eq window (selected-window)) + (not (window-full-width-p window))) + (when (or (not second-best-time) (< time second-best-time)) + (setq second-best-time time) + (setq second-best-window window)) + (when (or (not best-time) (< time best-time)) + (setq best-time time) + (setq best-window window))))) + (or best-window second-best-window))) + +(defun get-largest-window (&optional all-frames dedicated) + "Return the largest window on frames specified by ALL-FRAMES. +A minibuffer window is never a candidate. A dedicated window is +never a candidate unless DEDICATED is non-nil, so if all windows +are dedicated, the value is nil. + +The following non-nil values of the optional argument ALL-FRAMES +have special meanings: + +- t means consider all windows on all existing frames. + +- `visible' means consider all windows on all visible frames on + the current terminal. + +- 0 (the number zero) means consider all windows on all visible + and iconified frames on the current terminal. + +- A frame means consider all windows on that frame only. + +Any other value of ALL-FRAMES means consider all windows on the +selected frame and no others." + (let ((best-size 0) + best-window size) + (dolist (window (window-list-1 nil nil all-frames)) + (when (or dedicated (not (window-dedicated-p window))) + (setq size (* (window-total-size window) + (window-total-size window t))) + (when (> size best-size) + (setq best-size size) + (setq best-window window)))) + best-window)) + (defun get-buffer-window-list (&optional buffer-or-name minibuf all-frames) "Return list of all windows displaying BUFFER-OR-NAME, or nil if none. BUFFER-OR-NAME may be a buffer or the name of an existing buffer and defaults to the current buffer. -The optional arguments MINIBUF and ALL-FRAMES specify the set of -windows to consider. See `walk-windows' for the precise meaning -of these arguments." - (let ((buffer (cond - ((not buffer-or-name) (current-buffer)) - ((bufferp buffer-or-name) buffer-or-name) - (t (get-buffer buffer-or-name)))) +Any windows showing BUFFER-OR-NAME on the selected frame are listed +first. + +MINIBUF t means include the minibuffer window even if the +minibuffer is not active. MINIBUF nil or omitted means include +the minibuffer window only if the minibuffer is active. Any +other value means do not include the minibuffer window even if +the minibuffer is active. + +ALL-FRAMES nil or omitted means consider all windows on the +selected frame, plus the minibuffer window if specified by the +MINIBUF argument. If the minibuffer counts, consider all windows +on all frames that share that minibuffer too. The following +non-nil values of ALL-FRAMES have special meanings: + +- t means consider all windows on all existing frames. + +- `visible' means consider all windows on all visible frames on + the current terminal. + +- 0 (the number zero) means consider all windows on all visible + and iconified frames on the current terminal. + +- A frame means consider all windows on that frame only. + +Anything else means consider all windows on the selected frame +and no others." + (let ((buffer (normalize-live-buffer buffer-or-name)) windows) - (walk-windows (function (lambda (window) - (if (eq (window-buffer window) buffer) - (setq windows (cons window windows))))) - minibuf all-frames) - windows)) + (dolist (window (window-list-1 (frame-first-window) minibuf all-frames)) + (when (eq (window-buffer window) buffer) + (setq windows (cons window windows)))) + (nreverse windows))) (defun minibuffer-window-active-p (window) "Return t if WINDOW is the currently active minibuffer window." === modified file 'src/ChangeLog' --- src/ChangeLog 2011-06-07 12:51:07 +0000 +++ src/ChangeLog 2011-06-07 13:23:08 +0000 @@ -10,6 +10,9 @@ delete_all_subwindows with window as argument. (delete_all_subwindows): Take a window as argument and not a structure. Rewrite. + (window_loop): Remove handling of GET_LRU_WINDOW and + GET_LARGEST_WINDOW. + (Fget_lru_window, Fget_largest_window): Move to window.el. * window.h: Extern window_body_cols instead of window_box_text_cols. delete_all_subwindows now takes a === modified file 'src/window.c' --- src/window.c 2011-06-07 12:51:07 +0000 +++ src/window.c 2011-06-07 13:23:08 +0000 @@ -2487,10 +2487,8 @@ { WINDOW_LOOP_UNUSED, GET_BUFFER_WINDOW, /* Arg is buffer */ - GET_LRU_WINDOW, /* Arg is t for full-width windows only */ DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ DELETE_BUFFER_WINDOWS, /* Arg is buffer */ - GET_LARGEST_WINDOW, UNSHOW_BUFFER, /* Arg is buffer */ REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ CHECK_ALL_WINDOWS @@ -2573,21 +2571,6 @@ } break; - case GET_LRU_WINDOW: - /* `obj' is an integer encoding a bitvector. - `obj & 1' means consider only full-width windows. - `obj & 2' means consider also dedicated windows. */ - if (((XINT (obj) & 1) && !WINDOW_FULL_WIDTH_P (w)) - || (!(XINT (obj) & 2) && !NILP (w->dedicated)) - /* Minibuffer windows are always ignored. */ - || MINI_WINDOW_P (w)) - break; - if (NILP (best_window) - || (XFASTINT (XWINDOW (best_window)->use_time) - > XFASTINT (w->use_time))) - best_window = window; - break; - case DELETE_OTHER_WINDOWS: if (!EQ (window, obj)) Fdelete_window (window); @@ -2632,24 +2615,6 @@ } break; - case GET_LARGEST_WINDOW: - { /* nil `obj' means to ignore dedicated windows. */ - /* Ignore dedicated windows and minibuffers. */ - if (MINI_WINDOW_P (w) || (NILP (obj) && !NILP (w->dedicated))) - break; - - if (NILP (best_window)) - best_window = window; - else - { - struct window *b = XWINDOW (best_window); - if (XFASTINT (w->total_lines) * XFASTINT (w->total_cols) - > XFASTINT (b->total_lines) * XFASTINT (b->total_cols)) - best_window = window; - } - } - break; - case UNSHOW_BUFFER: if (EQ (w->buffer, obj)) { @@ -2740,50 +2705,6 @@ return decode_window (window)->use_time; } -DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, - doc: /* Return the window least recently selected or used for display. -\(LRU means Least Recently Used.) - -Return a full-width window if possible. -A minibuffer window is never a candidate. -A dedicated window is never a candidate, unless DEDICATED is non-nil, - so if all windows are dedicated, the value is nil. -If optional argument FRAME is `visible', search all visible frames. -If FRAME is 0, search all visible and iconified frames. -If FRAME is t, search all frames. -If FRAME is nil, search only the selected frame. -If FRAME is a frame, search only that frame. */) - (Lisp_Object frame, Lisp_Object dedicated) -{ - register Lisp_Object w; - /* First try for a window that is full-width */ - w = window_loop (GET_LRU_WINDOW, - NILP (dedicated) ? make_number (1) : make_number (3), - 0, frame); - if (!NILP (w) && !EQ (w, selected_window)) - return w; - /* If none of them, try the rest */ - return window_loop (GET_LRU_WINDOW, - NILP (dedicated) ? make_number (0) : make_number (2), - 0, frame); -} - -DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 2, 0, - doc: /* Return the largest window in area. -A minibuffer window is never a candidate. -A dedicated window is never a candidate unless DEDICATED is non-nil, - so if all windows are dedicated, the value is nil. -If optional argument FRAME is `visible', search all visible frames. -If FRAME is 0, search all visible and iconified frames. -If FRAME is t, search all frames. -If FRAME is nil, search only the selected frame. -If FRAME is a frame, search only that frame. */) - (Lisp_Object frame, Lisp_Object dedicated) -{ - return window_loop (GET_LARGEST_WINDOW, dedicated, 0, - frame); -} - DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0, doc: /* Return a window currently displaying BUFFER-OR-NAME, or nil if none. BUFFER-OR-NAME may be a buffer or a buffer name and defaults to the @@ -7431,8 +7352,6 @@ defsubr (&Snext_window); defsubr (&Sprevious_window); defsubr (&Sother_window); - defsubr (&Sget_lru_window); - defsubr (&Sget_largest_window); defsubr (&Sget_buffer_window); defsubr (&Sdelete_other_windows); defsubr (&Sdelete_windows_on); ------------------------------------------------------------ revno: 104526 committer: martin rudalics branch nick: trunk timestamp: Tue 2011-06-07 14:51:07 +0200 message: Make delete_all_subwindows argument a Lisp_Object. * window.c (delete_window, Fset_window_configuration): Call delete_all_subwindows with window as argument. (delete_all_subwindows): Take a window as argument and not a structure. Rewrite. * window.h: delete_all_subwindows now takes a Lisp_Object as argument. * frame.c (delete_frame): Call delete_all_subwindows with root window as argument. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-06-07 09:26:21 +0000 +++ src/ChangeLog 2011-06-07 12:51:07 +0000 @@ -6,13 +6,21 @@ (window_box_text_cols): Replace with window_body_cols. (Fwindow_width, Fscroll_left, Fscroll_right): Use window_body_cols instead of window_box_text_cols. + (delete_window, Fset_window_configuration): Call + delete_all_subwindows with window as argument. + (delete_all_subwindows): Take a window as argument and not a + structure. Rewrite. * window.h: Extern window_body_cols instead of - window_box_text_cols. + window_box_text_cols. delete_all_subwindows now takes a + Lisp_Object as argument. * indent.c (compute_motion, Fcompute_motion): Use window_body_cols instead of window_box_text_cols. + * frame.c (delete_frame): Call delete_all_subwindows with root + window as argument. + 2011-06-07 Daniel Colascione * fns.c (Fputhash): Document return value. === modified file 'src/frame.c' --- src/frame.c 2011-06-06 13:57:49 +0000 +++ src/frame.c 2011-06-07 12:51:07 +0000 @@ -1336,7 +1336,7 @@ /* Mark all the windows that used to be on FRAME as deleted, and then remove the reference to them. */ - delete_all_subwindows (XWINDOW (f->root_window)); + delete_all_subwindows (f->root_window); f->root_window = Qnil; Vframe_list = Fdelq (frame, Vframe_list); === modified file 'src/window.c' --- src/window.c 2011-06-07 09:26:21 +0000 +++ src/window.c 2011-06-07 12:51:07 +0000 @@ -2001,9 +2001,9 @@ /* Since we may be deleting combination windows, we must make sure that not only p but all its children have been marked as deleted. */ if (! NILP (p->hchild)) - delete_all_subwindows (XWINDOW (p->hchild)); + delete_all_subwindows (p->hchild); else if (! NILP (p->vchild)) - delete_all_subwindows (XWINDOW (p->vchild)); + delete_all_subwindows (p->vchild); /* Mark this window as deleted. */ p->buffer = p->hchild = p->vchild = Qnil; @@ -6260,7 +6260,7 @@ Save their current buffers in their height fields, since we may need it later, if a buffer saved in the configuration is now dead. */ - delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); + delete_all_subwindows (FRAME_ROOT_WINDOW (f)); for (k = 0; k < saved_windows->header.size; k++) { @@ -6448,31 +6448,38 @@ return (FRAME_LIVE_P (f) ? Qt : Qnil); } -/* Mark all windows now on frame as deleted - by setting their buffers to nil. */ - +/* Delete all subwindows reachable via the next, vchild, and hchild + slots of WINDOW. */ void -delete_all_subwindows (register struct window *w) +delete_all_subwindows (Lisp_Object window) { + register struct window *w; + + w = XWINDOW (window); + if (!NILP (w->next)) - delete_all_subwindows (XWINDOW (w->next)); - if (!NILP (w->vchild)) - delete_all_subwindows (XWINDOW (w->vchild)); - if (!NILP (w->hchild)) - delete_all_subwindows (XWINDOW (w->hchild)); + /* Delete WINDOW's siblings (we traverse postorderly). */ + delete_all_subwindows (w->next); w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ - if (!NILP (w->buffer)) - unshow_buffer (w); - - /* We set all three of these fields to nil, to make sure that we can - distinguish this dead window from any live window. Live leaf - windows will have buffer set, and combination windows will have - vchild or hchild set. */ - w->buffer = Qnil; - w->vchild = Qnil; - w->hchild = Qnil; + if (!NILP (w->vchild)) + { + delete_all_subwindows (w->vchild); + w->vchild = Qnil; + } + else if (!NILP (w->hchild)) + { + delete_all_subwindows (w->hchild); + w->hchild = Qnil; + } + else if (!NILP (w->buffer)) + { + unshow_buffer (w); + unchain_marker (XMARKER (w->pointm)); + unchain_marker (XMARKER (w->start)); + w->buffer = Qnil; + } Vwindow_list = Qnil; } === modified file 'src/window.h' --- src/window.h 2011-06-07 09:26:21 +0000 +++ src/window.h 2011-06-07 12:51:07 +0000 @@ -770,7 +770,7 @@ extern void set_window_height (Lisp_Object, int, int); extern void set_window_width (Lisp_Object, int, int); extern void change_window_heights (Lisp_Object, int); -extern void delete_all_subwindows (struct window *); +extern void delete_all_subwindows (Lisp_Object); extern void freeze_window_starts (struct frame *, int); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); ------------------------------------------------------------ revno: 104525 committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2011-06-07 15:35:48 +0300 message: nt/ChangeLog: Fix a typo in last entry. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2011-06-07 12:34:09 +0000 +++ nt/ChangeLog 2011-06-07 12:35:48 +0000 @@ -1,7 +1,7 @@ 2011-06-07 Eli Zaretskii * inc/stdint.h (INT32_MAX, INT64_MAX, INTPTR_MAX, PTRDIFF_MAX) - [!__GNUC__}: New macros. + [!__GNUC__]: New macros. 2011-05-28 Paul Eggert ------------------------------------------------------------ revno: 104524 committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2011-06-07 15:34:09 +0300 message: Update nt/inc/stdint.h for PTRDIFF_MAX. nt/inc/stdint.h (INT32_MAX, INT64_MAX, INTPTR_MAX, PTRDIFF_MAX) [!__GNUC__]: New macros. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2011-05-28 22:39:39 +0000 +++ nt/ChangeLog 2011-06-07 12:34:09 +0000 @@ -1,3 +1,8 @@ +2011-06-07 Eli Zaretskii + + * inc/stdint.h (INT32_MAX, INT64_MAX, INTPTR_MAX, PTRDIFF_MAX) + [!__GNUC__}: New macros. + 2011-05-28 Paul Eggert Use 'inline', not 'INLINE'. === modified file 'nt/inc/stdint.h' --- nt/inc/stdint.h 2011-05-06 12:09:08 +0000 +++ nt/inc/stdint.h 2011-06-07 12:34:09 +0000 @@ -28,14 +28,20 @@ stdint.h is not available, e.g. Microsoft Visual Studio. */ typedef unsigned int uint32_t; +#define INT32_MAX 2147483647 +/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */ +#define INT64_MAX 9223372036854775807i64 #ifdef _WIN64 typedef __int64 intptr_t; +#define INTPTR_MAX INT64_MAX #else typedef int intptr_t; +#define INTPTR_MAX INT32_MAX #endif #define uintmax_t unsigned __int64 +#define PTRDIFF_MAX INTPTR_MAX #endif /* !__GNUC__ */ ------------------------------------------------------------ revno: 104523 committer: Glenn Morris branch nick: trunk timestamp: Tue 2011-06-07 06:18:29 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/config.in' --- autogen/config.in 2011-05-31 10:19:08 +0000 +++ autogen/config.in 2011-06-07 10:18:29 +0000 @@ -1101,6 +1101,9 @@ 'wchar_t'. */ #undef WCHAR_T_SUFFIX +/* Use long long for EMACS_INT if available. */ +#undef WIDE_EMACS_INT + /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wint_t'. */ #undef WINT_T_SUFFIX @@ -1261,6 +1264,20 @@ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* The __pure__ attribute was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The __const__ attribute was added in gcc 2.95. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + /* Define as a macro for copying va_list variables. */ #undef va_copy === modified file 'autogen/configure' --- autogen/configure 2011-05-30 10:18:40 +0000 +++ autogen/configure 2011-06-07 10:18:29 +0000 @@ -1249,6 +1249,7 @@ with_sound with_sync_input with_x_toolkit +with_wide_int with_xpm with_jpeg with_tiff @@ -1962,6 +1963,7 @@ --without-sync-input process async input synchronously --with-x-toolkit=KIT use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no) + --with-wide-int prefer wide Emacs integers (typically 62-bit) --without-xpm don't compile with XPM image support --without-jpeg don't compile with JPEG image support --without-tiff don't compile with TIFF image support @@ -3823,6 +3825,20 @@ +# Check whether --with-wide-int was given. +if test "${with_wide_int+set}" = set; then : + withval=$with_wide_int; +else + with_wide_int=no +fi + +if test "$with_wide_int" = yes; then + +$as_echo "#define WIDE_EMACS_INT 1" >>confdefs.h + +fi + + # Check whether --with-xpm was given. if test "${with_xpm+set}" = set; then : withval=$with_xpm; ------------------------------------------------------------ revno: 104522 committer: martin rudalics branch nick: trunk timestamp: Tue 2011-06-07 11:26:21 +0200 message: Install some window-size related functions and window-list-1. * window.c (Fwindow_total_size, Fwindow_left_column) (Fwindow_top_line, window_body_lines, Fwindow_body_size) (Fwindow_list_1): New functions. (window_box_text_cols): Replace with window_body_cols. (Fwindow_width, Fscroll_left, Fscroll_right): Use window_body_cols instead of window_box_text_cols. * window.h: Extern window_body_cols instead of window_box_text_cols. * indent.c (compute_motion, Fcompute_motion): Use window_body_cols instead of window_box_text_cols. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-06-07 01:39:26 +0000 +++ src/ChangeLog 2011-06-07 09:26:21 +0000 @@ -1,3 +1,18 @@ +2011-06-07 Martin Rudalics + + * window.c (Fwindow_total_size, Fwindow_left_column) + (Fwindow_top_line, window_body_lines, Fwindow_body_size) + (Fwindow_list_1): New functions. + (window_box_text_cols): Replace with window_body_cols. + (Fwindow_width, Fscroll_left, Fscroll_right): Use + window_body_cols instead of window_box_text_cols. + + * window.h: Extern window_body_cols instead of + window_box_text_cols. + + * indent.c (compute_motion, Fcompute_motion): Use + window_body_cols instead of window_box_text_cols. + 2011-06-07 Daniel Colascione * fns.c (Fputhash): Document return value. === modified file 'src/indent.c' --- src/indent.c 2011-05-12 07:07:06 +0000 +++ src/indent.c 2011-06-07 09:26:21 +0000 @@ -1102,8 +1102,8 @@ WINDOW_HAS_VERTICAL_SCROLL_BAR (window) and frame_cols = FRAME_COLS (XFRAME (window->frame)) - Or you can let window_box_text_cols do this all for you, and write: - window_box_text_cols (w) - 1 + Or you can let window_body_cols do this all for you, and write: + window_body_cols (w) - 1 The `-1' accounts for the continuation-line backslashes; the rest accounts for window borders if the window is split horizontally, and @@ -1179,7 +1179,7 @@ /* Negative width means use all available text columns. */ if (width < 0) { - width = window_box_text_cols (win); + width = window_body_cols (win); /* We must make room for continuation marks if we don't have fringes. */ #ifdef HAVE_WINDOW_SYSTEM if (!FRAME_WINDOW_P (XFRAME (win->frame))) @@ -1792,7 +1792,7 @@ ? window_internal_height (w) : XINT (XCDR (topos))), (NILP (topos) - ? (window_box_text_cols (w) + ? (window_body_cols (w) - ( #ifdef HAVE_WINDOW_SYSTEM FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 : === modified file 'src/window.c' --- src/window.c 2011-06-06 13:57:49 +0000 +++ src/window.c 2011-06-07 09:26:21 +0000 @@ -691,9 +691,115 @@ make_number (row->y), make_number (crop)); } - - +DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, + doc: /* Return the total number of lines of WINDOW. +WINDOW can be any window and defaults to the selected one. The return +value includes WINDOW's mode line and header line, if any. If WINDOW +is internal, the return value is the sum of the total number of lines +of WINDOW's child windows if these are vertically combined and the +height of WINDOW's first child otherwise. + +Optional argument HORIZONTAL non-nil means return the total number of +columns of WINDOW. In this case the return value includes any vertical +dividers or scrollbars of WINDOW. If WINDOW is internal, the return +value is the sum of the total number of columns of WINDOW's child +windows if they are horizontally combined and the width of WINDOW's +first child otherwise. */) + (Lisp_Object window, Lisp_Object horizontal) +{ + if (NILP (horizontal)) + return decode_any_window (window)->total_lines; + else + return decode_any_window (window)->total_cols; +} + +DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, + doc: /* Return left column of WINDOW. +WINDOW can be any window and defaults to the selected one. */) + (Lisp_Object window) +{ + return decode_any_window (window)->left_col; +} + +DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, + doc: /* Return top line of WINDOW. +WINDOW can be any window and defaults to the selected one. */) + (Lisp_Object window) +{ + return decode_any_window (window)->top_line; +} + +/* Return the number of lines of W's body. Don't count any mode or + header line of W. */ + +int +window_body_lines (struct window *w) +{ + int height = XFASTINT (w->total_lines); + + if (!MINI_WINDOW_P (w)) + { + if (WINDOW_WANTS_MODELINE_P (w)) + --height; + if (WINDOW_WANTS_HEADER_LINE_P (w)) + --height; + } + + return height; +} + +/* Return the number of columns of W's body. Don't count columns + occupied by the scroll bar or the vertical bar separating W from its + right sibling. On window-systems don't count fringes or display + margins either. */ + +int +window_body_cols (struct window *w) +{ + struct frame *f = XFRAME (WINDOW_FRAME (w)); + int width = XINT (w->total_cols); + + if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) + /* Scroll bars occupy a few columns. */ + width -= WINDOW_CONFIG_SCROLL_BAR_COLS (w); + else if (!FRAME_WINDOW_P (f) + && !WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w)) + /* The column of `|' characters separating side-by-side windows + occupies one column only. */ + width -= 1; + + if (FRAME_WINDOW_P (f)) + /* On window-systems, fringes and display margins cannot be + used for normal text. */ + width -= (WINDOW_FRINGE_COLS (w) + + WINDOW_LEFT_MARGIN_COLS (w) + + WINDOW_RIGHT_MARGIN_COLS (w)); + + return width; +} + +DEFUN ("window-body-size", Fwindow_body_size, Swindow_body_size, 0, 2, 0, + doc: /* Return the number of lines of WINDOW's body. +WINDOW must be a live window and defaults to the selected one. The +return value does not include WINDOW's mode line and header line, if +any. + +Optional argument HORIZONTAL non-nil means return the number of columns +of WINDOW's body. In this case, the return value does not include any +vertical dividers or scroll bars owned by WINDOW. On a window-system +the return value does not include the number of columns used for +WINDOW's fringes or display margins either. */) + (Lisp_Object window, Lisp_Object horizontal) +{ + struct window *w = decode_any_window (window); + + if (NILP (horizontal)) + return make_number (window_body_lines (w)); + else + return make_number (window_body_cols (w)); +} + DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, doc: /* Return the number of lines in WINDOW. WINDOW defaults to the selected window. @@ -716,7 +822,7 @@ (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) (Lisp_Object window) { - return make_number (window_box_text_cols (decode_any_window (window))); + return make_number (window_body_cols (decode_any_window (window))); } DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0, @@ -2248,6 +2354,43 @@ } +DEFUN ("window-list-1", Fwindow_list_1, Swindow_list_1, 0, 3, 0, + doc: /* Return a list of all live windows. +WINDOW specifies the first window to list and defaults to the selected +window. + +Optional argument MINIBUF nil or omitted means consider the minibuffer +window only if the minibuffer is active. MINIBUF t means consider the +minibuffer window even if the minibuffer is not active. Any other value +means do not consider the minibuffer window even if the minibuffer is +active. + +Optional argument ALL-FRAMES nil or omitted means consider all windows +on WINDOW's frame, plus the minibuffer window if specified by the +MINIBUF argument. If the minibuffer counts, consider all windows on all +frames that share that minibuffer too. The following non-nil values of +ALL-FRAMES have special meanings: + +- t means consider all windows on all existing frames. + +- `visible' means consider all windows on all visible frames. + +- 0 (the number zero) means consider all windows on all visible and + iconified frames. + +- A frame means consider all windows on that frame only. + +Anything else means consider all windows on WINDOW's frame and no +others. + +If WINDOW is not on the list of windows returned, some other window will +be listed first but no error is signalled. */) + (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) +{ + return window_list_1 (window, minibuf, all_frames); +} + + DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", doc: /* Select another window in cyclic ordering of windows. COUNT specifies the number of windows to skip, starting with the @@ -2279,29 +2422,6 @@ } -DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, - doc: /* Return a list of windows on FRAME, starting with WINDOW. -FRAME nil or omitted means use the selected frame. -WINDOW nil or omitted means use the selected window. -MINIBUF t means include the minibuffer window, even if it isn't active. -MINIBUF nil or omitted means include the minibuffer window only -if it's active. -MINIBUF neither nil nor t means never include the minibuffer window. */) - (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window) -{ - if (NILP (window)) - window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window; - CHECK_WINDOW (window); - if (NILP (frame)) - frame = selected_frame; - - if (!EQ (frame, XWINDOW (window)->frame)) - error ("Window is on a different frame"); - - return window_list_1 (window, minibuf, frame); -} - - /* Return a list of windows in cyclic ordering. Arguments are like for `next-window'. */ @@ -2331,6 +2451,29 @@ } +DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, + doc: /* Return a list of windows on FRAME, starting with WINDOW. +FRAME nil or omitted means use the selected frame. +WINDOW nil or omitted means use the selected window. +MINIBUF t means include the minibuffer window, even if it isn't active. +MINIBUF nil or omitted means include the minibuffer window only +if it's active. +MINIBUF neither nil nor t means never include the minibuffer window. */) + (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window) +{ + if (NILP (window)) + window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window; + CHECK_WINDOW (window); + if (NILP (frame)) + frame = selected_frame; + + if (!EQ (frame, XWINDOW (window)->frame)) + error ("Window is on a different frame"); + + return window_list_1 (window, minibuf, frame); +} + + /* Look at all windows, performing an operation specified by TYPE with argument OBJ. @@ -4808,37 +4951,6 @@ return ht; } - - -/* Return the number of columns in W. - Don't count columns occupied by scroll bars or the vertical bar - separating W from the sibling to its right. */ - -int -window_box_text_cols (struct window *w) -{ - struct frame *f = XFRAME (WINDOW_FRAME (w)); - int width = XINT (w->total_cols); - - if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) - /* Scroll bars occupy a few columns. */ - width -= WINDOW_CONFIG_SCROLL_BAR_COLS (w); - else if (!FRAME_WINDOW_P (f) - && !WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w)) - /* The column of `|' characters separating side-by-side windows - occupies one column only. */ - width -= 1; - - if (FRAME_WINDOW_P (f)) - /* On window-systems, fringes and display margins cannot be - used for normal text. */ - width -= (WINDOW_FRINGE_COLS (w) - + WINDOW_LEFT_MARGIN_COLS (w) - + WINDOW_RIGHT_MARGIN_COLS (w)); - - return width; -} - /************************************************************************ Window Scrolling @@ -5547,7 +5659,7 @@ struct window *w = XWINDOW (selected_window); if (NILP (arg)) - XSETFASTINT (arg, window_box_text_cols (w) - 2); + XSETFASTINT (arg, window_body_cols (w) - 2); else arg = Fprefix_numeric_value (arg); @@ -5576,7 +5688,7 @@ struct window *w = XWINDOW (selected_window); if (NILP (arg)) - XSETFASTINT (arg, window_box_text_cols (w) - 2); + XSETFASTINT (arg, window_body_cols (w) - 2); else arg = Fprefix_numeric_value (arg); @@ -7280,6 +7392,11 @@ defsubr (&Swindow_hchild); defsubr (&Swindow_next); defsubr (&Swindow_prev); + defsubr (&Swindow_use_time); + defsubr (&Swindow_top_line); + defsubr (&Swindow_left_column); + defsubr (&Swindow_total_size); + defsubr (&Swindow_body_size); defsubr (&Swindow_height); defsubr (&Swindow_width); defsubr (&Swindow_full_width_p); @@ -7308,7 +7425,6 @@ defsubr (&Sprevious_window); defsubr (&Sother_window); defsubr (&Sget_lru_window); - defsubr (&Swindow_use_time); defsubr (&Sget_largest_window); defsubr (&Sget_buffer_window); defsubr (&Sdelete_other_windows); @@ -7348,10 +7464,10 @@ defsubr (&Sset_window_vscroll); defsubr (&Scompare_window_configurations); defsubr (&Swindow_list); + defsubr (&Swindow_list_1); defsubr (&Swindow_parameters); defsubr (&Swindow_parameter); defsubr (&Sset_window_parameter); - } void === modified file 'src/window.h' --- src/window.h 2011-06-06 16:54:34 +0000 +++ src/window.h 2011-06-07 09:26:21 +0000 @@ -867,6 +867,6 @@ extern void syms_of_window (void); extern void keys_of_window (void); -extern int window_box_text_cols (struct window *w); +extern int window_body_cols (struct window *w); #endif /* not WINDOW_H_INCLUDED */ ------------------------------------------------------------ revno: 104521 committer: Paul Eggert branch nick: trunk timestamp: Mon 2011-06-06 21:16:37 -0700 message: [ChangeLog] * configure.in: Add --with-wide-int. * INSTALL: Mention this. [etc/ChangeLog] * NEWS: Mention new configure option --with-wide-int. diff: === modified file 'ChangeLog' --- ChangeLog 2011-06-06 19:53:44 +0000 +++ ChangeLog 2011-06-07 04:16:37 +0000 @@ -1,3 +1,8 @@ +2011-06-07 Paul Eggert + + * configure.in: Add --with-wide-int. + * INSTALL: Mention this. + 2011-06-06 Paul Eggert Merge from gnulib. === modified file 'INSTALL' --- INSTALL 2011-05-18 03:39:45 +0000 +++ INSTALL 2011-06-07 04:16:37 +0000 @@ -309,6 +309,10 @@ Use --without-sound to disable sound support. +Use --with-wide-int to implement Emacs values with the type 'long long', +even on hosts where a narrower type would do. With this option, on a +typical 32-bit host, Emacs integers have 62 bits instead of 30. + The `--prefix=PREFIXDIR' option specifies where the installation process should put emacs and its data files. This defaults to `/usr/local'. - Emacs (and the other utilities users run) go in PREFIXDIR/bin === modified file 'configure.in' --- configure.in 2011-05-28 22:39:39 +0000 +++ configure.in 2011-06-07 04:16:37 +0000 @@ -144,6 +144,11 @@ with_x_toolkit=$val ]) +OPTION_DEFAULT_OFF([wide-int], [prefer wide Emacs integers (typically 62-bit)]) +if test "$with_wide_int" = yes; then + AC_DEFINE([WIDE_EMACS_INT], 1, [Use long long for EMACS_INT if available.]) +fi + dnl _ON results in a '--without' option in the --help output, so dnl the help text should refer to "don't compile", etc. OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support]) === modified file 'etc/ChangeLog' --- etc/ChangeLog 2011-06-06 19:43:39 +0000 +++ etc/ChangeLog 2011-06-07 04:16:37 +0000 @@ -1,3 +1,7 @@ +2011-06-07 Paul Eggert + + * NEWS: Mention new configure option --with-wide-int. + 2011-05-24 Leo Liu * NEWS: Mention the new primitive sha1 and the removal of sha1.el. === modified file 'etc/NEWS' --- etc/NEWS 2011-06-06 19:43:39 +0000 +++ etc/NEWS 2011-06-07 04:16:37 +0000 @@ -47,6 +47,9 @@ This is only useful for Emacs developers to debug certain types of bugs. This is not a new feature; only the configure flag is new. +** There is a new configure option --with-wide-int. +With it, Emacs integers typically have 62 bits, even on 32-bit machines. + --- ** New translation of the Emacs Tutorial in Hebrew is available. Type `C-u C-h t' to choose it in case your language setup doesn't ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.