Now on revision 110779. ------------------------------------------------------------ revno: 110779 committer: Dmitry Antipov branch nick: trunk timestamp: Sat 2012-11-03 09:59:17 +0400 message: * frame.h (struct frame): Drop can_have_scroll_bars member which is meaningless for a long time. Adjust comments. (FRAME_CAN_HAVE_SCROLL_BARS): Remove. * frame.c, nsfns.m, term.c, w32fns.c, xfns.c: Adjust users. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 05:11:34 +0000 +++ src/ChangeLog 2012-11-03 05:59:17 +0000 @@ -1,5 +1,12 @@ 2012-11-03 Dmitry Antipov + * frame.h (struct frame): Drop can_have_scroll_bars member + which is meaningless for a long time. Adjust comments. + (FRAME_CAN_HAVE_SCROLL_BARS): Remove. + * frame.c, nsfns.m, term.c, w32fns.c, xfns.c: Adjust users. + +2012-11-03 Dmitry Antipov + * window.c (decode_next_window_args): Update window arg after calling decode_live_window and so fix crash reported at http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00035.html === modified file 'src/frame.c' --- src/frame.c 2012-10-30 18:28:48 +0000 +++ src/frame.c 2012-11-03 05:59:17 +0000 @@ -502,7 +502,6 @@ FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR; FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* The default value of menu-bar-mode is t. */ @@ -551,7 +550,6 @@ FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; #endif /* not MSDOS */ - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1; === modified file 'src/frame.h' --- src/frame.h 2012-10-20 21:30:51 +0000 +++ src/frame.h 2012-11-03 05:59:17 +0000 @@ -409,10 +409,6 @@ show no modeline for that window. */ unsigned wants_modeline : 1; - /* Non-zero if the hardware device this frame is displaying on can - support scroll bars. */ - char can_have_scroll_bars; - /* Non-0 means raise this frame to the top of the heap when selected. */ unsigned auto_raise : 1; @@ -438,8 +434,7 @@ /* Nonzero means that the pointer is invisible. */ unsigned pointer_invisible :1; - /* If can_have_scroll_bars is non-zero, this is non-zero if we should - actually display them on this frame. */ + /* Nonzero if we should actually display the scroll bars on this frame. */ enum vertical_scroll_bar_type vertical_scroll_bar_type; /* What kind of text cursor should we draw in the future? @@ -767,11 +762,6 @@ #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos #define FRAME_FOCUS_FRAME(f) f->focus_frame -/* Nonzero if frame F supports scroll bars. - If this is zero, then it is impossible to enable scroll bars - on frame F. */ -#define FRAME_CAN_HAVE_SCROLL_BARS(f) ((f)->can_have_scroll_bars) - /* This frame slot says whether scroll bars are currently enabled for frame F, and which side they are on. */ #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type) === modified file 'src/nsfns.m' --- src/nsfns.m 2012-10-07 10:07:23 +0000 +++ src/nsfns.m 2012-11-03 05:59:17 +0000 @@ -1175,7 +1175,6 @@ f = make_frame (1); XSETFRAME (frame, f); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; f->terminal = dpyinfo->terminal; === modified file 'src/term.c' --- src/term.c 2012-10-25 04:35:39 +0000 +++ src/term.c 2012-11-03 05:59:17 +0000 @@ -3235,7 +3235,6 @@ FrameCols (tty) = FRAME_COLS (f); tty->specified_window = FRAME_LINES (f); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; terminal->char_ins_del_ok = 1; baud_rate = 19200; === modified file 'src/w32fns.c' --- src/w32fns.c 2012-11-02 14:00:45 +0000 +++ src/w32fns.c 2012-11-03 05:59:17 +0000 @@ -4284,9 +4284,6 @@ XSETFRAME (frame, f); - /* Note that Windows does support scroll bars. */ - FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; - /* By default, make scrollbars the system standard width. */ FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); @@ -5387,7 +5384,6 @@ Finsert (1, &text); set_buffer_internal_1 (old_buffer); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; record_unwind_protect (unwind_create_tip_frame, frame); /* By setting the output method, we're essentially saying that === modified file 'src/xfns.c' --- src/xfns.c 2012-09-30 13:43:47 +0000 +++ src/xfns.c 2012-11-03 05:59:17 +0000 @@ -3111,9 +3111,6 @@ XSETFRAME (frame, f); - /* Note that X Windows does support scroll bars. */ - FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; - f->terminal = dpyinfo->terminal; f->output_method = output_x_window; @@ -4596,7 +4593,6 @@ Finsert (1, &text); set_buffer_internal_1 (old_buffer); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; record_unwind_protect (unwind_create_tip_frame, frame); f->terminal = dpyinfo->terminal; ------------------------------------------------------------ revno: 110778 committer: Dmitry Antipov branch nick: trunk timestamp: Sat 2012-11-03 09:11:34 +0400 message: * window.c (decode_next_window_args): Update window arg after calling decode_live_window and so fix crash reported at http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00035.html by Juanma Barranquero . (Fwindow_body_width, Fwindow_body_height): Simplify a bit. * font.c (Ffont_at): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-01 22:44:53 +0000 +++ src/ChangeLog 2012-11-03 05:11:34 +0000 @@ -1,3 +1,12 @@ +2012-11-03 Dmitry Antipov + + * window.c (decode_next_window_args): Update window arg after + calling decode_live_window and so fix crash reported at + http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00035.html + by Juanma Barranquero . + (Fwindow_body_width, Fwindow_body_height): Simplify a bit. + * font.c (Ffont_at): Likewise. + 2012-11-01 Jan Djärv * widget.c (resize_cb): New function. === modified file 'src/font.c' --- src/font.c 2012-11-02 10:34:26 +0000 +++ src/font.c 2012-11-03 05:11:34 +0000 @@ -4766,7 +4766,6 @@ (Lisp_Object position, Lisp_Object window, Lisp_Object string) { struct window *w = decode_live_window (window); - ptrdiff_t pos; if (NILP (string)) { @@ -4775,7 +4774,6 @@ CHECK_NUMBER_COERCE_MARKER (position); if (! (BEGV <= XINT (position) && XINT (position) < ZV)) args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); - pos = XINT (position); } else { @@ -4783,10 +4781,9 @@ CHECK_STRING (string); if (! (0 <= XINT (position) && XINT (position) < SCHARS (string))) args_out_of_range (string, position); - pos = XINT (position); } - return font_at (-1, pos, NULL, w, string); + return font_at (-1, XINT (position), NULL, w, string); } #if 0 === modified file 'src/window.c' --- src/window.c 2012-11-02 10:34:26 +0000 +++ src/window.c 2012-11-03 05:11:34 +0000 @@ -774,8 +774,7 @@ exclude partially-visible lines, use `window-text-height'. */) (Lisp_Object window) { - struct window *w = decode_live_window (window); - return make_number (window_body_lines (w)); + return make_number (window_body_lines (decode_live_window (window))); } DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, @@ -787,8 +786,7 @@ expressed as an integer multiple of the default character width. */) (Lisp_Object window) { - struct window *w = decode_live_window (window); - return make_number (window_body_cols (w)); + return make_number (window_body_cols (decode_live_window (window))); } DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, @@ -2254,6 +2252,7 @@ { struct window *w = decode_live_window (*window); + XSETWINDOW (*window, w); /* MINIBUF nil may or may not include minibuffers. Decide if it does. */ if (NILP (*minibuf)) ------------------------------------------------------------ revno: 110777 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 21:26:25 -0400 message: Fix attribution in ChangeLog diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-11-02 23:37:02 +0000 +++ lisp/gnus/ChangeLog 2012-11-03 01:26:25 +0000 @@ -1,7 +1,7 @@ -2012-11-02 Tassilo Horn +2012-11-02 Stephen Eglen * gnus-dired.el (gnus-dired-attach): Attach to last used message buffer - by default. Patch provided by Stephen Eglen. + by default. 2012-11-02 Katsumi Yamaoka ------------------------------------------------------------ revno: 110776 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2012-11-02 23:37:02 +0000 message: Merge changes made in Gnus master 2012-10-05 Katsumi Yamaoka * gnus.texi (Mail Source Specifiers): Document :leave keyword used for pop mail source. 2012-10-25 Tassilo Horn * gnus-dired.el (gnus-dired-attach): Attach to last used message buffer by default. Patch provided by Stephen Eglen. 2012-10-05 Katsumi Yamaoka New UIDL implementation. * mail-source.el (mail-sources, mail-source-keyword-map): Add :leave as a pop3 keyword. (mail-source-fetch-pop): Bind pop3-leave-mail-on-server. * pop3.el (pop3-leave-mail-on-server): Allow number. (pop3-uidl-file, pop3-uidl-file-backup): New user options. (pop3-movemail): Add UIDL support. (pop3-send-streaming-command): Take a list of mail numbers instead of the number of mails. (pop3-write-to-file): Add X-UIDL header. (pop3-uidl-stat, pop3-uidl-dele, pop3-uidl-load, pop3-uidl-save) (pop3-uidl-add-xheader): New functions. * message.el (message-ignored-resent-headers): Add X-Content-Length and X-UIDL headers. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-11-01 07:16:32 +0000 +++ doc/misc/ChangeLog 2012-11-02 23:37:02 +0000 @@ -1,3 +1,8 @@ +2012-11-02 Katsumi Yamaoka + + * gnus.texi (Mail Source Specifiers): + Document :leave keyword used for pop mail source. + 2012-11-01 Glenn Morris * cl.texi: General copyedits for style, line-breaks, etc. === modified file 'doc/misc/gnus.texi' --- doc/misc/gnus.texi 2012-10-23 15:06:07 +0000 +++ doc/misc/gnus.texi 2012-11-02 23:37:02 +0000 @@ -14759,20 +14759,37 @@ and says what authentication scheme to use. The default is @code{password}. +@item :leave +Non-@code{nil} if the mail is to be left on the @acronym{POP} server +after fetching. Mails once fetched will never be fetched again by the +@acronym{UIDL} control. Only the built-in @code{pop3-movemail} program +(the default) supports this keyword. + +If this is neither @code{nil} nor a number, all mails will be left on +the server. If this is a number, leave mails on the server for this +many days since you first checked new mails. If this is @code{nil} +(the default), mails will be deleted on the server right after fetching. + +@vindex pop3-uidl-file +The @code{pop3-uidl-file} variable specifies the file to which the +@acronym{UIDL} data are locally stored. The default value is +@file{~/.pop3-uidl}. + +Note that @acronym{POP} servers maintain no state information between +sessions, so what the client believes is there and what is actually +there may not match up. If they do not, then you may get duplicate +mails or the whole thing can fall apart and leave you with a corrupt +mailbox. + @end table -@vindex pop3-movemail +@findex pop3-movemail @vindex pop3-leave-mail-on-server If the @code{:program} and @code{:function} keywords aren't specified, -@code{pop3-movemail} will be used. If @code{pop3-leave-mail-on-server} -is non-@code{nil} the mail is to be left on the @acronym{POP} server -after fetching when using @code{pop3-movemail}. Note that POP servers -maintain no state information between sessions, so what the client -believes is there and what is actually there may not match up. If they -do not, then you may get duplicate mails or the whole thing can fall -apart and leave you with a corrupt mailbox. +@code{pop3-movemail} will be used. Here are some examples for getting mail from a @acronym{POP} server. + Fetch from the default @acronym{POP} server, using the default user name, and default fetcher: @@ -14787,6 +14804,14 @@ :user "user-name" :password "secret") @end lisp +Leave mails on the server for 14 days: + +@lisp +(pop :server "my.pop.server" + :user "user-name" :password "secret" + :leave 14) +@end lisp + Use @samp{movemail} to move the mail: @lisp === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-10-23 15:06:07 +0000 +++ lisp/gnus/ChangeLog 2012-11-02 23:37:02 +0000 @@ -1,3 +1,28 @@ +2012-11-02 Tassilo Horn + + * gnus-dired.el (gnus-dired-attach): Attach to last used message buffer + by default. Patch provided by Stephen Eglen. + +2012-11-02 Katsumi Yamaoka + + New UIDL implementation. + + * mail-source.el (mail-sources, mail-source-keyword-map): + Add :leave as a pop3 keyword. + (mail-source-fetch-pop): Bind pop3-leave-mail-on-server. + + * pop3.el (pop3-leave-mail-on-server): Allow number. + (pop3-uidl-file, pop3-uidl-file-backup): New user options. + (pop3-movemail): Add UIDL support. + (pop3-send-streaming-command): Take a list of mail numbers instead of + the number of mails. + (pop3-write-to-file): Add X-UIDL header. + (pop3-uidl-stat, pop3-uidl-dele, pop3-uidl-load, pop3-uidl-save) + (pop3-uidl-add-xheader): New functions. + + * message.el (message-ignored-resent-headers): + Add X-Content-Length and X-UIDL headers. + 2012-10-23 Stefan Monnier * nndiary.el (nndiary-request-create-group-functions) === modified file 'lisp/gnus/gnus-dired.el' --- lisp/gnus/gnus-dired.el 2012-01-19 07:21:25 +0000 +++ lisp/gnus/gnus-dired.el 2012-11-02 23:37:02 +0000 @@ -155,8 +155,8 @@ (setq destination (if (= (length bufs) 1) (get-buffer (car bufs)) - (gnus-completing-read "Attach to which mail composition buffer" - bufs t))) + (gnus-completing-read "Attach to buffer" + bufs t nil nil (car bufs)))) ;; setup a new mail composition buffer (let ((mail-user-agent gnus-dired-mail-mode) ;; A workaround to prevent Gnus from displaying the Gnus === modified file 'lisp/gnus/mail-source.el' --- lisp/gnus/mail-source.el 2012-07-24 22:17:17 +0000 +++ lisp/gnus/mail-source.el 2012-11-02 23:37:02 +0000 @@ -63,7 +63,7 @@ This variable is a list of mail source specifiers. See Info node `(gnus)Mail Source Specifiers'." :group 'mail-source - :version "23.1" ;; No Gnus + :version "24.4" :link '(custom-manual "(gnus)Mail Source Specifiers") :type `(choice (const :tag "None" nil) @@ -159,7 +159,18 @@ :value nil (const :tag "Clear" nil) (const starttls) - (const :tag "SSL/TLS" ssl))))) + (const :tag "SSL/TLS" ssl))) + (group :inline t + (const :format "" :value :leave) + (choice :format "\ +%{Leave mail on server%}:\n\t\t%[Value Menu%] %v" + :value nil + (const :tag "\ +Don't leave mails" nil) + (const :tag "\ +Leave all mails" t) + (number :tag "\ +Leave mails for this many days" :value 14))))) (cons :tag "Maildir (qmail, postfix...)" (const :format "" maildir) (checklist :tag "Options" :greedy t @@ -340,7 +351,8 @@ (:function) (:password) (:authentication password) - (:stream nil)) + (:stream nil) + (:leave)) (maildir (:path (or (getenv "MAILDIR") "~/Maildir/")) (:subdirs ("cur" "new")) @@ -825,7 +837,8 @@ (pop3-port port) (pop3-authentication-scheme (if (eq authentication 'apop) 'apop 'pass)) - (pop3-stream-type stream)) + (pop3-stream-type stream) + (pop3-leave-mail-on-server leave)) (if (or debug-on-quit debug-on-error) (save-excursion (pop3-movemail mail-source-crash-box)) (condition-case err === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2012-09-17 11:41:39 +0000 +++ lisp/gnus/message.el 2012-11-02 23:37:02 +0000 @@ -592,8 +592,10 @@ ;; comes back to you (e.g. a mailing-list to which you subscribe, in which ;; case you may be removed from the list on the grounds that mail to you ;; bounced with a "mailing loop" error). - "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:" + "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:\ +\\|^X-Content-Length:\\|^X-UIDL:" "*All headers that match this regexp will be deleted when resending a message." + :version "24.4" :group 'message-interface :link '(custom-manual "(message)Resending") :type '(repeat :value-to-internal (lambda (widget value) === modified file 'lisp/gnus/pop3.el' --- lisp/gnus/pop3.el 2012-06-26 22:52:31 +0000 +++ lisp/gnus/pop3.el 2012-11-02 23:37:02 +0000 @@ -98,20 +98,53 @@ :group 'pop3) (defcustom pop3-leave-mail-on-server nil - "*Non-nil if the mail is to be left on the POP server after fetching. - -If `pop3-leave-mail-on-server' is non-nil the mail is to be left -on the POP server after fetching. Note that POP servers maintain -no state information between sessions, so what the client -believes is there and what is actually there may not match up. -If they do not, then you may get duplicate mails or the whole -thing can fall apart and leave you with a corrupt mailbox." - ;; We can't use the UILD support from XEmacs mail-lib or cvs.m17n.org: - ;; http://thread.gmane.org/v9lld8fml4.fsf@marauder.physik.uni-ulm.de - ;; http://thread.gmane.org/b9yy8hzy9ej.fsf@jpl.org - ;; Any volunteer to re-implement this? - :version "22.1" ;; Oort Gnus - :type 'boolean + "Non-nil if the mail is to be left on the POP server after fetching. +Mails once fetched will never be fetched again by the UIDL control. + +If this is neither nil nor a number, all mails will be left on the +server. If this is a number, leave mails on the server for this many +days since you first checked new mails. If this is nil, mails will be +deleted on the server right after fetching. + +Gnus users should use the `:leave' keyword in a mail source to direct +the behaviour per server, rather than directly modifying this value. + +Note that POP servers maintain no state information between sessions, +so what the client believes is there and what is actually there may +not match up. If they do not, then you may get duplicate mails or +the whole thing can fall apart and leave you with a corrupt mailbox." + :version "24.4" + :type '(choice (const :tag "Don't leave mails" nil) + (const :tag "Leave all mails" t) + (number :tag "Leave mails for this many days" :value 14)) + :group 'pop3) + +(defcustom pop3-uidl-file "~/.pop3-uidl" + "File used to save UIDL." + :version "24.4" + :type 'file + :group 'pop3) + +(defcustom pop3-uidl-file-backup '(0 9) + "How to backup the UIDL file `pop3-uidl-file' when updating. +If it is a list of numbers, the first one binds `kept-old-versions' and +the other binds `kept-new-versions' to keep number of oldest and newest +versions. Otherwise, the value binds `version-control' (which see). + +Note: Backup will take place whenever you check new mails on a server. +So, you may lose the backup files having been saved before a trouble +if you set it so as to make too few backups whereas you have access to +many servers." + :version "24.4" + :type '(choice (group :tag "Keep versions" :format "\n%v" :indent 3 + (number :tag "oldest") + (number :tag "newest")) + (sexp :format "%v" + :match (lambda (widget value) + (condition-case nil + (not (and (numberp (car value)) + (numberp (car (cdr value))))) + (error t))))) :group 'pop3) (defvar pop3-timestamp nil @@ -144,34 +177,66 @@ (truncate pop3-read-timeout)) 1000)))))) +(defvar pop3-uidl) +;; List of UIDLs of existing messages at pesent in the server: +;; ("UIDL1" "UIDL2" "UIDL3"...) + +(defvar pop3-uidl-saved) +;; Locally saved UIDL data; an alist of the server, the user, and the UIDL +;; and timestamp pairs: +;; (("SERVER_A" ("USER_A1" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...) +;; ("USER_A2" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...) +;; ...) +;; ("SERVER_B" ("USER_B1" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...) +;; ("USER_B2" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...) +;; ...)) +;; Where TIMESTAMP is the most significant two digits of an Emacs time, +;; i.e. the return value of `current-time'. + ;;;###autoload (defun pop3-movemail (file) "Transfer contents of a maildrop to the specified FILE. Use streaming commands." - (let* ((process (pop3-open-server pop3-mailhost pop3-port)) - message-count message-total-size) + (let ((process (pop3-open-server pop3-mailhost pop3-port)) + messages total-size + pop3-uidl + pop3-uidl-saved) (pop3-logon process) - (with-current-buffer (process-buffer process) + (if pop3-leave-mail-on-server + (setq messages (pop3-uidl-stat process) + total-size (cadr messages) + messages (car messages)) (let ((size (pop3-stat process))) - (setq message-count (car size) - message-total-size (cadr size))) - (when (> message-count 0) - (pop3-send-streaming-command - process "RETR" message-count message-total-size) - (pop3-write-to-file file) + (dotimes (i (car size)) (push (1+ i) messages)) + (setq messages (nreverse messages) + total-size (cadr size)))) + (when messages + (with-current-buffer (process-buffer process) + (pop3-send-streaming-command process "RETR" messages total-size) + (pop3-write-to-file file messages) (unless pop3-leave-mail-on-server - (pop3-send-streaming-command - process "DELE" message-count nil)))) - (pop3-quit process) + (pop3-send-streaming-command process "DELE" messages nil)))) + (if pop3-leave-mail-on-server + (when (prog1 (pop3-uidl-dele process) (pop3-quit process)) + (pop3-uidl-save)) + (pop3-quit process) + ;; Remove UIDL data for the account that got not to leave mails. + (setq pop3-uidl-saved (pop3-uidl-load)) + (let ((elt (assoc pop3-maildrop + (cdr (assoc pop3-mailhost pop3-uidl-saved))))) + (when elt + (setcdr elt nil) + (pop3-uidl-save)))) t)) -(defun pop3-send-streaming-command (process command count total-size) +(defun pop3-send-streaming-command (process command messages total-size) (erase-buffer) - (let ((i 1) + (let ((count (length messages)) + (i 1) (start-point (point-min)) (waited-for 0)) - (while (>= count i) - (process-send-string process (format "%s %d\r\n" command i)) + (while messages + (process-send-string process (format "%s %d\r\n" command (pop messages))) ;; Only do 100 messages at a time to avoid pipe stalls. (when (zerop (% i pop3-stream-length)) (setq start-point @@ -207,7 +272,7 @@ (pop3-accept-process-output process)) start-point) -(defun pop3-write-to-file (file) +(defun pop3-write-to-file (file messages) (let ((pop-buffer (current-buffer)) (start (point-min)) beg end @@ -230,6 +295,8 @@ (pop3-clean-region hstart (point)) (goto-char (point-max)) (pop3-munge-message-separator hstart (point)) + (when pop3-leave-mail-on-server + (pop3-uidl-add-xheader hstart (pop messages))) (goto-char (point-max)))))) (let ((coding-system-for-write 'binary)) (goto-char (point-min)) @@ -275,6 +342,184 @@ (pop3-quit process) message-count)) +(defun pop3-uidl-stat (process) + "Return a list of unread message numbers and total size." + (pop3-send-command process "UIDL") + (let (err messages size) + (if (condition-case code + (progn + (pop3-read-response process) + t) + (error (setq err (error-message-string code)) + nil)) + (let ((start pop3-read-point) + saved list) + (with-current-buffer (process-buffer process) + (while (not (re-search-forward "^\\.\r\n" nil t)) + (unless (memq (process-status process) '(open run)) + (error "pop3 server closed the connection")) + (pop3-accept-process-output process) + (goto-char start)) + (setq pop3-read-point (point-marker) + pop3-uidl nil) + (while (progn (forward-line -1) (>= (point) start)) + (when (looking-at "[0-9]+ \\([^\n\r ]+\\)") + (push (match-string 1) pop3-uidl))) + (when pop3-uidl + (setq pop3-uidl-saved (pop3-uidl-load) + saved (cdr (assoc pop3-maildrop + (cdr (assoc pop3-mailhost + pop3-uidl-saved))))) + (let ((i (length pop3-uidl))) + (while (> i 0) + (unless (member (nth (1- i) pop3-uidl) saved) + (push i messages)) + (decf i))) + (when messages + (setq list (pop3-list process) + size 0) + (dolist (msg messages) + (setq size (+ size (cdr (assq msg list))))) + (list messages size))))) + (message "%s doesn't support UIDL (%s), so we try a regressive way..." + pop3-mailhost err) + (sit-for 1) + (setq size (pop3-stat process)) + (dotimes (i (car size)) (push (1+ i) messages)) + (setcar size (nreverse messages)) + size))) + +(defun pop3-uidl-dele (process) + "Delete messages according to `pop3-leave-mail-on-server'. +Return non-nil if it is necessary to update the local UIDL file." + (let* ((ctime (current-time)) + (srvr (assoc pop3-mailhost pop3-uidl-saved)) + (saved (assoc pop3-maildrop (cdr srvr))) + i uidl mod new tstamp dele) + (setcdr (cdr ctime) nil) + ;; Add new messages to the data to be saved. + (cond ((and pop3-uidl saved) + (setq i (1- (length pop3-uidl))) + (while (>= i 0) + (unless (member (setq uidl (nth i pop3-uidl)) (cdr saved)) + (push ctime new) + (push uidl new)) + (decf i))) + (pop3-uidl + (setq new (apply 'nconc (mapcar (lambda (elt) (list elt ctime)) + pop3-uidl))))) + (when new (setq mod t)) + ;; List expirable messages and delete them from the data to be saved. + (setq ctime (when (numberp pop3-leave-mail-on-server) + (/ (+ (* (car ctime) 65536.0) (cadr ctime)) 86400)) + i (1- (length saved))) + (while (> i 0) + (if (member (setq uidl (nth (1- i) saved)) pop3-uidl) + (progn + (setq tstamp (nth i saved)) + (if (and ctime + (> (- ctime (/ (+ (* (car tstamp) 65536.0) (cadr tstamp)) + 86400)) + pop3-leave-mail-on-server)) + ;; Mails to delete. + (progn + (setq mod t) + (push uidl dele)) + ;; Mails to keep. + (push tstamp new) + (push uidl new))) + ;; Mails having been deleted in the server. + (setq mod t)) + (decf i 2)) + (cond (saved + (setcdr saved new)) + (srvr + (setcdr (last srvr) (list (cons pop3-maildrop new)))) + (t + (add-to-list 'pop3-uidl-saved + (list pop3-mailhost (cons pop3-maildrop new)) + t))) + ;; Actually delete the messages in the server. + (when dele + (setq uidl nil + i (length pop3-uidl)) + (while (> i 0) + (when (member (nth (1- i) pop3-uidl) dele) + (push i uidl)) + (decf i)) + (when uidl + (pop3-send-streaming-command process "DELE" uidl nil))) + mod)) + +(defun pop3-uidl-load () + "Load saved UIDL." + (when (file-exists-p pop3-uidl-file) + (with-temp-buffer + (condition-case code + (progn + (insert-file-contents pop3-uidl-file) + (goto-char (point-min)) + (read (current-buffer))) + (error + (message "Error while loading %s (%s)" + pop3-uidl-file (error-message-string code)) + (sit-for 1) + nil))))) + +(defun pop3-uidl-save () + "Save UIDL." + (with-temp-buffer + (if pop3-uidl-saved + (progn + (insert "(") + (dolist (srvr pop3-uidl-saved) + (when (cdr srvr) + (insert "(\"" (pop srvr) "\"\n ") + (dolist (elt srvr) + (when (cdr elt) + (insert "(\"" (pop elt) "\"\n ") + (while elt + (insert (format "\"%s\" %s\n " (pop elt) (pop elt)))) + (delete-char -4) + (insert ")\n "))) + (delete-char -3) + (if (eq (char-before) ?\)) + (insert ")\n ") + (goto-char (1+ (point-at-bol))) + (delete-region (point) (point-max))))) + (when (eq (char-before) ? ) + (delete-char -2)) + (insert ")\n")) + (insert "()\n")) + (let ((buffer-file-name pop3-uidl-file) + (delete-old-versions t) + (kept-new-versions kept-new-versions) + (kept-old-versions kept-old-versions) + (version-control version-control)) + (if (consp pop3-uidl-file-backup) + (setq kept-new-versions (cadr pop3-uidl-file-backup) + kept-old-versions (car pop3-uidl-file-backup) + version-control t) + (setq version-control pop3-uidl-file-backup)) + (save-buffer)))) + +(defun pop3-uidl-add-xheader (start msgno) + "Add X-UIDL header." + (let ((case-fold-search t)) + (save-restriction + (narrow-to-region start (progn + (goto-char start) + (search-forward "\n\n" nil 'move) + (1- (point)))) + (goto-char start) + (while (re-search-forward "^x-uidl:" nil t) + (while (progn + (forward-line 1) + (memq (char-after) '(?\t ? )))) + (delete-region (match-beginning 0) (point))) + (goto-char (point-max)) + (insert "X-UIDL: " (nth (1- msgno) pop3-uidl) "\n")))) + (defcustom pop3-stream-type nil "*Transport security type for POP3 connections. This may be either nil (plain connection), `ssl' (use an @@ -663,6 +908,13 @@ ;; Possible responses: ;; +OK [all delete marks removed] +;; UIDL [msg] +;; Arguments: a message-id (optional) +;; Restrictions: transaction state; msg must not be deleted +;; Possible responses: +;; +OK [uidl listing follows] +;; -ERR [no such message] + ;;; UPDATE STATE ;; QUIT ------------------------------------------------------------ revno: 110775 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 18:44:38 -0400 message: No need for filecache.el to load find-lisp when compiling * lisp/filecache.el (find-lisp-find-files): Autoload it. (file-cache-add-directory-recursively): Don't require find-lisp. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-02 22:41:35 +0000 +++ lisp/ChangeLog 2012-11-02 22:44:38 +0000 @@ -1,5 +1,9 @@ 2012-11-02 Glenn Morris + * filecache.el: No need to load find-lisp when compiling. + (find-lisp-find-files): Autoload it. + (file-cache-add-directory-recursively): Don't require find-lisp. + * image.el (image-type-from-file-name): Trivial simplification. * emacs-lisp/bytecomp.el (byte-compile-eval): === modified file 'lisp/filecache.el' --- lisp/filecache.el 2012-01-19 07:21:25 +0000 +++ lisp/filecache.el 2012-11-02 22:44:38 +0000 @@ -139,9 +139,6 @@ ;;; Code: -(eval-when-compile - (require 'find-lisp)) - (defgroup file-cache nil "Find files using a pre-loaded cache." :group 'files @@ -366,6 +363,8 @@ string) (file-cache-add-from-file-cache-buffer)) +(autoload 'find-lisp-find-files "find-lisp") + ;;;###autoload (defun file-cache-add-directory-recursively (dir &optional regexp) "Adds DIR and any subdirectories to the file-cache. @@ -374,18 +373,16 @@ will be added to the cache. Note that the REGEXP is applied to the files in each directory, not to the directory list itself." (interactive "DAdd directory: ") - (require 'find-lisp) (mapcar - (function - (lambda (file) - (or (file-directory-p file) - (let (filtered) - (dolist (regexp file-cache-filter-regexps) - (and (string-match regexp file) - (setq filtered t))) - filtered) - (file-cache-add-file file)))) - (find-lisp-find-files dir (if regexp regexp "^")))) + (lambda (file) + (or (file-directory-p file) + (let (filtered) + (dolist (regexp file-cache-filter-regexps) + (and (string-match regexp file) + (setq filtered t))) + filtered) + (file-cache-add-file file))) + (find-lisp-find-files dir (or regexp "^")))) (defun file-cache-add-from-file-cache-buffer (&optional regexp) "Add any entries found in the file cache buffer. ------------------------------------------------------------ revno: 110774 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 18:41:35 -0400 message: * lisp/image.el (image-type-from-file-name): Trivial simplification. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-02 22:35:01 +0000 +++ lisp/ChangeLog 2012-11-02 22:41:35 +0000 @@ -1,5 +1,7 @@ 2012-11-02 Glenn Morris + * image.el (image-type-from-file-name): Trivial simplification. + * emacs-lisp/bytecomp.el (byte-compile-eval): Decouple "noruntime" and "cl-functions" warnings. === modified file 'lisp/image.el' --- lisp/image.el 2012-10-23 00:46:11 +0000 +++ lisp/image.el 2012-11-02 22:41:35 +0000 @@ -309,16 +309,13 @@ Value is a symbol specifying the image type, or nil if type cannot be determined." (let (type first) - (or - (catch 'found - (dolist (elem image-type-file-name-regexps) - (when (string-match-p (car elem) file) - (setq type (cdr elem)) - (or first (setq first type)) - (if (image-type-available-p type) - (throw 'found type))))) - ;; If nothing seems to be supported, return the first type that matched. - first))) + (catch 'found + (dolist (elem image-type-file-name-regexps first) + (when (string-match-p (car elem) file) + (if (image-type-available-p (setq type (cdr elem))) + (throw 'found type) + ;; If nothing seems to be supported, return first type that matched. + (or first (setq first type)))))))) ;;;###autoload (defun image-type (source &optional type data-p) ------------------------------------------------------------ revno: 110773 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 18:35:01 -0400 message: Decouple "noruntime" and "cl-functions" bytecomp warnings * lisp/emacs-lisp/bytecomp.el (byte-compile-eval): Decouple "noruntime" and "cl-functions" warnings. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-01 02:25:08 +0000 +++ lisp/ChangeLog 2012-11-02 22:35:01 +0000 @@ -1,3 +1,8 @@ +2012-11-02 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-eval): + Decouple "noruntime" and "cl-functions" warnings. + 2012-11-01 Stephen Berman * play/gomoku.el (gomoku-display-statistics): Update mode line === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2012-10-11 20:08:38 +0000 +++ lisp/emacs-lisp/bytecomp.el 2012-11-02 22:35:01 +0000 @@ -863,16 +863,7 @@ (let ((xs (pop hist-new)) old-autoloads) ;; Make sure the file was not already loaded before. - (unless (or (assoc (car xs) hist-orig) - ;; Don't give both the "noruntime" and - ;; "cl-functions" warning for the same function. - ;; FIXME This seems incorrect - these are two - ;; independent warnings. For example, you may be - ;; choosing to see the cl warnings but ignore them. - ;; You probably don't want to ignore noruntime in the - ;; same way. - (and (byte-compile-warning-enabled-p 'cl-functions) - (byte-compile-cl-file-p (car xs)))) + (unless (assoc (car xs) hist-orig) (dolist (s xs) (cond ((and (consp s) (eq t (car s))) ------------------------------------------------------------ revno: 110772 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 18:22:11 -0400 message: Allow choice of icon style at install time This feature is intentionally not advertised http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12536#40 * Makefile.in (EMACS_ICON): New variable. (install-etc): Use EMACS_ICON to allow choice of icon. diff: === modified file 'ChangeLog' --- ChangeLog 2012-10-26 18:35:36 +0000 +++ ChangeLog 2012-11-02 22:22:11 +0000 @@ -1,3 +1,8 @@ +2012-11-02 Glenn Morris + + * Makefile.in (EMACS_ICON): New variable. + (install-etc): Use EMACS_ICON to allow choice of icon. + 2012-10-26 Glenn Morris * Makefile.in (EMACS_NAME): New variable. === modified file 'Makefile.in' --- Makefile.in 2012-10-26 18:35:36 +0000 +++ Makefile.in 2012-11-02 22:22:11 +0000 @@ -632,6 +632,11 @@ done ## Install those items from etc/ that need to end up elsewhere. + +## If you prefer, choose "emacs22" at installation time. +## Note: emacs22 does not have all the resolutions. +EMACS_ICON=emacs + install-etc: umask 022; ${MKDIR_P} $(DESTDIR)${desktopdir} tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \ @@ -646,10 +651,10 @@ for dir in */*/apps */*/mimetypes; do \ [ -d $${dir} ] || continue ; \ ( cd $${thisdir}; ${MKDIR_P} $(DESTDIR)${icondir}/$${dir} ) ; \ - for icon in $${dir}/emacs[.-]*; do \ + for icon in $${dir}/${EMACS_ICON}[.-]*; do \ [ -r $${icon} ] || continue ; \ ext=`echo "$${icon}" | sed -e 's|.*\.||'`; \ - dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\.$${ext}$$||" -e '$(TRANSFORM)'`.$${ext} ; \ + dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\.$${ext}$$||" -e 's/$(EMACS_ICON)/emacs/' -e '$(TRANSFORM)'`.$${ext} ; \ ( cd $${thisdir}; \ ${INSTALL_DATA} ${iconsrcdir}/$${icon} $(DESTDIR)${icondir}/$${dir}/$${dest} ) \ || exit 1; \ ------------------------------------------------------------ revno: 110771 fixes bug: http://debbugs.gnu.org/12733 committer: Jan D. branch nick: trunk timestamp: Thu 2012-11-01 23:44:53 +0100 message: * widget.c (resize_cb): New function. (EmacsFrameRealize): Add resize_cb as event handler. (EmacsFrameResize): Check if all is up to date before changing frame size. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-02 14:00:45 +0000 +++ src/ChangeLog 2012-11-01 22:44:53 +0000 @@ -1,3 +1,10 @@ +2012-11-01 Jan Djärv + + * widget.c (resize_cb): New function. + (EmacsFrameRealize): Add resize_cb as event handler (Bug#12733). + (EmacsFrameResize): Check if all is up to date before changing frame + size. + 2012-11-02 Eli Zaretskii Implement backtrace output for fatal errors on MS-Windows. === modified file 'src/widget.c' --- src/widget.c 2012-09-23 08:44:20 +0000 +++ src/widget.c 2012-11-01 22:44:53 +0000 @@ -650,6 +650,16 @@ set_frame_size (ew); } +static void +resize_cb (Widget widget, + XtPointer closure, + XEvent* event, + Boolean* continue_to_dispatch) +{ + EmacsFrame ew = (EmacsFrame) widget; + EmacsFrameResize (widget); +} + static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) @@ -665,6 +675,9 @@ *mask |= CWEventMask; XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, attrs); + /* Some ConfigureNotify events does not end up in EmacsFrameResize so + make sure we get them all. Seen with xfcwm4 for example. */ + XtAddRawEventHandler (widget, StructureNotifyMask, False, resize_cb, NULL); update_wm_hints (ew); } @@ -691,15 +704,22 @@ { EmacsFrame ew = (EmacsFrame)widget; struct frame *f = ew->emacs_frame.frame; + struct x_output *x = f->output_data.x; int columns; int rows; pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows); - change_frame_size (f, rows, columns, 0, 1, 0); - update_wm_hints (ew); - update_various_frame_slots (ew); + if (columns != FRAME_COLS (f) + || rows != FRAME_LINES (f) + || ew->core.width != FRAME_PIXEL_WIDTH (f) + || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f)) + { + change_frame_size (f, rows, columns, 0, 1, 0); + update_wm_hints (ew); + update_various_frame_slots (ew); - cancel_mouse_face (f); + cancel_mouse_face (f); + } } static Boolean ------------------------------------------------------------ revno: 110770 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 09:14:06 -0700 message: Add NEWS top-level headings for 24.4. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-31 07:25:18 +0000 +++ etc/NEWS 2012-11-02 16:14:06 +0000 @@ -21,6 +21,17 @@ so we will look at it and add it to the manual. +* Installation Changes in Emacs 24.4 +* Startup Changes in Emacs 24.4 +* Changes in Emacs 24.4 +* Editing Changes in Emacs 24.4 +* Changes in Specialized Modes and Packages in Emacs 24.4 +* New Modes and Packages in Emacs 24.4 +* Incompatible Lisp Changes in Emacs 24.4 +* Lisp changes in Emacs 24.4 +* Changes in Emacs 24.4 on non-free operating systems + + * Installation Changes in Emacs 24.3 --- ------------------------------------------------------------ revno: 110769 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2012-11-02 16:00:45 +0200 message: Implement backtrace output for fatal errors on MS-Windows. src/w32fns.c (CaptureStackBackTrace_proc): New typedef. (BACKTRACE_LIMIT_MAX): New macro. (w32_backtrace): New function. (emacs_abort): Use w32_backtrace when the user chooses not to attach a debugger. Update the text of the abort dialog. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-02 10:34:26 +0000 +++ src/ChangeLog 2012-11-02 14:00:45 +0000 @@ -1,3 +1,12 @@ +2012-11-02 Eli Zaretskii + + Implement backtrace output for fatal errors on MS-Windows. + * w32fns.c (CaptureStackBackTrace_proc): New typedef. + (BACKTRACE_LIMIT_MAX): New macro. + (w32_backtrace): New function. + (emacs_abort): Use w32_backtrace when the user chooses not to + attach a debugger. Update the text of the abort dialog. + 2012-11-02 Dmitry Antipov Window-related stuff cleanup here and there. === modified file 'src/w32fns.c' --- src/w32fns.c 2012-10-26 09:46:46 +0000 +++ src/w32fns.c 2012-11-02 14:00:45 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include "lisp.h" #include "w32term.h" @@ -7697,6 +7698,30 @@ syms_of_w32uniscribe (); } +typedef USHORT (WINAPI * CaptureStackBackTrace_proc) (ULONG, ULONG, PVOID *, + PULONG); + +#define BACKTRACE_LIMIT_MAX 62 + +int +w32_backtrace (void **buffer, int limit) +{ + static CaptureStackBackTrace_proc s_pfn_CaptureStackBackTrace = NULL; + HMODULE hm_kernel32 = NULL; + + if (!s_pfn_CaptureStackBackTrace) + { + hm_kernel32 = LoadLibrary ("Kernel32.dll"); + s_pfn_CaptureStackBackTrace = + (CaptureStackBackTrace_proc) GetProcAddress (hm_kernel32, + "RtlCaptureStackBackTrace"); + } + if (s_pfn_CaptureStackBackTrace) + return s_pfn_CaptureStackBackTrace (0, min (BACKTRACE_LIMIT_MAX, limit), + buffer, NULL); + return 0; +} + void emacs_abort (void) { @@ -7704,7 +7729,10 @@ button = MessageBox (NULL, "A fatal error has occurred!\n\n" "Would you like to attach a debugger?\n\n" - "Select YES to debug, NO to abort Emacs" + "Select:\n" + "YES -- to debug Emacs, or\n" + "NO -- to abort Emacs and produce a backtrace\n" + " (emacs_backtrace.txt in current directory)." #if __GNUC__ "\n\n(type \"gdb -p \" and\n" "\"continue\" inside GDB before clicking YES.)" @@ -7719,7 +7747,52 @@ exit (2); /* tell the compiler we will never return */ case IDNO: default: - abort (); - break; + { + void *stack[BACKTRACE_LIMIT_MAX + 1]; + int i = w32_backtrace (stack, BACKTRACE_LIMIT_MAX + 1); + + if (i) + { + HANDLE errout = GetStdHandle (STD_ERROR_HANDLE); + int stderr_fd = -1, errfile_fd = -1; + int j; + + if (errout && errout != INVALID_HANDLE_VALUE) + stderr_fd = _open_osfhandle ((intptr_t)errout, O_APPEND | O_BINARY); + if (stderr_fd >= 0) + write (stderr_fd, "\r\nBacktrace:\r\n", 14); + errfile_fd = _open ("emacs_backtrace.txt", O_RDWR | O_CREAT | O_BINARY, S_IREAD | S_IWRITE); + if (errfile_fd >= 0) + { + lseek (errfile_fd, 0L, SEEK_END); + write (errfile_fd, "\r\nBacktrace:\r\n", 14); + } + + for (j = 0; j < i; j++) + { + char buf[INT_BUFSIZE_BOUND (void *)]; + + /* stack[] gives the return addresses, whereas we want + the address of the call, so decrease each address + by approximate size of 1 CALL instruction. */ + sprintf (buf, "0x%p\r\n", stack[j] - sizeof(void *)); + if (stderr_fd >= 0) + write (stderr_fd, buf, strlen (buf)); + if (errfile_fd >= 0) + write (errfile_fd, buf, strlen (buf)); + } + if (i == BACKTRACE_LIMIT_MAX) + { + if (stderr_fd >= 0) + write (stderr_fd, "...\r\n", 5); + if (errfile_fd >= 0) + write (errfile_fd, "...\r\n", 5); + } + if (errfile_fd >= 0) + close (errfile_fd); + } + abort (); + break; + } } } ------------------------------------------------------------ revno: 110768 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-11-02 14:34:26 +0400 message: Window-related stuff cleanup here and there. * dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p): Use decode_any_window. * fringe.c (Ffringe_bitmaps_at_pos): Likewise. * xdisp.c (Fformat_mode_line): Likewise. * font.c (Ffont_at): Use decode_live_window. * indent.c (Fcompute_motion, Fvertical_motion): Likewise. * window.c (decode_next_window_args): Likewise. (decode_any_window): Remove static. * window.h (decode_any_window): Add prototype. * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here... * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P, respectively. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-02 09:44:08 +0000 +++ src/ChangeLog 2012-11-02 10:34:26 +0000 @@ -1,5 +1,21 @@ 2012-11-02 Dmitry Antipov + Window-related stuff cleanup here and there. + * dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p): + Use decode_any_window. + * fringe.c (Ffringe_bitmaps_at_pos): Likewise. + * xdisp.c (Fformat_mode_line): Likewise. + * font.c (Ffont_at): Use decode_live_window. + * indent.c (Fcompute_motion, Fvertical_motion): Likewise. + * window.c (decode_next_window_args): Likewise. + (decode_any_window): Remove static. + * window.h (decode_any_window): Add prototype. + * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here... + * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P, + respectively. + +2012-11-02 Dmitry Antipov + Remove pad from struct input_event. * termhooks.h (struct input_event): Remove padding field. Adjust comment. === modified file 'src/dispnew.c' --- src/dispnew.c 2012-10-31 17:27:29 +0000 +++ src/dispnew.c 2012-11-02 10:34:26 +0000 @@ -6375,15 +6375,7 @@ /* Don't change cursor state while redisplaying. This could confuse output routines. */ if (!redisplaying_p) - { - if (NILP (window)) - window = selected_window; - else - CHECK_WINDOW (window); - - XWINDOW (window)->cursor_off_p = NILP (show); - } - + decode_any_window (window)->cursor_off_p = NILP (show); return Qnil; } @@ -6394,15 +6386,7 @@ WINDOW nil or omitted means report on the selected window. */) (Lisp_Object window) { - struct window *w; - - if (NILP (window)) - window = selected_window; - else - CHECK_WINDOW (window); - - w = XWINDOW (window); - return w->cursor_off_p ? Qnil : Qt; + return decode_any_window (window)->cursor_off_p ? Qnil : Qt; } DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame, === modified file 'src/font.c' --- src/font.c 2012-10-30 11:14:15 +0000 +++ src/font.c 2012-11-02 10:34:26 +0000 @@ -4765,13 +4765,9 @@ character at index specified by POSITION. */) (Lisp_Object position, Lisp_Object window, Lisp_Object string) { - struct window *w; + struct window *w = decode_live_window (window); ptrdiff_t pos; - if (NILP (window)) - window = selected_window; - CHECK_LIVE_WINDOW (window); - w = XWINDOW (window); if (NILP (string)) { if (XBUFFER (w->buffer) != current_buffer) === modified file 'src/fringe.c' --- src/fringe.c 2012-09-23 08:44:20 +0000 +++ src/fringe.c 2012-11-02 10:34:26 +0000 @@ -1731,10 +1731,8 @@ struct glyph_row *row; ptrdiff_t textpos; - if (NILP (window)) - window = selected_window; - CHECK_WINDOW (window); - w = XWINDOW (window); + w = decode_any_window (window); + XSETWINDOW (window, w); if (!NILP (pos)) { === modified file 'src/indent.c' --- src/indent.c 2012-10-16 07:56:44 +0000 +++ src/indent.c 2012-11-02 10:34:26 +0000 @@ -1764,11 +1764,7 @@ else hscroll = tab_offset = 0; - if (NILP (window)) - window = Fselected_window (); - else - CHECK_LIVE_WINDOW (window); - w = XWINDOW (window); + w = decode_live_window (window); if (XINT (from) < BEGV || XINT (from) > ZV) args_out_of_range_3 (from, make_number (BEGV), make_number (ZV)); @@ -1790,8 +1786,7 @@ 1)) : XINT (XCAR (topos))), (NILP (width) ? -1 : XINT (width)), - hscroll, tab_offset, - XWINDOW (window)); + hscroll, tab_offset, w); XSETFASTINT (bufpos, pos->bufpos); XSETINT (hpos, pos->hpos); @@ -1988,11 +1983,7 @@ } CHECK_NUMBER (lines); - if (! NILP (window)) - CHECK_WINDOW (window); - else - window = selected_window; - w = XWINDOW (window); + w = decode_live_window (window); old_buffer = Qnil; GCPRO3 (old_buffer, old_charpos, old_bytepos); === modified file 'src/lisp.h' --- src/lisp.h 2012-10-31 17:27:29 +0000 +++ src/lisp.h 2012-11-02 10:34:26 +0000 @@ -1791,20 +1791,6 @@ #define CHECK_WINDOW_CONFIGURATION(x) \ CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x) -/* A window of any sort, leaf or interior, is "valid" if one of its - buffer, vchild, or hchild members is non-nil. */ -#define CHECK_VALID_WINDOW(x) \ - CHECK_TYPE (WINDOWP (x) \ - && (!NILP (XWINDOW (x)->buffer) \ - || !NILP (XWINDOW (x)->vchild) \ - || !NILP (XWINDOW (x)->hchild)), \ - Qwindow_valid_p, x) - -/* A window is "live" if and only if it shows a buffer. */ -#define CHECK_LIVE_WINDOW(x) \ - CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \ - Qwindow_live_p, x) - #define CHECK_PROCESS(x) \ CHECK_TYPE (PROCESSP (x), Qprocessp, x) === modified file 'src/window.c' --- src/window.c 2012-10-18 08:27:49 +0000 +++ src/window.c 2012-11-02 10:34:26 +0000 @@ -244,7 +244,7 @@ return XWINDOW (window); } -static struct window * +struct window * decode_any_window (register Lisp_Object window) { struct window *w; @@ -2252,10 +2252,7 @@ static void decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames) { - if (NILP (*window)) - *window = selected_window; - else - CHECK_LIVE_WINDOW (*window); + struct window *w = decode_live_window (*window); /* MINIBUF nil may or may not include minibuffers. Decide if it does. */ @@ -2272,7 +2269,7 @@ if (NILP (*all_frames)) *all_frames = (!EQ (*minibuf, Qlambda) - ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) + ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame)) : Qnil); else if (EQ (*all_frames, Qvisible)) ; === modified file 'src/window.h' --- src/window.h 2012-09-20 03:10:52 +0000 +++ src/window.h 2012-11-02 10:34:26 +0000 @@ -970,17 +970,26 @@ || !NILP (XWINDOW (WINDOW)->vchild) \ || !NILP (XWINDOW (WINDOW)->hchild))) +/* A window of any sort, leaf or interior, is "valid" if one + of its buffer, vchild, or hchild members is non-nil. */ +#define CHECK_VALID_WINDOW(WINDOW) \ + CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW) /* Value is non-zero if WINDOW is a live window. */ #define WINDOW_LIVE_P(WINDOW) \ (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) +/* A window is "live" if and only if it shows a buffer. */ +#define CHECK_LIVE_WINDOW(WINDOW) \ + CHECK_TYPE (WINDOW_LIVE_P (WINDOW), Qwindow_live_p, WINDOW) + /* These used to be in lisp.h. */ extern Lisp_Object Qwindowp, Qwindow_live_p; extern Lisp_Object Vwindow_list; extern struct window *decode_live_window (Lisp_Object); +extern struct window *decode_any_window (Lisp_Object); extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool); extern void mark_window_cursors_off (struct window *); extern int window_internal_height (struct window *); === modified file 'src/xdisp.c' --- src/xdisp.c 2012-10-20 21:30:51 +0000 +++ src/xdisp.c 2012-11-02 10:34:26 +0000 @@ -21018,10 +21018,8 @@ Lisp_Object str; int string_start = 0; - if (NILP (window)) - window = selected_window; - CHECK_WINDOW (window); - w = XWINDOW (window); + w = decode_any_window (window); + XSETWINDOW (window, w); if (NILP (buffer)) buffer = w->buffer; @@ -21050,7 +21048,7 @@ and set that to nil so that we don't alter the outer value. */ record_unwind_protect (unwind_format_mode_line, format_mode_line_unwind_data - (XFRAME (WINDOW_FRAME (XWINDOW (window))), + (XFRAME (WINDOW_FRAME (w)), old_buffer, selected_window, 1)); mode_line_proptrans_alist = Qnil; ------------------------------------------------------------ revno: 110767 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-11-02 06:17:32 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2012-10-09 10:17:32 +0000 +++ autogen/configure 2012-11-02 10:17:32 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for emacs 24.2.50. +# Generated by GNU Autoconf 2.65 for emacs 24.3.50. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -549,8 +549,8 @@ # Identity of this package. PACKAGE_NAME='emacs' PACKAGE_TARNAME='emacs' -PACKAGE_VERSION='24.2.50' -PACKAGE_STRING='emacs 24.2.50' +PACKAGE_VERSION='24.3.50' +PACKAGE_STRING='emacs 24.3.50' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1940,7 +1940,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures emacs 24.2.50 to adapt to many kinds of systems. +\`configure' configures emacs 24.3.50 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2014,7 +2014,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of emacs 24.2.50:";; + short | recursive ) echo "Configuration of emacs 24.3.50:";; esac cat <<\_ACEOF @@ -2181,7 +2181,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -emacs configure 24.2.50 +emacs configure 24.3.50 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2903,7 +2903,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by emacs $as_me 24.2.50, which was +It was created by emacs $as_me 24.3.50, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -3764,7 +3764,7 @@ # Define the identity of the package. PACKAGE='emacs' - VERSION='24.2.50' + VERSION='24.3.50' cat >>confdefs.h <<_ACEOF @@ -25481,7 +25481,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by emacs $as_me 24.2.50, which was +This file was extended by emacs $as_me 24.3.50, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -25547,7 +25547,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -emacs config.status 24.2.50 +emacs config.status 24.3.50 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" ------------------------------------------------------------ revno: 110766 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-11-02 13:44:08 +0400 message: Remove pad from struct input_event. * termhooks.h (struct input_event): Remove padding field. Adjust comment. * keyboard.c (event_to_kboard): Simplify because frame_or_window member is never cons for a long time. Adjust comment. (mark_kboards): Adjust because SELECTION_REQUEST_EVENT and SELECTION_CLEAR_EVENT has no Lisp_Objects to mark. Add comment. * xterm.c (handle_one_xevent): Do not initialize frame_or_window field of SELECTION_REQUEST_EVENT and SELECTION_CLEAR_EVENT. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-01 14:21:45 +0000 +++ src/ChangeLog 2012-11-02 09:44:08 +0000 @@ -1,3 +1,15 @@ +2012-11-02 Dmitry Antipov + + Remove pad from struct input_event. + * termhooks.h (struct input_event): Remove padding field. + Adjust comment. + * keyboard.c (event_to_kboard): Simplify because frame_or_window + member is never cons for a long time. Adjust comment. + (mark_kboards): Adjust because SELECTION_REQUEST_EVENT and + SELECTION_CLEAR_EVENT has no Lisp_Objects to mark. Add comment. + * xterm.c (handle_one_xevent): Do not initialize frame_or_window + field of SELECTION_REQUEST_EVENT and SELECTION_CLEAR_EVENT. + 2012-11-01 Eli Zaretskii * w32proc.c (getpgrp, setpgid): New functions. (Bug#12776) === modified file 'src/keyboard.c' --- src/keyboard.c 2012-10-20 21:30:51 +0000 +++ src/keyboard.c 2012-11-02 09:44:08 +0000 @@ -3416,20 +3416,13 @@ static KBOARD * event_to_kboard (struct input_event *event) { - Lisp_Object frame; - frame = event->frame_or_window; - if (CONSP (frame)) - frame = XCAR (frame); - else if (WINDOWP (frame)) - frame = WINDOW_FRAME (XWINDOW (frame)); - - /* There are still some events that don't set this field. - For now, just ignore the problem. - Also ignore dead frames here. */ - if (!FRAMEP (frame) || !FRAME_LIVE_P (XFRAME (frame))) - return 0; - else - return FRAME_KBOARD (XFRAME (frame)); + Lisp_Object obj = event->frame_or_window; + /* There are some events that set this field to nil or string. */ + if (WINDOWP (obj)) + obj = WINDOW_FRAME (XWINDOW (obj)); + /* Also ignore dead frames here. */ + return ((FRAMEP (obj) && FRAME_LIVE_P (XFRAME (obj))) + ? FRAME_KBOARD (XFRAME (obj)) : NULL); } #ifdef subprocesses @@ -12173,14 +12166,15 @@ { if (event == kbd_buffer + KBD_BUFFER_SIZE) event = kbd_buffer; + /* These two special event types has no Lisp_Objects to mark. */ if (event->kind != SELECTION_REQUEST_EVENT && event->kind != SELECTION_CLEAR_EVENT) { mark_object (event->x); mark_object (event->y); + mark_object (event->frame_or_window); + mark_object (event->arg); } - mark_object (event->frame_or_window); - mark_object (event->arg); } } } === modified file 'src/termhooks.h' --- src/termhooks.h 2012-10-08 22:14:39 +0000 +++ src/termhooks.h 2012-11-02 09:44:08 +0000 @@ -242,16 +242,8 @@ Lisp_Object x, y; Time timestamp; - /* This is padding just to put the frame_or_window field - past the size of struct selection_input_event. */ - int *padding[2]; - - /* This field is copied into a vector while the event is in the queue, - so that garbage collections won't kill it. */ - /* In a menu_bar_event, this is a cons cell whose car is the frame - and whose cdr is the Lisp object that is the event's value. */ - /* This field is last so that struct selection_input_event - does not overlap with it. */ + /* This field is copied into a vector while the event is in + the queue, so that garbage collections won't kill it. */ Lisp_Object frame_or_window; /* Additional event argument. This is used for TOOL_BAR_EVENTs and === modified file 'src/xterm.c' --- src/xterm.c 2012-10-31 19:23:06 +0000 +++ src/xterm.c 2012-11-02 09:44:08 +0000 @@ -6108,7 +6108,6 @@ SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; SELECTION_EVENT_TIME (&inev.sie) = eventp->time; - inev.ie.frame_or_window = Qnil; } break; @@ -6128,7 +6127,6 @@ SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property; SELECTION_EVENT_TIME (&inev.sie) = eventp->time; - inev.ie.frame_or_window = Qnil; } break; ------------------------------------------------------------ revno: 110765 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-11-02 08:48:12 +0800 message: Bump version to 24.3.50 diff: === modified file 'README' --- README 2012-09-10 01:03:27 +0000 +++ README 2012-11-02 00:48:12 +0000 @@ -2,7 +2,7 @@ See the end of the file for license conditions. -This directory tree holds version 24.2.50 of GNU Emacs, the extensible, +This directory tree holds version 24.3.50 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU === modified file 'configure.ac' --- configure.ac 2012-10-23 19:39:36 +0000 +++ configure.ac 2012-11-02 00:48:12 +0000 @@ -22,7 +22,7 @@ dnl along with GNU Emacs. If not, see . AC_PREREQ(2.65) -AC_INIT(emacs, 24.2.50) +AC_INIT(emacs, 24.3.50) AC_CONFIG_HEADER(src/config.h:src/config.in) AC_CONFIG_SRCDIR(src/lisp.h) AC_CONFIG_AUX_DIR(build-aux) === modified file 'doc/emacs/emacsver.texi' --- doc/emacs/emacsver.texi 2012-08-28 16:01:59 +0000 +++ doc/emacs/emacsver.texi 2012-11-02 00:48:12 +0000 @@ -1,4 +1,4 @@ @c It would be nicer to generate this using configure and @version@. @c However, that would mean emacsver.texi would always be newer @c then the info files in release tarfiles. -@set EMACSVER 24.2.50 +@set EMACSVER 24.3.50 === modified file 'doc/man/emacs.1' --- doc/man/emacs.1 2012-08-28 16:01:59 +0000 +++ doc/man/emacs.1 2012-11-02 00:48:12 +0000 @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH EMACS 1 "2007 April 13" "GNU Emacs 24.2.50" +.TH EMACS 1 "2007 April 13" "GNU Emacs 24.3.50" . . .SH NAME === modified file 'msdos/sed2v2.inp' --- msdos/sed2v2.inp 2012-08-28 16:01:59 +0000 +++ msdos/sed2v2.inp 2012-11-02 00:48:12 +0000 @@ -70,7 +70,7 @@ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ /^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION ""/ -/^#undef VERSION/s/^.*$/#define VERSION "24.2.50"/ +/^#undef VERSION/s/^.*$/#define VERSION "24.3.50"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ === modified file 'nt/config.nt' --- nt/config.nt 2012-11-01 14:21:45 +0000 +++ nt/config.nt 2012-11-02 00:48:12 +0000 @@ -1399,7 +1399,7 @@ #undef USG_SUBTTY_WORKS /* Version number of package */ -#define VERSION "24.2.50" +#define VERSION "24.3.50" /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wchar_t'. */ === modified file 'nt/emacs.rc' --- nt/emacs.rc 2012-09-30 21:36:42 +0000 +++ nt/emacs.rc 2012-11-02 00:48:12 +0000 @@ -11,8 +11,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 24,2,50,0 - PRODUCTVERSION 24,2,50,0 + FILEVERSION 24,3,50,0 + PRODUCTVERSION 24,3,50,0 FILEFLAGSMASK 0x3FL #ifdef EMACSDEBUG FILEFLAGS 0x1L @@ -29,12 +29,12 @@ BEGIN VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0" - VALUE "FileVersion", "24, 2, 50, 0\0" + VALUE "FileVersion", "24, 3, 50, 0\0" VALUE "InternalName", "Emacs\0" VALUE "LegalCopyright", "Copyright (C) 2001-2012\0" VALUE "OriginalFilename", "emacs.exe" VALUE "ProductName", "Emacs\0" - VALUE "ProductVersion", "24, 2, 50, 0\0" + VALUE "ProductVersion", "24, 3, 50, 0\0" VALUE "OLESelfRegister", "\0" END END === modified file 'nt/emacsclient.rc' --- nt/emacsclient.rc 2012-08-28 16:01:59 +0000 +++ nt/emacsclient.rc 2012-11-02 00:48:12 +0000 @@ -5,8 +5,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 24,2,50,0 - PRODUCTVERSION 24,2,50,0 + FILEVERSION 24,3,50,0 + PRODUCTVERSION 24,3,50,0 FILEFLAGSMASK 0x3FL #ifdef EMACSDEBUG FILEFLAGS 0x1L @@ -23,12 +23,12 @@ BEGIN VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0" - VALUE "FileVersion", "24, 2, 50, 0\0" + VALUE "FileVersion", "24, 3, 50, 0\0" VALUE "InternalName", "EmacsClient\0" VALUE "LegalCopyright", "Copyright (C) 2001-2012\0" VALUE "OriginalFilename", "emacsclientw.exe" VALUE "ProductName", "EmacsClient\0" - VALUE "ProductVersion", "24, 2, 50, 0\0" + VALUE "ProductVersion", "24, 3, 50, 0\0" VALUE "OLESelfRegister", "\0" END END === modified file 'nt/makefile.w32-in' --- nt/makefile.w32-in 2012-09-30 21:36:42 +0000 +++ nt/makefile.w32-in 2012-11-02 00:48:12 +0000 @@ -22,7 +22,7 @@ # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out # (and remove or replace this comment). -VERSION = 24.2.50 +VERSION = 24.3.50 TMP_DIST_DIR = emacs-$(VERSION)