Now on revision 110110. ------------------------------------------------------------ revno: 110110 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-09-20 12:29:04 +0800 message: * vc/diff.el (diff-latest-backup-file): Autoload. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-20 03:44:57 +0000 +++ lisp/ChangeLog 2012-09-20 04:29:04 +0000 @@ -1,3 +1,7 @@ +2012-09-20 Chong Yidong + + * vc/diff.el (diff-latest-backup-file): Autoload. + 2012-09-20 Stefan Monnier * calc/calc.el: Remove redundant autoload shape check. === modified file 'lisp/vc/diff.el' --- lisp/vc/diff.el 2012-07-10 11:51:54 +0000 +++ lisp/vc/diff.el 2012-09-20 04:29:04 +0000 @@ -197,7 +197,8 @@ ori file)) (diff bak ori switches))) -(defun diff-latest-backup-file (fn) ; actually belongs into files.el +;;;###autoload +(defun diff-latest-backup-file (fn) "Return the latest existing backup of FILE, or nil." (let ((handler (find-file-name-handler fn 'diff-latest-backup-file))) (if handler ------------------------------------------------------------ revno: 110109 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-19 23:44:57 -0400 message: * lisp/calc/calc.el: Remove redundant autoload shape check. (sel-mode): Don't defvar. (calc-get-stack-element): Add `sel-mode' arg instead. (calc-top, calc-top-list): Pass it this additional argument. * lisp/calc/calc-store.el (calc-store-map): * lisp/calc/calc-map.el (calc-apply, calc-reduce, calc-map) (calc-map-equation, calc-outer-product, calc-inner-product): * lisp/calc/calc-aent.el (calc-alg-entry): Don't bind sel-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-20 03:29:41 +0000 +++ lisp/ChangeLog 2012-09-20 03:44:57 +0000 @@ -1,5 +1,14 @@ 2012-09-20 Stefan Monnier + * calc/calc.el: Remove redundant autoload shape check. + (sel-mode): Don't defvar. + (calc-get-stack-element): Add `sel-mode' arg instead. + (calc-top, calc-top-list): Pass it this additional argument. + * calc/calc-store.el (calc-store-map): + * calc/calc-map.el (calc-apply, calc-reduce, calc-map) + (calc-map-equation, calc-outer-product, calc-inner-product): + * calc/calc-aent.el (calc-alg-entry): Don't bind sel-mode. + * emacs-lisp/macroexp.el (macroexp--expand-all): Fix last change. 2012-09-19 Juri Linkov === modified file 'lisp/calc/calc-aent.el' --- lisp/calc/calc-aent.el 2012-01-19 07:21:25 +0000 +++ lisp/calc/calc-aent.el 2012-09-20 03:44:57 +0000 @@ -286,8 +286,7 @@ ;;;###autoload (defun calc-alg-entry (&optional initial prompt) - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-plain-entry t) === modified file 'lisp/calc/calc-map.el' --- lisp/calc/calc-map.el 2012-01-19 07:21:25 +0000 +++ lisp/calc/calc-map.el 2012-09-20 03:44:57 +0000 @@ -32,8 +32,7 @@ (defun calc-apply (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Apply" @@ -53,11 +52,10 @@ (defun calc-reduce (&optional oper accum) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (nest (calc-is-hyperbolic)) + (let* ((nest (calc-is-hyperbolic)) (rev (calc-is-inverse)) (nargs (if (and nest (not rev)) 2 1)) - (calc-dollar-values (mapcar 'calc-get-stack-element + (calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-mapping-dir (and (not accum) (not nest) "")) @@ -99,8 +97,7 @@ (defun calc-map (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-mapping-dir "") @@ -120,8 +117,7 @@ (defun calc-map-equation (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Map-equation"))) @@ -152,8 +148,7 @@ (defun calc-outer-product (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Outer" 2)))) @@ -170,8 +165,7 @@ (defun calc-inner-product (&optional mul-oper add-oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (mul-oper (or mul-oper (calc-get-operator "Inner (Mult)" 2))) === modified file 'lisp/calc/calc-store.el' --- lisp/calc/calc-store.el 2012-01-19 07:21:25 +0000 +++ lisp/calc/calc-store.el 2012-09-20 03:44:57 +0000 @@ -235,8 +235,7 @@ (defun calc-store-map (&optional oper var) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Store Mapping"))) === modified file 'lisp/calc/calc.el' --- lisp/calc/calc.el 2012-09-13 18:41:21 +0000 +++ lisp/calc/calc.el 2012-09-20 03:44:57 +0000 @@ -914,8 +914,7 @@ ;; Set up the autoloading linkage. (let ((name (and (fboundp 'calc-dispatch) - (autoloadp (symbol-function 'calc-dispatch)) - (nth 1 (symbol-function 'calc-dispatch)))) + (autoloadp (symbol-function 'calc-dispatch)))) (p load-path)) ;; If Calc files exist on the load-path, we're all set. @@ -1353,12 +1352,12 @@ \\{calc-mode-map} " (interactive) - (mapc (function + (mapc (function ;FIXME: Why (set-default v (symbol-value v)) ?!?!? (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) (kill-all-local-variables) (use-local-map (if (eq calc-algebraic-mode 'total) (progn (require 'calc-ext) calc-alg-map) calc-mode-map)) - (mapc (function (lambda (v) (make-local-variable v))) calc-local-var-list) + (mapc #'make-local-variable calc-local-var-list) (make-local-variable 'overlay-arrow-position) (make-local-variable 'overlay-arrow-string) (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) @@ -1395,7 +1394,7 @@ (if calc-buffer-list (setq calc-stack (copy-sequence calc-stack))) (add-to-list 'calc-buffer-list (current-buffer) t)) -(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks +(defvar calc-check-defines 'calc-check-defines) ; Suitable for run-hooks. (defun calc-check-defines () (if (symbol-plist 'calc-define) (let ((plist (copy-sequence (symbol-plist 'calc-define)))) @@ -1943,8 +1942,7 @@ (delete-region (point) (point-max)))) (calc-set-command-flag 'renum-stack)))))) -(defvar sel-mode) -(defun calc-get-stack-element (x) +(defun calc-get-stack-element (x &optional sel-mode) (cond ((eq sel-mode 'entry) x) ((eq sel-mode 'sel) @@ -1961,9 +1959,9 @@ (defun calc-top (&optional n sel-mode) (or n (setq n 1)) (calc-check-stack n) - (calc-get-stack-element (nth (+ n calc-stack-top -1) calc-stack))) + (calc-get-stack-element (nth (+ n calc-stack-top -1) calc-stack) sel-mode)) -(defun calc-top-n (&optional n sel-mode) ; in case precision has changed +(defun calc-top-n (&optional n sel-mode) ; In case precision has changed. (math-check-complete (calc-normalize (calc-top n sel-mode)))) (defun calc-top-list (&optional n m sel-mode) @@ -1974,7 +1972,8 @@ (let ((top (copy-sequence (nthcdr (+ m calc-stack-top -1) calc-stack)))) (setcdr (nthcdr (1- n) top) nil) - (nreverse (mapcar 'calc-get-stack-element top))))) + (nreverse + (mapcar (lambda (x) (calc-get-stack-element x sel-mode)) top))))) (defun calc-top-list-n (&optional n m sel-mode) (mapcar 'math-check-complete ------------------------------------------------------------ revno: 110108 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-19 23:29:41 -0400 message: * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Fix last change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 20:09:55 +0000 +++ lisp/ChangeLog 2012-09-20 03:29:41 +0000 @@ -1,3 +1,7 @@ +2012-09-20 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexp--expand-all): Fix last change. + 2012-09-19 Juri Linkov * dired-aux.el (dired-diff): Add (require 'diff) because === modified file 'lisp/emacs-lisp/macroexp.el' --- lisp/emacs-lisp/macroexp.el 2012-09-19 19:59:52 +0000 +++ lisp/emacs-lisp/macroexp.el 2012-09-20 03:29:41 +0000 @@ -149,7 +149,7 @@ (symbolp (car form)) (get (car form) 'byte-obsolete-info)) (macroexp--funcall-and-return - (lambda () (byte-compile-warn-obsolete ',(car form))) + (lambda () (byte-compile-warn-obsolete (car form))) #'ignore ;FIXME: We should `message' something. new-form) new-form))) ------------------------------------------------------------ revno: 110107 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-19 23:10:52 -0400 message: * src/alloc.c (mark_object) : Mark prev/next_buffers *after* calling mark_vectorlike since that's the one that marks the window. (mark_discard_killed_buffers): Mark the final cdr. * src/window.h (struct window): Move prev/next_buffers to the non-standard fields. * src/window.c (make_window): Initialize prev/next_buffers manually. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-20 01:37:07 +0000 +++ src/ChangeLog 2012-09-20 03:10:52 +0000 @@ -1,3 +1,12 @@ +2012-09-20 Stefan Monnier + + * alloc.c (mark_object) : Mark prev/next_buffers *after* + calling mark_vectorlike since that's the one that marks the window. + (mark_discard_killed_buffers): Mark the final cdr. + * window.h (struct window): Move prev/next_buffers to the + non-standard fields. + * window.c (make_window): Initialize prev/next_buffers manually. + 2012-09-20 Paul Eggert Omit unused arg EXPECTED from socket hooks. === modified file 'src/alloc.c' --- src/alloc.c 2012-09-16 21:43:55 +0000 +++ src/alloc.c 2012-09-20 03:10:52 +0000 @@ -5521,7 +5521,7 @@ } /* Remove killed buffers or items whose car is a killed buffer from - LIST, and mark other items. Return changed LIST, which is marked. */ + LIST, and mark other items. Return changed LIST, which is marked. */ static Lisp_Object mark_discard_killed_buffers (Lisp_Object list) @@ -5543,6 +5543,7 @@ prev = &XCDR_AS_LVALUE (tail); } } + mark_object (tail); return list; } @@ -5691,18 +5692,8 @@ struct window *w = (struct window *) ptr; bool leaf = NILP (w->hchild) && NILP (w->vchild); - /* For live windows, Lisp code filters out killed buffers - from both buffer lists. For dead windows, we do it here - in attempt to help GC to reclaim killed buffers faster. */ - if (leaf && NILP (w->buffer)) - { - wset_prev_buffers - (w, mark_discard_killed_buffers (w->prev_buffers)); - wset_next_buffers - (w, mark_discard_killed_buffers (w->next_buffers)); - } - mark_vectorlike (ptr); + /* Mark glyphs for leaf windows. Marking window matrices is sufficient because frame matrices use the same glyph memory. */ @@ -5711,6 +5702,15 @@ mark_glyph_matrix (w->current_matrix); mark_glyph_matrix (w->desired_matrix); } + + /* Filter out killed buffers from both buffer lists + in attempt to help GC to reclaim killed buffers faster. + We can do it elsewhere for live windows, but this is the + best place to do it for dead windows. */ + wset_prev_buffers + (w, mark_discard_killed_buffers (w->prev_buffers)); + wset_next_buffers + (w, mark_discard_killed_buffers (w->next_buffers)); } break; === modified file 'src/window.c' --- src/window.c 2012-09-16 10:25:24 +0000 +++ src/window.c 2012-09-20 03:10:52 +0000 @@ -3462,7 +3462,11 @@ wset_vertical_scroll_bar_type (w, Qt); wset_window_end_pos (w, make_number (0)); wset_window_end_vpos (w, make_number (0)); - + /* These Lisp fields are marked specially so they're not set to nil by + allocate_window. */ + wset_prev_buffers (w, Qnil); + wset_next_buffers (w, Qnil); + /* Initialize non-Lisp data. Note that allocate_window zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ w->nrows_scale_factor = w->ncols_scale_factor = 1; === modified file 'src/window.h' --- src/window.h 2012-09-11 15:42:50 +0000 +++ src/window.h 2012-09-20 03:10:52 +0000 @@ -220,13 +220,6 @@ /* t means this window's child windows are not (re-)combined. */ Lisp_Object combination_limit; - /* Alist of triples listing - buffers previously shown in this window. */ - Lisp_Object prev_buffers; - - /* List of buffers re-shown in this window. */ - Lisp_Object next_buffers; - /* An alist with parameters. */ Lisp_Object window_parameters; @@ -238,6 +231,14 @@ struct glyph_matrix *current_matrix; struct glyph_matrix *desired_matrix; + /* The two Lisp_Object fields below are marked in a special way, + which is why they're placed after `current_matrix'. */ + /* Alist of triples listing + buffers previously shown in this window. */ + Lisp_Object prev_buffers; + /* List of buffers re-shown in this window. */ + Lisp_Object next_buffers; + /* Number saying how recently window was selected. */ int use_time; ------------------------------------------------------------ revno: 110106 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-19 18:37:07 -0700 message: Omit unused arg EXPECTED from socket hooks. * keyboard.c (gobble_input, read_avail_input, tty_read_avail_input): * nsterm.m (ns_term_init): * termhooks.h (struct terminal.read_socket_hook): * w32inevt.c (w32_console_read_socket): * w32term.c (w32_read_socket): * xterm.c (XTread_socket): Omit unused arg EXPECTED. All callers changed. (store_user_signal_events): Return void, not int, since callers no longer care about the return value. All uses changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-20 01:02:21 +0000 +++ src/ChangeLog 2012-09-20 01:37:07 +0000 @@ -1,3 +1,16 @@ +2012-09-20 Paul Eggert + + Omit unused arg EXPECTED from socket hooks. + * keyboard.c (gobble_input, read_avail_input, tty_read_avail_input): + * nsterm.m (ns_term_init): + * termhooks.h (struct terminal.read_socket_hook): + * w32inevt.c (w32_console_read_socket): + * w32term.c (w32_read_socket): + * xterm.c (XTread_socket): + Omit unused arg EXPECTED. All callers changed. + (store_user_signal_events): Return void, not int, since callers no + longer care about the return value. All uses changed. + 2012-09-20 Juanma Barranquero * w32gui.h (XParseGeometry): Do not declare. === modified file 'src/dispnew.c' --- src/dispnew.c 2012-09-15 07:06:56 +0000 +++ src/dispnew.c 2012-09-20 01:37:07 +0000 @@ -5971,7 +5971,7 @@ #ifdef USABLE_SIGIO - gobble_input (0); + gobble_input (); #endif wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-16 21:43:55 +0000 +++ src/keyboard.c 2012-09-20 01:37:07 +0000 @@ -413,7 +413,7 @@ /* Function for init_keyboard to call with no args (if nonzero). */ static void (*keyboard_init_hook) (void); -static int read_avail_input (int); +static int read_avail_input (void); static void get_input_pending (int *, int); static int readable_events (int); static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, @@ -448,7 +448,7 @@ static void timer_resume_idle (void); static void deliver_user_signal (int); static char *find_user_signal_name (int); -static int store_user_signal_events (void); +static void store_user_signal_events (void); /* These setters are used only in this file, so they can be private. */ static inline void @@ -2010,7 +2010,7 @@ { if (interrupt_input_blocked == 0 && !waiting_for_input) - read_avail_input (0); + read_avail_input (); } /* Timer callback function for poll_timer. TIMER is equal to @@ -3843,7 +3843,7 @@ interrupt handlers have not read it, read it now. */ #ifdef USABLE_SIGIO - gobble_input (0); + gobble_input (); #endif if (kbd_fetch_ptr != kbd_store_ptr) break; @@ -3869,8 +3869,7 @@ wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) - /* Pass 1 for EXPECT since we just waited to have input. */ - read_avail_input (1); + read_avail_input (); } if (CONSP (Vunread_command_events)) @@ -6734,14 +6733,14 @@ return; /* Try to read some input and see how much we get. */ - gobble_input (0); + gobble_input (); *addr = (!NILP (Vquit_flag) || readable_events (flags)); } /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ void -gobble_input (int expected) +gobble_input (void) { #ifdef USABLE_SIGIO if (interrupt_input) @@ -6750,7 +6749,7 @@ sigemptyset (&blocked); sigaddset (&blocked, SIGIO); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - read_avail_input (expected); + read_avail_input (); pthread_sigmask (SIG_SETMASK, &procmask, 0); } else @@ -6764,13 +6763,13 @@ sigemptyset (&blocked); sigaddset (&blocked, SIGALRM); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - read_avail_input (expected); + read_avail_input (); pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #endif #endif - read_avail_input (expected); + read_avail_input (); } /* Put a BUFFER_SWITCH_EVENT in the buffer @@ -6826,15 +6825,14 @@ this is a bad time to try to read input. */ static int -read_avail_input (int expected) +read_avail_input (void) { int nread = 0; int err = 0; struct terminal *t; /* Store pending user signal events, if any. */ - if (store_user_signal_events ()) - expected = 0; + store_user_signal_events (); /* Loop through the available terminals, and call their input hooks. */ t = terminal_list; @@ -6851,11 +6849,8 @@ hold_quit.kind = NO_EVENT; /* No need for FIONREAD or fcntl; just say don't wait. */ - while (nr = (*t->read_socket_hook) (t, expected, &hold_quit), nr > 0) - { - nread += nr; - expected = 0; - } + while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) + nread += nr; if (nr == -1) /* Not OK to read input now. */ { @@ -6950,7 +6945,6 @@ int tty_read_avail_input (struct terminal *terminal, - int expected, struct input_event *hold_quit) { /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than @@ -7170,8 +7164,7 @@ while (1) { - int nread; - nread = read_avail_input (1); + int nread = read_avail_input (); /* -1 means it's not ok to read the input now. UNBLOCK_INPUT will read it later; now, avoid infinite loop. 0 means there was no keyboard input available. */ @@ -7323,25 +7316,25 @@ return NULL; } -static int +static void store_user_signal_events (void) { struct user_signal_info *p; struct input_event buf; - int nstored = 0; + bool buf_initialized = 0; for (p = user_signals; p; p = p->next) if (p->npending > 0) { sigset_t blocked, procmask; - if (nstored == 0) + if (! buf_initialized) { memset (&buf, 0, sizeof buf); buf.kind = USER_SIGNAL_EVENT; buf.frame_or_window = selected_frame; + buf_initialized = 1; } - nstored += p->npending; sigemptyset (&blocked); sigaddset (&blocked, p->sig); @@ -7357,8 +7350,6 @@ pthread_sigmask (SIG_SETMASK, &procmask, 0); } - - return nstored; } === modified file 'src/keyboard.h' --- src/keyboard.h 2012-09-02 16:56:31 +0000 +++ src/keyboard.h 2012-09-20 01:37:07 +0000 @@ -523,7 +523,7 @@ extern void start_polling (void); extern void stop_polling (void); extern void set_poll_suppress_count (int); -extern void gobble_input (int); +extern void gobble_input (void); extern int input_polling_used (void); extern void clear_input_pending (void); extern int requeued_events_pending_p (void); @@ -547,8 +547,7 @@ extern int kbd_buffer_events_waiting (int); extern void add_user_signal (int, const char *); -extern int tty_read_avail_input (struct terminal *, int, - struct input_event *); +extern int tty_read_avail_input (struct terminal *, struct input_event *); extern EMACS_TIME timer_check (void); extern void mark_kboards (void); === modified file 'src/nsterm.m' --- src/nsterm.m 2012-09-16 21:43:55 +0000 +++ src/nsterm.m 2012-09-20 01:37:07 +0000 @@ -3336,8 +3336,7 @@ } static int -ns_read_socket (struct terminal *terminal, int expected, - struct input_event *hold_quit) +ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) /* -------------------------------------------------------------------------- External (hook): Post an event to ourself and keep reading events until we read it back again. In effect process all events which were waiting. @@ -4204,7 +4203,7 @@ NSColorPboardType, NSFontPboardType, nil] retain]; - + [NSApp run]; ns_do_open_file = YES; return dpyinfo; === modified file 'src/termhooks.h' --- src/termhooks.h 2012-08-18 00:07:52 +0000 +++ src/termhooks.h 2012-09-20 01:37:07 +0000 @@ -592,23 +592,14 @@ TERMINAL indicates which terminal device to read from. Input events should be read into BUF, the size of which is given in - SIZE. EXPECTED is non-zero if the caller suspects that new input - is available. + SIZE. A positive return value indicates that that many input events - where read into BUF. + were read into BUF. Zero means no events were immediately available. A value of -1 means a transient read error, while -2 indicates - that the device was closed (hangup), and it should be deleted. - - XXX Please note that a non-zero value of EXPECTED only means that - there is available input on at least one of the currently opened - terminal devices -- but not necessarily on this device. - Therefore, in most cases EXPECTED should be simply ignored. - - XXX This documentation needs to be updated. */ + that the device was closed (hangup), and it should be deleted. */ int (*read_socket_hook) (struct terminal *terminal, - int expected, struct input_event *hold_quit); /* Called when a frame's display becomes entirely up to date. */ === modified file 'src/w32inevt.c' --- src/w32inevt.c 2012-09-19 21:38:00 +0000 +++ src/w32inevt.c 2012-09-20 01:37:07 +0000 @@ -744,7 +744,6 @@ int w32_console_read_socket (struct terminal *terminal, - int expected, struct input_event *hold_quit) { int nev, add; === modified file 'src/w32inevt.h' --- src/w32inevt.h 2012-07-29 08:18:29 +0000 +++ src/w32inevt.h 2012-09-20 01:37:07 +0000 @@ -21,7 +21,7 @@ extern int w32_console_unicode_input; -extern int w32_console_read_socket (struct terminal *term, int numchars, +extern int w32_console_read_socket (struct terminal *term, struct input_event *hold_quit); extern void w32_console_mouse_position (FRAME_PTR *f, int insist, Lisp_Object *bar_window, === modified file 'src/w32term.c' --- src/w32term.c 2012-09-17 07:56:20 +0000 +++ src/w32term.c 2012-09-20 01:37:07 +0000 @@ -4137,8 +4137,6 @@ We return the number of characters stored into the buffer, thus pretending to be `read'. - EXPECTED is nonzero if the caller knows input is available. - Some of these messages are reposted back to the message queue since the system calls the windows proc directly in a context where we cannot return the data nor can we guarantee the state we are in. So if we dispatch them @@ -4149,7 +4147,7 @@ */ static int -w32_read_socket (struct terminal *terminal, int expected, +w32_read_socket (struct terminal *terminal, struct input_event *hold_quit) { int count = 0; === modified file 'src/xterm.c' --- src/xterm.c 2012-09-16 21:43:55 +0000 +++ src/xterm.c 2012-09-20 01:37:07 +0000 @@ -7109,19 +7109,15 @@ /* Read events coming from the X server. - This routine is called by the SIGIO handler only if SYNC_INPUT is - not defined. - We return as soon as there are no more events to be read. + Return as soon as there are no more events to be read. - We return the number of characters stored into the buffer, + Return the number of characters stored into the buffer, thus pretending to be `read' (except the characters we store in the keyboard buffer can be multibyte, so are not necessarily - C chars). - - EXPECTED is nonzero if the caller knows input is available. */ + C chars). */ static int -XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) +XTread_socket (struct terminal *terminal, struct input_event *hold_quit) { int count = 0; int event_found = 0; ------------------------------------------------------------ revno: 110105 committer: Juanma Barranquero branch nick: trunk timestamp: Thu 2012-09-20 03:02:21 +0200 message: src/w32gui.h (XParseGeometry): Do not declare. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-19 21:38:00 +0000 +++ src/ChangeLog 2012-09-20 01:02:21 +0000 @@ -1,3 +1,7 @@ +2012-09-20 Juanma Barranquero + + * w32gui.h (XParseGeometry): Do not declare. + 2012-09-19 Paul Eggert * w32inevt.c (w32_console_read_socket): Return -1 on failure, not 0. === modified file 'src/w32gui.h' --- src/w32gui.h 2012-07-29 08:18:29 +0000 +++ src/w32gui.h 2012-09-20 01:02:21 +0000 @@ -118,9 +118,6 @@ #define PBaseSize (1L << 8) /* program specified base for incrementing */ #define PWinGravity (1L << 9) /* program specified window gravity */ -extern int XParseGeometry (char *, int *, int *, unsigned *, unsigned *); - - typedef struct { int x, y; unsigned width, height; ------------------------------------------------------------ revno: 110104 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-19 14:38:00 -0700 message: * w32inevt.c (w32_console_read_socket): Return -1 on failure, not 0. Ignore 'expected'. See Eli Zaretskii in (last line). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-19 17:28:13 +0000 +++ src/ChangeLog 2012-09-19 21:38:00 +0000 @@ -1,5 +1,9 @@ 2012-09-19 Paul Eggert + * w32inevt.c (w32_console_read_socket): Return -1 on failure, not 0. + Ignore 'expected'. See Eli Zaretskii in + (last line). + * frame.c (read_integer): Remove. All uses replaced by strtol/strtoul. (XParseGeometry): Now static. Substitute extremal values for values that are out of range. === modified file 'src/w32inevt.c' --- src/w32inevt.c 2012-09-15 08:03:11 +0000 +++ src/w32inevt.c 2012-09-19 21:38:00 +0000 @@ -747,7 +747,7 @@ int expected, struct input_event *hold_quit) { - int nev, ret = 0, add; + int nev, add; int isdead; if (interrupt_input_blocked) @@ -767,8 +767,7 @@ /* If nev == -1, there was some kind of error If nev == 0 then waitp must be zero and no events were available so return. */ - UNBLOCK_INPUT; - return nev; + break; } while (nev > 0) @@ -812,9 +811,6 @@ queue_ptr++; nev--; } - - if (ret > 0 || expected == 0) - break; } /* We don't get told about changes in the window size (only the buffer @@ -824,5 +820,5 @@ maybe_generate_resize_event (); UNBLOCK_INPUT; - return ret; + return nev; } ------------------------------------------------------------ revno: 110103 committer: Juri Linkov branch nick: trunk timestamp: Wed 2012-09-19 23:09:55 +0300 message: * lisp/dired-aux.el (dired-diff): Add (require 'diff) because `diff-latest-backup-file' is not autoloaded. (dired-do-chxxx, dired-do-chmod): Set `no-error-if-not-filep' arg of `dired-get-filename' to t to not report error when there is no default file on the current line. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 19:59:52 +0000 +++ lisp/ChangeLog 2012-09-19 20:09:55 +0000 @@ -1,3 +1,11 @@ +2012-09-19 Juri Linkov + + * dired-aux.el (dired-diff): Add (require 'diff) because + `diff-latest-backup-file' is not autoloaded. + (dired-do-chxxx, dired-do-chmod): Set `no-error-if-not-filep' arg + of `dired-get-filename' to t to not report error when there is + no default file on the current line. + 2012-09-19 Stefan Monnier * emacs-lisp/macroexp.el (macroexp--funcall-if-compiled): Rename from === modified file 'lisp/dired-aux.el' --- lisp/dired-aux.el 2012-09-18 23:40:39 +0000 +++ lisp/dired-aux.el 2012-09-19 20:09:55 +0000 @@ -70,7 +70,7 @@ (interactive (let* ((current (dired-get-filename t)) ;; Get the latest existing backup file. - (oldf (diff-latest-backup-file current)) + (oldf (progn (require 'diff) (diff-latest-backup-file current))) ;; Get the file at the mark. (file-at-mark (if (and transient-mark-mode mark-active) (save-excursion (goto-char (mark t)) @@ -248,7 +248,7 @@ ;; ARG describes which files to use, as in `dired-get-marked-files'. (let* ((files (dired-get-marked-files t arg)) ;; The source of default file attributes is the file at point. - (default-file (dired-get-filename t)) + (default-file (dired-get-filename t t)) (default (when default-file (cond ((eq op-symbol 'touch) (format-time-string @@ -300,7 +300,7 @@ (interactive "P") (let* ((files (dired-get-marked-files t arg)) ;; The source of default file attributes is the file at point. - (default-file (dired-get-filename t)) + (default-file (dired-get-filename t t)) (modestr (when default-file (nth 8 (file-attributes default-file)))) (default ------------------------------------------------------------ revno: 110102 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12371 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-19 15:59:52 -0400 message: * lisp/emacs-lisp/macroexp.el (macroexp--funcall-if-compiled): Rename from macroexp--eval-if-compile. (macroexp--funcall-and-return, macroexp--warn-and-return): New funs. (macroexp--expand-all): Use them. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 17:54:59 +0000 +++ lisp/ChangeLog 2012-09-19 19:59:52 +0000 @@ -1,5 +1,10 @@ 2012-09-19 Stefan Monnier + * emacs-lisp/macroexp.el (macroexp--funcall-if-compiled): Rename from + macroexp--eval-if-compile. + (macroexp--funcall-and-return, macroexp--warn-and-return): New funs. + (macroexp--expand-all): Use them (bug#12371). + * doc-view.el (doc-view-guess-paper-size) (doc-view-scale-bounding-box): Fix unbound `caddr'. @@ -174,8 +179,8 @@ (display-buffer-function): Mark as obsolete. * progmodes/compile.el (compilation-parse-errors): Accept list - values similar to font-lock-keywords (Bug#12136). Suggested by - Oleksandr Manzyuk. + values similar to font-lock-keywords (Bug#12136). + Suggested by Oleksandr Manzyuk. (compilation-error-regexp-alist): Doc fix. 2012-09-15 Glenn Morris === modified file 'lisp/emacs-lisp/macroexp.el' --- lisp/emacs-lisp/macroexp.el 2012-09-19 16:09:43 +0000 +++ lisp/emacs-lisp/macroexp.el 2012-09-19 19:59:52 +0000 @@ -100,19 +100,34 @@ (error (message "Compiler-macro error for %S: %S" (car form) err) form))) -(defun macroexp--eval-if-compile (&rest _forms) +(defun macroexp--funcall-if-compiled (_form) "Pseudo function used internally by macroexp to delay warnings. The purpose is to delay warnings to bytecomp.el, so they can use things like `byte-compile-log-warning' to get better file-and-line-number data and also to avoid outputting the warning during normal execution." nil) -(put 'macroexp--eval-if-compile 'byte-compile +(put 'macroexp--funcall-if-compiled 'byte-compile (lambda (form) - (mapc (lambda (x) (funcall (eval x))) (cdr form)) + (funcall (eval (cadr form))) (byte-compile-constant nil))) -(autoload 'byte-compile-warn-obsolete "bytecomp") -(autoload 'byte-compile-log-warning "bytecomp") +(defun macroexp--funcall-and-return (when-compiled when-interpreted form) + ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this + ;; macro-expansion will be processed by the byte-compiler, we check + ;; circumstantial evidence. + (if (member '(declare-function . byte-compile-macroexpand-declare-function) + macroexpand-all-environment) + `(progn + (macroexp--funcall-if-compiled ',when-compiled) + ,form) + (funcall when-interpreted) + form)) + +(defun macroexp--warn-and-return (msg form) + (macroexp--funcall-and-return + (lambda () (byte-compile-log-warning msg t)) + (lambda () (message "%s" msg)) + form)) (defun macroexp--expand-all (form) "Expand all macros in FORM. @@ -133,9 +148,10 @@ (car-safe form) (symbolp (car form)) (get (car form) 'byte-obsolete-info)) - `(progn (macroexp--eval-if-compile - (lambda () (byte-compile-warn-obsolete ',(car form)))) - ,new-form) + (macroexp--funcall-and-return + (lambda () (byte-compile-warn-obsolete ',(car form))) + #'ignore ;FIXME: We should `message' something. + new-form) new-form))) (pcase form (`(cond . ,clauses) @@ -178,26 +194,16 @@ ;; First arg is a function: (`(,(and fun (or `funcall `apply `mapcar `mapatoms `mapconcat `mapc)) ',(and f `(lambda . ,_)) . ,args) - (byte-compile-log-warning + (macroexp--warn-and-return (format "%s quoted with ' rather than with #'" (list 'lambda (nth 1 f) '...)) - t) - ;; We don't use `macroexp--cons' since there's clearly a change. - (cons fun - (cons (macroexp--expand-all (list 'function f)) - (macroexp--all-forms args)))) + (macroexp--expand-all `(,fun ,f . ,args)))) ;; Second arg is a function: (`(,(and fun (or `sort)) ,arg1 ',(and f `(lambda . ,_)) . ,args) - (byte-compile-log-warning + (macroexp--warn-and-return (format "%s quoted with ' rather than with #'" (list 'lambda (nth 1 f) '...)) - t) - ;; We don't use `macroexp--cons' since there's clearly a change. - (cons fun - (cons (macroexp--expand-all arg1) - (cons (macroexp--expand-all - (list 'function f)) - (macroexp--all-forms args))))) + (macroexp--expand-all `(,fun ,arg1 ,f . ,args)))) (`(,func . ,_) ;; Macro expand compiler macros. This cannot be delayed to ;; byte-optimize-form because the output of the compiler-macro can ------------------------------------------------------------ revno: 110101 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-19 13:54:59 -0400 message: * lisp/doc-view.el (doc-view-guess-paper-size) (doc-view-scale-bounding-box): Fix unbound `caddr'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 17:35:18 +0000 +++ lisp/ChangeLog 2012-09-19 17:54:59 +0000 @@ -1,3 +1,8 @@ +2012-09-19 Stefan Monnier + + * doc-view.el (doc-view-guess-paper-size) + (doc-view-scale-bounding-box): Fix unbound `caddr'. + 2012-09-19 Tassilo Horn New feature: set optimal slice from BoundingBox information. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2012-09-19 17:35:18 +0000 +++ lisp/doc-view.el 2012-09-19 17:54:59 +0000 @@ -1068,15 +1068,15 @@ (round (/ (* 100.0 x) y)))) (let ((ar (div iw ih)) (al (mapcar (lambda (l) - (list (div (cadr l) (caddr l)) (car l))) + (list (div (nth 1 l) (nth 2 l)) (car l))) doc-view-paper-sizes))) (cadr (assoc ar al))))) (defun doc-view-scale-bounding-box (ps iw ih bb) - (list (/ (* (nth 0 bb) iw) (cadr (assoc ps doc-view-paper-sizes))) - (/ (* (nth 1 bb) ih) (caddr (assoc ps doc-view-paper-sizes))) - (/ (* (nth 2 bb) iw) (cadr (assoc ps doc-view-paper-sizes))) - (/ (* (nth 3 bb) ih) (caddr (assoc ps doc-view-paper-sizes))))) + (list (/ (* (nth 0 bb) iw) (nth 1 (assoc ps doc-view-paper-sizes))) + (/ (* (nth 1 bb) ih) (nth 2 (assoc ps doc-view-paper-sizes))) + (/ (* (nth 2 bb) iw) (nth 1 (assoc ps doc-view-paper-sizes))) + (/ (* (nth 3 bb) ih) (nth 2 (assoc ps doc-view-paper-sizes))))) (defun doc-view-set-slice-from-bounding-box (&optional force-paper-size) "Set the slice from the document's BoundingBox information. ------------------------------------------------------------ revno: 110100 committer: Tassilo Horn branch nick: trunk timestamp: Wed 2012-09-19 19:35:18 +0200 message: New feature: set optimal slice from BoundingBox information. * doc-view.el (doc-view-mode-map): Add keybinding. (doc-view-menu): Add menu entry. (doc-view-set-slice): Adapt docstring. (doc-view-get-bounding-box, doc-view-guess-paper-size) (doc-view-scale-bounding-box) (doc-view-set-slice-from-bounding-box): New functions. (doc-view-paper-sizes): New defvar. * doc/emacs/misc.texi (DocView Slicing): Document new slice from BoundingBox feature. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-18 18:13:01 +0000 +++ ChangeLog 2012-09-19 17:35:18 +0000 @@ -1,3 +1,8 @@ +2012-09-19 Tassilo Horn + + * doc/emacs/misc.texi (DocView Slicing): Document new slice from + BoundingBox feature. + 2012-09-18 Jan Djärv * configure.ac (HAVE_GTK): Mention if we use GTK2 or GTK3. === modified file 'doc/emacs/misc.texi' --- doc/emacs/misc.texi 2012-06-17 05:13:40 +0000 +++ doc/emacs/misc.texi 2012-09-19 17:35:18 +0000 @@ -411,6 +411,10 @@ select the slice. @c ??? How does this work? + The most convenient way is to set the optimal slice by using +BoundingBox information automatically determined from the document by +typing @kbd{s b} (@code{doc-view-set-slice-using-mouse}). + @findex doc-view-reset-slice To cancel the selected slice, type @kbd{s r} (@code{doc-view-reset-slice}). Then DocView shows the entire page === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 16:09:43 +0000 +++ lisp/ChangeLog 2012-09-19 17:35:18 +0000 @@ -1,3 +1,14 @@ +2012-09-19 Tassilo Horn + + New feature: set optimal slice from BoundingBox information. + * doc-view.el (doc-view-mode-map): Add keybinding. + (doc-view-menu): Add menu entry. + (doc-view-set-slice): Adapt docstring. + (doc-view-get-bounding-box, doc-view-guess-paper-size) + (doc-view-scale-bounding-box) + (doc-view-set-slice-from-bounding-box): New functions. + (doc-view-paper-sizes): New defvar. + 2012-09-19 Glenn Morris * emacs-lisp/macroexp.el (byte-compile-warn-obsolete) === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2012-07-10 11:51:54 +0000 +++ lisp/doc-view.el 2012-09-19 17:35:18 +0000 @@ -3,8 +3,8 @@ ;; Copyright (C) 2007-2012 Free Software Foundation, Inc. ;; -;; Author: Tassilo Horn -;; Maintainer: Tassilo Horn +;; Author: Tassilo Horn +;; Maintainer: Tassilo Horn ;; Keywords: files, pdf, ps, dvi ;; This file is part of GNU Emacs. @@ -57,16 +57,21 @@ ;; pages won't be displayed before conversion of the document finished ;; completely. ;; -;; DocView lets you select a slice of the displayed pages. This slice will be -;; remembered and applied to all pages of the current document. This enables -;; you to cut away the margins of a document to save some space. To select a -;; slice you can use `doc-view-set-slice' (bound to `s s') which will query you -;; for the coordinates of the slice's top-left corner and its width and height. -;; A much more convenient way to do the same is offered by the command -;; `doc-view-set-slice-using-mouse' (bound to `s m'). After invocation you -;; only have to press mouse-1 at the top-left corner and drag it to the -;; bottom-right corner of the desired slice. To reset the slice use -;; `doc-view-reset-slice' (bound to `s r'). +;; DocView lets you select a slice of the displayed pages. This slice +;; will be remembered and applied to all pages of the current +;; document. This enables you to cut away the margins of a document +;; to save some space. To select a slice you can use +;; `doc-view-set-slice' (bound to `s s') which will query you for the +;; coordinates of the slice's top-left corner and its width and +;; height. A much more convenient way to do the same is offered by +;; the command `doc-view-set-slice-using-mouse' (bound to `s m'). +;; After invocation you only have to press mouse-1 at the top-left +;; corner and drag it to the bottom-right corner of the desired slice. +;; Even more accurate and convenient is to use +;; `doc-view-set-slice-from-bounding-box' (bound to `s b') which uses +;; the BoundingBox information of the current page to set an optimal +;; slice. To reset the slice use `doc-view-reset-slice' (bound to `s +;; r'). ;; ;; You can also search within the document. The command `doc-view-search' ;; (bound to `C-s') queries for a search regexp and initializes a list of all @@ -103,7 +108,6 @@ ;; - share more code with image-mode. ;; - better menu. ;; - Bind slicing to a drag event. -;; - doc-view-fit-doc-to-window and doc-view-fit-window-to-doc? ;; - zoom the region around the cursor (like xdvi). ;; - get rid of the silly arrow in the fringe. ;; - improve anti-aliasing (pdf-utils gets it better). @@ -340,6 +344,7 @@ ;; Slicing the image (define-key map (kbd "s s") 'doc-view-set-slice) (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse) + (define-key map (kbd "s b") 'doc-view-set-slice-from-bounding-box) (define-key map (kbd "s r") 'doc-view-reset-slice) ;; Searching (define-key map (kbd "C-s") 'doc-view-search) @@ -381,6 +386,7 @@ ) "---" ["Set Slice" doc-view-set-slice-using-mouse] + ["Set Slice (BoundingBox)" doc-view-set-slice-from-bounding-box] ["Set Slice (manual)" doc-view-set-slice] ["Reset Slice" doc-view-reset-slice] "---" @@ -991,8 +997,9 @@ margins of the document. It prompts for the top-left corner (X and Y) of the slice to display and its WIDTH and HEIGHT. -See `doc-view-set-slice-using-mouse' for a more convenient way to -do that. To reset the slice use `doc-view-reset-slice'." +See `doc-view-set-slice-using-mouse' and +`doc-view-set-slice-from-bounding-box' for more convenient ways +to do that. To reset the slice use `doc-view-reset-slice'." (interactive (let* ((size (image-size (doc-view-current-image) t)) (a (read-number (format "Top-left X (0..%d): " (car size)))) @@ -1023,6 +1030,79 @@ (setq done t)))) (doc-view-set-slice x y w h))) +(defun doc-view-get-bounding-box () + "Get the BoundingBox information of the current page." + (let* ((page (doc-view-current-page)) + (o (shell-command-to-string + (concat doc-view-ghostscript-program + " -dSAFER -dBATCH -dNOPAUSE -q -sDEVICE=bbox " + (format "-dFirstPage=%s -dLastPage=%s %s" + page page + doc-view-buffer-file-name))))) + (save-match-data + (when (string-match (concat "%%BoundingBox: " + "\\([[:digit:]]+\\) \\([[:digit:]]+\\) " + "\\([[:digit:]]+\\) \\([[:digit:]]+\\)") o) + (mapcar #'string-to-number + (list (match-string 1 o) + (match-string 2 o) + (match-string 3 o) + (match-string 4 o))))))) + +(defvar doc-view-paper-sizes + '((a4 595 842) + (a4-landscape 842 595) + (letter 612 792) + (letter-landscape 792 612) + (legal 612 1008) + (legal-landscape 1008 612) + (a3 842 1191) + (a3-landscape 1191 842) + (tabloid 792 1224) + (ledger 1224 792)) + "An alist from paper size names to dimensions.") + +(defun doc-view-guess-paper-size (iw ih) + "Guess the paper size according to the aspect ratio." + (cl-labels ((div (x y) + (round (/ (* 100.0 x) y)))) + (let ((ar (div iw ih)) + (al (mapcar (lambda (l) + (list (div (cadr l) (caddr l)) (car l))) + doc-view-paper-sizes))) + (cadr (assoc ar al))))) + +(defun doc-view-scale-bounding-box (ps iw ih bb) + (list (/ (* (nth 0 bb) iw) (cadr (assoc ps doc-view-paper-sizes))) + (/ (* (nth 1 bb) ih) (caddr (assoc ps doc-view-paper-sizes))) + (/ (* (nth 2 bb) iw) (cadr (assoc ps doc-view-paper-sizes))) + (/ (* (nth 3 bb) ih) (caddr (assoc ps doc-view-paper-sizes))))) + +(defun doc-view-set-slice-from-bounding-box (&optional force-paper-size) + "Set the slice from the document's BoundingBox information. +The result is that the margins are almost completely cropped, +much more accurate than could be done manually using +`doc-view-set-slice-using-mouse'." + (interactive "P") + (let ((bb (doc-view-get-bounding-box))) + (if (not bb) + (message "BoundingBox couldn't be determined") + (let* ((is (image-size (doc-view-current-image) t)) + (iw (car is)) + (ih (cdr is)) + (ps (or (and (null force-paper-size) (doc-view-guess-paper-size iw ih)) + (intern (completing-read "Paper size: " + (mapcar #'car doc-view-paper-sizes) + nil t)))) + (bb (doc-view-scale-bounding-box ps iw ih bb)) + (x1 (nth 0 bb)) + (y1 (nth 1 bb)) + (x2 (nth 2 bb)) + (y2 (nth 3 bb))) + ;; We keep a 2 pixel margin. + (doc-view-set-slice (- x1 2) (- ih y2 2) + (+ (- x2 x1) 4) (+ (- y2 y1) 4)))))) + (defun doc-view-reset-slice () "Reset the current slice. After calling this function whole pages will be visible again." @@ -1095,7 +1175,9 @@ "page-[0-9]+\\.png" t) 'doc-view-sort)) (dolist (win (or (get-buffer-window-list buffer nil t) - (list (selected-window)))) + (list (let ((w (selected-window))) + (set-window-buffer w buffer) + w)))) (let* ((page (doc-view-current-page win)) (pagefile (expand-file-name (format "page-%d.png" page) (doc-view-current-cache-dir)))) @@ -1103,8 +1185,8 @@ (and (not (member pagefile prev-pages)) (member pagefile doc-view-current-files))) (with-selected-window win - (cl-assert (eq (current-buffer) buffer)) - (doc-view-goto-page page)))))))) + (cl-assert (eq (current-buffer) buffer) t) + (doc-view-goto-page page)))))))) (defun doc-view-buffer-message () ;; Only show this message initially, not when refreshing the buffer (in which ------------------------------------------------------------ revno: 110099 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-19 10:28:13 -0700 message: * frame.c (read_integer): Remove. All uses replaced by strtol/strtoul. (XParseGeometry): Now static. Substitute extremal values for values that are out of range. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-19 06:47:01 +0000 +++ src/ChangeLog 2012-09-19 17:28:13 +0000 @@ -1,3 +1,9 @@ +2012-09-19 Paul Eggert + + * frame.c (read_integer): Remove. All uses replaced by strtol/strtoul. + (XParseGeometry): Now static. Substitute extremal values for + values that are out of range. + 2012-09-19 Jan Djärv * w32xfns.c (read_integer, XParseGeometry): Move to frame.c. === modified file 'src/frame.c' --- src/frame.c 2012-09-19 06:47:01 +0000 +++ src/frame.c 2012-09-19 17:28:13 +0000 @@ -3912,50 +3912,27 @@ */ static int -read_integer (register char *string, char **NextString) -{ - register int Result = 0; - int Sign = 1; - - if (*string == '+') - string++; - else if (*string == '-') - { - string++; - Sign = -1; - } - for (; (*string >= '0') && (*string <= '9'); string++) - { - Result = (Result * 10) + (*string - '0'); - } - *NextString = string; - if (Sign >= 0) - return (Result); - else - return (-Result); -} - -int XParseGeometry (char *string, int *x, int *y, unsigned int *width, unsigned int *height) { int mask = NoValue; - register char *strind; - unsigned int tempWidth, tempHeight; - int tempX, tempY; + char *strind; + unsigned long int tempWidth, tempHeight; + long int tempX, tempY; char *nextCharacter; - if ((string == NULL) || (*string == '\0')) return (mask); + if (string == NULL || *string == '\0') + return mask; if (*string == '=') string++; /* ignore possible '=' at beg of geometry spec */ - strind = (char *)string; + strind = string; if (*strind != '+' && *strind != '-' && *strind != 'x') { - tempWidth = read_integer (strind, &nextCharacter); + tempWidth = strtoul (strind, &nextCharacter, 10); if (strind == nextCharacter) - return (0); + return 0; strind = nextCharacter; mask |= WidthValue; } @@ -3963,53 +3940,30 @@ if (*strind == 'x' || *strind == 'X') { strind++; - tempHeight = read_integer (strind, &nextCharacter); + tempHeight = strtoul (strind, &nextCharacter, 10); if (strind == nextCharacter) - return (0); + return 0; strind = nextCharacter; mask |= HeightValue; } - if ((*strind == '+') || (*strind == '-')) + if (*strind == '+' || *strind == '-') { if (*strind == '-') - { - strind++; - tempX = -read_integer (strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= XNegative; - - } - else - { - strind++; - tempX = read_integer (strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - } + mask |= XNegative; + tempX = strtol (strind, &nextCharacter, 10); + if (strind == nextCharacter) + return 0; + strind = nextCharacter; mask |= XValue; - if ((*strind == '+') || (*strind == '-')) + if (*strind == '+' || *strind == '-') { if (*strind == '-') - { - strind++; - tempY = -read_integer (strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= YNegative; - } - else - { - strind++; - tempY = read_integer (strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - } + mask |= YNegative; + tempY = strtol (strind, &nextCharacter, 10); + if (strind == nextCharacter) + return 0; + strind = nextCharacter; mask |= YValue; } } @@ -4017,17 +3971,18 @@ /* If strind isn't at the end of the string then it's an invalid geometry specification. */ - if (*strind != '\0') return (0); + if (*strind != '\0') + return 0; if (mask & XValue) - *x = tempX; + *x = clip_to_bounds (INT_MIN, tempX, INT_MAX); if (mask & YValue) - *y = tempY; + *y = clip_to_bounds (INT_MIN, tempY, INT_MAX); if (mask & WidthValue) - *width = tempWidth; + *width = min (tempWidth, UINT_MAX); if (mask & HeightValue) - *height = tempHeight; - return (mask); + *height = min (tempHeight, UINT_MAX); + return mask; } #endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */ ------------------------------------------------------------ revno: 110098 fixes bug: http://debbugs.gnu.org/12371 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-09-19 09:09:43 -0700 message: Partial fix for bug#12371 * emacs-lisp/macroexp.el (byte-compile-warn-obsolete) (byte-compile-log-warning): Autoload. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 07:27:29 +0000 +++ lisp/ChangeLog 2012-09-19 16:09:43 +0000 @@ -1,5 +1,8 @@ 2012-09-19 Glenn Morris + * emacs-lisp/macroexp.el (byte-compile-warn-obsolete) + (byte-compile-log-warning): Autoload. (Bug#12371) + * calendar/calendar.el (calendar-american-month-header) (calendar-european-month-header, calendar-iso-month-header) (calendar-month-header): New options. === modified file 'lisp/emacs-lisp/macroexp.el' --- lisp/emacs-lisp/macroexp.el 2012-09-04 17:40:25 +0000 +++ lisp/emacs-lisp/macroexp.el 2012-09-19 16:09:43 +0000 @@ -111,6 +111,9 @@ (mapc (lambda (x) (funcall (eval x))) (cdr form)) (byte-compile-constant nil))) +(autoload 'byte-compile-warn-obsolete "bytecomp") +(autoload 'byte-compile-log-warning "bytecomp") + (defun macroexp--expand-all (form) "Expand all macros in FORM. This is an internal version of `macroexpand-all'. ------------------------------------------------------------ revno: 110097 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-09-19 06:17:35 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2012-09-17 10:17:50 +0000 +++ autogen/configure 2012-09-19 10:17:35 +0000 @@ -10567,6 +10567,7 @@ GTK_OBJ=emacsgtkfixed.o term_header=gtkutil.h + USE_GTK_TOOLKIT="GTK3" else check_gtk2=yes gtk3_pkg_errors="$GTK_PKG_ERRORS " @@ -10634,6 +10635,7 @@ then as_fn_error "$gtk3_pkg_errors$GTK_PKG_ERRORS" "$LINENO" 5 fi + test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2" fi if test x"$pkg_check_gtk" = xyes; then @@ -24293,7 +24295,7 @@ #### It makes printing result more understandable as using GTK sets #### toolkit_scroll_bars to yes by default. if test "${HAVE_GTK}" = "yes"; then - USE_X_TOOLKIT=GTK + USE_X_TOOLKIT="$USE_GTK_TOOLKIT" fi echo " ------------------------------------------------------------ revno: 110096 fixes bug: http://debbugs.gnu.org/9510 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-09-19 00:27:29 -0700 message: Allow customization of calendar month header text * lisp/calendar/calendar.el (calendar-american-month-header) (calendar-european-month-header, calendar-iso-month-header) (calendar-month-header): New options. (calendar-set-date-style): Set calendar-month-header. Redraw calendar. (calendar-generate-month): Use calendar-month-header. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-18 23:40:39 +0000 +++ etc/NEWS 2012-09-19 07:27:29 +0000 @@ -439,6 +439,9 @@ ** Calendar +*** You can customize the header text that appears above each calendar month. +See the variable `calendar-month-header'. + *** The calendars produced by cal-html include holidays. Customize cal-html-holidays to change this. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-19 06:47:01 +0000 +++ lisp/ChangeLog 2012-09-19 07:27:29 +0000 @@ -1,3 +1,11 @@ +2012-09-19 Glenn Morris + + * calendar/calendar.el (calendar-american-month-header) + (calendar-european-month-header, calendar-iso-month-header) + (calendar-month-header): New options. + (calendar-set-date-style): Set calendar-month-header. Redraw calendar. + (calendar-generate-month): Use calendar-month-header. (Bug#9510) + 2012-09-19 Jan Djärv * startup.el (command-line-ns-option-alist): Add -g and --geometry. === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2012-09-17 05:41:04 +0000 +++ lisp/calendar/calendar.el 2012-09-19 07:27:29 +0000 @@ -921,6 +921,64 @@ calendar-american-date-display-form) :group 'calendar) +(defcustom calendar-american-month-header + '(propertize (format "%s %d" (calendar-month-name month) year) + 'font-lock-face 'font-lock-function-name-face) + "Default format for calendar month headings with the American date style. +Normally you should not customize this, but `calender-month-header'." + :group 'calendar + :risky t + :type 'sexp + :version "24.3") + +(defcustom calendar-european-month-header + '(propertize (format "%s %d" (calendar-month-name month) year) + 'font-lock-face 'font-lock-function-name-face) + "Default format for calendar month headings with the European date style. +Normally you should not customize this, but `calender-month-header'." + :group 'calendar + :risky t + :type 'sexp + :version "24.3") + +(defcustom calendar-iso-month-header + '(propertize (format "%d %s" year (calendar-month-name month)) + 'font-lock-face 'font-lock-function-name-face) + "Default format for calendar month headings with the ISO date style. +Normally you should not customize this, but `calender-month-header'." + :group 'calendar + :risky t + :type 'sexp + :version "24.3") + +(defcustom calendar-month-header + (cond ((eq calendar-date-style 'iso) + calendar-iso-month-header) + ((eq calendar-date-style 'european) + calendar-european-month-header) + (t calendar-american-month-header)) + "Expression to evaluate to return the calendar month headings. +When this expression is evaluated, the variables MONTH and YEAR are +integers appropriate to the relevant month. The result is padded +to the width of `calendar-month-digit-width'. + +For examples of three common styles, see `calendar-american-month-header', +`calendar-european-month-header', and `calendar-iso-month-header'. + +Changing this variable without using customize has no effect on +pre-existing calendar windows." + :group 'calendar + :initialize 'custom-initialize-default + :risky t + :set (lambda (sym val) + (set sym val) + (calendar-redraw)) + :set-after '(calendar-date-style calendar-american-month-header + calendar-european-month-header + calendar-iso-month-header) + :type 'sexp + :version "24.3") + (defun calendar-set-date-style (style) "Set the style of calendar and diary dates to STYLE (a symbol). The valid styles are described in the documentation of `calendar-date-style'." @@ -934,8 +992,11 @@ calendar-date-display-form (symbol-value (intern-soft (format "calendar-%s-date-display-form" style))) + calendar-month-header + (symbol-value (intern-soft (format "calendar-%s-month-header" style))) diary-date-forms (symbol-value (intern-soft (format "diary-%s-date-forms" style)))) + (calendar-redraw) (calendar-update-mode-line)) (defun european-calendar () @@ -1463,9 +1524,8 @@ (goto-char (point-min)) (calendar-move-to-column indent) (insert - (calendar-string-spread - (list (format "%s %d" (calendar-month-name month) year)) - ?\s calendar-month-digit-width)) + (calendar-string-spread (list calendar-month-header) + ?\s calendar-month-digit-width)) (calendar-ensure-newline) (calendar-insert-at-column indent calendar-intermonth-header trunc) ;; Use the first two characters of each day to head the columns. @@ -2222,9 +2282,12 @@ (- mon2 mon1))) (defvar calendar-font-lock-keywords + ;; Month and year. Not really needed now that calendar-month-header + ;; contains propertize, and not correct for non-american forms + ;; of that variable. `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) " -?[0-9]+") - . font-lock-function-name-face) ; month and year + . font-lock-function-name-face) (,(regexp-opt (list (substring (aref calendar-day-name-array 6) 0 calendar-day-header-width) ------------------------------------------------------------ revno: 110095 fixes bug: http://debbugs.gnu.org/12469 committer: Chong Yidong branch nick: trunk timestamp: Wed 2012-09-19 14:51:33 +0800 message: * killing.texi (Yanking): Minor clarification. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-09-17 03:24:32 +0000 +++ doc/emacs/ChangeLog 2012-09-19 06:51:33 +0000 @@ -1,3 +1,7 @@ +2012-09-19 Chong Yidong + + * killing.texi (Yanking): Minor clarification (Bug#12469). + 2012-09-17 Chong Yidong * building.texi (GDB User Interface Layout): Remove reference to === modified file 'doc/emacs/killing.texi' --- doc/emacs/killing.texi 2012-05-27 01:25:06 +0000 +++ doc/emacs/killing.texi 2012-09-19 06:51:33 +0000 @@ -289,7 +289,7 @@ On graphical displays, @kbd{C-y} first checks if another application has placed any text in the system clipboard more recently than the -last Emacs kill. If so, it inserts the text in the clipboard instead. +last Emacs kill. If so, it inserts the clipboard's text instead. Thus, Emacs effectively treats ``cut'' or ``copy'' clipboard operations performed in other applications like Emacs kills, except that they are not recorded in the kill ring. @xref{Cut and Paste},