Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 104159. ------------------------------------------------------------ revno: 104159 committer: Chong Yidong branch nick: trunk timestamp: Sun 2011-05-08 01:17:17 -0400 message: Perform grep-mode's buffer modifications in a process filter (Bug#7952) * progmodes/grep.el (grep-mode-font-lock-keywords): Remove buffer-changing entries. (grep-filter): New function. (grep-mode): Add it to compilation-filter-hook. * progmodes/compile.el (compilation-filter-hook) (compilation-filter-start): New defvars. (compilation-filter): Call compilation-filter-hook prior to updating the process mark. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-05-07 07:45:35 +0000 +++ etc/NEWS 2011-05-08 05:17:17 +0000 @@ -377,9 +377,15 @@ ** comint and modes derived from it use the generic completion code. -** The compile.el mode can be used without font-lock-mode. +** Compilation mode + +*** Compilation mode can be used without font-lock-mode. `compilation-parse-errors-function' is now obsolete. +*** `compilation-filter-start' is let-bound to the start of the text +inserted by the compilation filter function, when calling +compilation-filter-hook. + ** The Landmark game is now invoked with `landmark', not `lm'. ** Prolog mode has been completely revamped, with lots of additional === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-05-08 02:33:28 +0000 +++ lisp/ChangeLog 2011-05-08 05:17:17 +0000 @@ -1,3 +1,15 @@ +2011-05-08 Chong Yidong + + * progmodes/grep.el (grep-mode-font-lock-keywords): Remove + buffer-changing entries. + (grep-filter): New function. + (grep-mode): Add it to compilation-filter-hook. + + * progmodes/compile.el (compilation-filter-hook) + (compilation-filter-start): New defvars. + (compilation-filter): Call compilation-filter-hook prior to + updating the process mark. + 2011-05-08 Stefan Monnier * emacs-lisp/eieio.el (defmethod): Fix typo in last change. === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2011-04-22 18:44:26 +0000 +++ lisp/progmodes/compile.el 2011-05-08 05:17:17 +0000 @@ -64,6 +64,16 @@ integer) :group 'compilation) +(defvar compilation-filter-hook nil + "Hook run after `compilation-filter' has inserted a string into the buffer. +It is called with the variable `compilation-filter-start' bound +to the position of the start of the inserted text, and point at +its end.") + +(defvar compilation-filter-start nil + "Start of the text inserted by `compilation-filter'. +This is bound to a buffer position before running `compilation-filter-hook'.") + (defvar compilation-first-column 1 "*This is how compilers number the first column, usually 1 or 0.") @@ -2038,11 +2048,12 @@ ;; If we are inserting at the end of the accessible part of the ;; buffer, keep the inserted text visible. (min (point-min-marker)) - (max (copy-marker (point-max) t))) + (max (copy-marker (point-max) t)) + (compilation-filter-start (marker-position (process-mark proc)))) (unwind-protect (progn (widen) - (goto-char (process-mark proc)) + (goto-char compilation-filter-start) ;; We used to use `insert-before-markers', so that windows with ;; point at `process-mark' scroll along with the output, but we ;; now use window-point-insertion-type instead. === modified file 'lisp/progmodes/grep.el' --- lisp/progmodes/grep.el 2011-04-02 18:52:08 +0000 +++ lisp/progmodes/grep.el 2011-05-08 05:17:17 +0000 @@ -1,4 +1,4 @@ -;;; grep.el --- run Grep as inferior of Emacs, parse match messages +;;; grep.el --- run `grep' and display the results ;; Copyright (C) 1985-1987, 1993-1999, 2001-2011 ;; Free Software Foundation, Inc. @@ -33,7 +33,7 @@ (defgroup grep nil - "Run grep as inferior of Emacs, parse error messages." + "Run `grep' and display the results." :group 'tools :group 'processes) @@ -399,26 +399,7 @@ (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t) (1 grep-error-face) (2 grep-error-face nil t)) - ("^.+?-[0-9]+-.*\n" (0 grep-context-face)) - ;; Highlight grep matches and delete markers. - ;; FIXME: Modifying the buffer text from font-lock is a bad idea! - ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" - ;; Refontification does not work after the markers have been - ;; deleted. So we use the font-lock-face property here as Font - ;; Lock does not clear that. - (2 (list 'face nil 'font-lock-face grep-match-face)) - ((lambda (bound)) - (progn - ;; Delete markers with `replace-match' because it updates - ;; the match-data, whereas `delete-region' would render it obsolete. - (syntax-ppss-flush-cache (match-beginning 0)) - (replace-match "" t t nil 3) - (replace-match "" t t nil 1)))) - ("\033\\[[0-9;]*[mK]" - ;; Delete all remaining escape sequences - ((lambda (bound)) - (syntax-ppss-flush-cache (match-beginning 0)) - (replace-match "" t t)))) + ("^.+?-[0-9]+-.*\n" (0 grep-context-face))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") @@ -491,6 +472,22 @@ (cons msg code)))) (run-hooks 'grep-setup-hook)) +(defun grep-filter () + "Handle match highlighting escape sequences inserted by the grep process. +This function is called from `compilation-filter-hook'." + (save-excursion + (let ((end (point-marker))) + ;; Highlight grep matches and delete marking sequences. + (goto-char compilation-filter-start) + (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1) + (replace-match (propertize (match-string 1) + 'face nil 'font-lock-face grep-match-face) + t t)) + ;; Delete all remaining escape sequences + (goto-char compilation-filter-start) + (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) + (replace-match "" t t))))) + (defun grep-probe (command args &optional func result) (let (process-file-side-effects) (equal (condition-case nil @@ -697,7 +694,8 @@ grep-regexp-alist) (set (make-local-variable 'compilation-process-setup-function) 'grep-process-setup) - (set (make-local-variable 'compilation-disable-input) t)) + (set (make-local-variable 'compilation-disable-input) t) + (add-hook 'compilation-filter-hook 'grep-filter nil t)) ;;;###autoload ------------------------------------------------------------ revno: 104158 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2011-05-07 23:33:28 -0300 message: * lisp/emacs-lisp/eieio.el (defmethod): Fix typo in last change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-05-07 17:58:40 +0000 +++ lisp/ChangeLog 2011-05-08 02:33:28 +0000 @@ -1,10 +1,14 @@ +2011-05-08 Stefan Monnier + + * emacs-lisp/eieio.el (defmethod): Fix typo in last change. + 2011-05-07 Eli Zaretskii * mail/sendmail.el (send-mail-function): On MS-Windows, default to mailclient-send-it even if window-system is nil. (Bug#8595) - * term/w32console.el (terminal-init-w32console): Call - get-screen-color and use its output to set the frame + * term/w32console.el (terminal-init-w32console): + Call get-screen-color and use its output to set the frame background-mode. (Bug#8597) 2011-05-07 Stefan Monnier @@ -65,8 +69,8 @@ 2011-05-05 Michael Albinus - * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Fix - port computation bug. (Bug#8618) + * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): + Fix port computation bug. (Bug#8618) 2011-05-05 Glenn Morris === modified file 'lisp/emacs-lisp/eieio.el' --- lisp/emacs-lisp/eieio.el 2011-05-07 04:03:49 +0000 +++ lisp/emacs-lisp/eieio.el 2011-05-08 02:33:28 +0000 @@ -1298,11 +1298,11 @@ (let* ((key (if (keywordp (car args)) (pop args))) (params (car args)) (arg1 (car params)) - (args (if (consp arg1) + (fargs (if (consp arg1) (cons (car arg1) (cdr params)) params)) (class (if (consp arg1) (nth 1 arg1))) - (code `(lambda ,args ,@(cdr args)))) + (code `(lambda ,fargs ,@(cdr args)))) `(progn ;; Make sure there is a generic and the byte-compiler sees it. (defgeneric ,method ,args ------------------------------------------------------------ revno: 104157 fixes bug(s): http://debbugs.gnu.org/8595 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-05-07 20:58:40 +0300 message: Fix bug #8595 with setting mailclient-send-it on MS-Windows. lisp/mail/sendmail.el (send-mail-function): On MS-Windows, default to mailclient-send-it even if window-system is nil. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-05-07 17:39:44 +0000 +++ lisp/ChangeLog 2011-05-07 17:58:40 +0000 @@ -1,5 +1,8 @@ 2011-05-07 Eli Zaretskii + * mail/sendmail.el (send-mail-function): On MS-Windows, default to + mailclient-send-it even if window-system is nil. (Bug#8595) + * term/w32console.el (terminal-init-w32console): Call get-screen-color and use its output to set the frame background-mode. (Bug#8597) === modified file 'lisp/mail/sendmail.el' --- lisp/mail/sendmail.el 2011-04-15 13:50:04 +0000 +++ lisp/mail/sendmail.el 2011-05-07 17:58:40 +0000 @@ -141,14 +141,18 @@ ;; standard value. ;;;###autoload (put 'send-mail-function 'standard-value - '((if (and window-system (memq system-type '(darwin windows-nt))) + ;; MS-Windows can access the clipboard even under -nw. + '((if (or (and window-system (eq system-type 'darwin)) + (eq system-type 'windows-nt)) 'mailclient-send-it 'sendmail-send-it))) ;; Useful to set in site-init.el ;;;###autoload (defcustom send-mail-function - (if (and window-system (memq system-type '(darwin windows-nt))) + (if (or (and window-system (eq system-type 'darwin)) + ;; MS-Windows can access the clipboard even under -nw. + (eq system-type 'windows-nt)) 'mailclient-send-it 'sendmail-send-it) "Function to call to send the current buffer as mail. ------------------------------------------------------------ revno: 104156 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-05-07 10:39:44 -0700 message: Remove (tiny change) marker from author now with general assignment, diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-05-07 15:44:19 +0000 +++ lisp/ChangeLog 2011-05-07 17:39:44 +0000 @@ -1974,7 +1974,7 @@ (emerge-protect-metachars): Quote correctly for ms-dos and windows-nt systems. -2011-03-19 Ralph Schleicher (tiny change) +2011-03-19 Ralph Schleicher * info.el (info-initialize): Replace all uses of `:' with path-separator for compatibility with non-Unix systems. ------------------------------------------------------------ revno: 104155 fixes bug(s): http://debbugs.gnu.org/8597 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-05-07 18:44:19 +0300 message: Fix bug #8597 with setting frame background mode on w32 console. src/w32console.c (Fset_screen_color): Doc fix. (Fget_screen_color): New function. (syms_of_ntterm): Defsubr it. lisp/term/w32console.el (terminal-init-w32console): Call get-screen-color and use its output to set the frame background-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-05-07 04:03:49 +0000 +++ lisp/ChangeLog 2011-05-07 15:44:19 +0000 @@ -1,3 +1,9 @@ +2011-05-07 Eli Zaretskii + + * term/w32console.el (terminal-init-w32console): Call + get-screen-color and use its output to set the frame + background-mode. (Bug#8597) + 2011-05-07 Stefan Monnier Make bytecomp.el understand that defmethod defines funs (bug#8631). === modified file 'lisp/term/w32console.el' --- lisp/term/w32console.el 2011-01-25 04:08:28 +0000 +++ lisp/term/w32console.el 2011-05-07 15:44:19 +0000 @@ -59,6 +59,19 @@ (setq colors (cdr colors) color (car colors)))) (clear-face-cache) + ;; Figure out what are the colors of the console window, and set up + ;; the background-mode correspondingly. + (let* ((screen-color (get-screen-color)) + (bg (cadr screen-color)) + (descr (tty-color-by-index bg)) + r g b bg-mode) + (setq r (nth 2 descr) + g (nth 3 descr) + b (nth 4 descr)) + (if (< (+ r g b) (* .6 (+ 65535 65535 65535))) + (setq bg-mode 'dark) + (setq bg-mode 'light)) + (set-terminal-parameter nil 'background-mode bg-mode)) (tty-set-up-initial-frame-faces) (run-hooks 'terminal-init-w32-hook)) === modified file 'src/ChangeLog' --- src/ChangeLog 2011-05-07 11:25:05 +0000 +++ src/ChangeLog 2011-05-07 15:44:19 +0000 @@ -1,5 +1,9 @@ 2011-05-07 Eli Zaretskii + * w32console.c (Fset_screen_color): Doc fix. + (Fget_screen_color): New function. + (syms_of_ntterm): Defsubr it. + * callproc.c (call_process_cleanup): Don't close and unlink the temporary file if Fcall_process didn't create it in the first place. === modified file 'src/w32console.c' --- src/w32console.c 2011-03-14 17:07:53 +0000 +++ src/w32console.c 2011-05-07 15:44:19 +0000 @@ -705,7 +705,9 @@ DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0, - doc: /* Set screen colors. */) + doc: /* Set screen foreground and background colors. + +Arguments should be indices between 0 and 15, see w32console.el. */) (Lisp_Object foreground, Lisp_Object background) { char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4); @@ -714,6 +716,18 @@ return Qt; } +DEFUN ("get-screen-color", Fget_screen_color, Sget_screen_color, 0, 0, 0, + doc: /* Get color indices of the current screen foreground and background. + +The colors are returned as a list of 2 indices (FOREGROUND BACKGROUND). +See w32console.el and `tty-defined-color-alist' for mapping of indices +to colors. */) + (void) +{ + return Fcons (make_number (char_attr_normal & 0x000f), + Fcons (make_number ((char_attr_normal >> 4) & 0x000f), Qnil)); +} + DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0, doc: /* Set cursor size. */) (Lisp_Object size) @@ -739,6 +753,7 @@ w32_use_full_screen_buffer = 0; defsubr (&Sset_screen_color); + defsubr (&Sget_screen_color); defsubr (&Sset_cursor_size); defsubr (&Sset_message_beep); } ------------------------------------------------------------ revno: 104154 [merge] committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-05-07 14:28:55 +0300 message: Adapt the MS-DOS build to latest changes. src/callproc.c (call_process_cleanup): Don't close and unlink the temporary file if Fcall_process didn't create it in the first place. (Fcall_process): Don't create tempfile if stdout of the child process will be redirected to a file specified with `:file'. Don't try to re-open tempfile in that case, and set fd[0] to -1 as cue to call_process_cleanup not to close that handle. msdos/inttypes.h: Include stdint.h. (uintmax_t): Don't define, it is defined in stdint.h. msdos/sedlibmk.inp (am__append_1): Edit to comment out. (am__append_2): Edit to expose. (NEXT_AS_FIRST_DIRECTIVE_STDARG_H, NEXT_STDARG_H, STDARG_H): Edit to empty. (@GL_GENERATE_STDARG_H_TRUE@, @GL_GENERATE_STDARG_H_FALSE@): Edit to comment out corresponding lines. diff: === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2011-04-30 10:31:17 +0000 +++ msdos/ChangeLog 2011-05-07 10:24:55 +0000 @@ -1,3 +1,15 @@ +2011-05-07 Eli Zaretskii + + * inttypes.h: Include stdint.h. + (uintmax_t): Don't define, it is defined in stdint.h. + + * sedlibmk.inp (am__append_1): Edit to comment out. + (am__append_2): Edit to expose. + (NEXT_AS_FIRST_DIRECTIVE_STDARG_H, NEXT_STDARG_H, STDARG_H): Edit + to empty. + (@GL_GENERATE_STDARG_H_TRUE@, @GL_GENERATE_STDARG_H_FALSE@): Edit + to comment out corresponding lines. + 2011-04-30 Eli Zaretskii * inttypes.h: New file. === modified file 'msdos/inttypes.h' --- msdos/inttypes.h 2011-04-30 10:31:17 +0000 +++ msdos/inttypes.h 2011-05-07 10:24:55 +0000 @@ -20,11 +20,15 @@ #ifndef _REPL_INTTYPES_H #define _REPL_INTTYPES_H +/* As of May 2011, DJGPP v2.04 does not include stdint.h in its + inttypes.h, although it should. Therefore, include stdint.h + unconditionally. */ +#include + #if __DJGPP__ > 2 || __DJGPP_MINOR__ >= 4 #include_next #else /* __DJGPP__ < 2.04 */ #include -#define uintmax_t unsigned long long #define strtoumax strtoull #endif /* __DJGPP__ < 2.04 */ === modified file 'msdos/sedlibmk.inp' --- msdos/sedlibmk.inp 2011-04-30 10:31:17 +0000 +++ msdos/sedlibmk.inp 2011-05-07 10:24:55 +0000 @@ -401,6 +401,7 @@ # MKDIR_P lines are edited further below /^MKDIR_P *=/s/@MKDIR_P@// /^NEXT_AS_FIRST_DIRECTIVE_GETOPT_H *=/s/@[^@\n]*@// +/^NEXT_AS_FIRST_DIRECTIVE_STDARG_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_STDDEF_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_STDINT_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_STDIO_H *=/s/@[^@\n]*@// @@ -409,6 +410,7 @@ /^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@// /^NEXT_GETOPT_H *=/s/@[^@\n]*@// +/^NEXT_STDARG_H *=/s/@[^@\n]*@// /^NEXT_STDDEF_H *=/s/@[^@\n]*@// /^NEXT_STDIO_H *=/s/@[^@\n]*@// /^NEXT_STDINT_H *=/s/@[^@\n]*@// @@ -506,6 +508,7 @@ /^SIG_ATOMIC_T_SUFFIX *=/s/@SIG_ATOMIC_T_SUFFIX@// /^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/ /^STDBOOL_H *=/s/@[^@\n]*@// +/^STDARG_H *=/s/@[^@\n]*@// /^STDDEF_H *=/s/@[^@\n]*@// /^STDINT_H *=/s/@[^@\n]*@/stdint.h/ /^SYS_TIME_H_DEFINES_STRUCT_TIMESPEC *=/s/@[^@\n]*@/0/ @@ -514,6 +517,8 @@ /^UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS *=/s/@[^@\n]*@/0/ /^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/ /^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@// +/am__append_1 *=.*gettext\.h/s/@[^@\n]*@/\#/ +/am__append_2 *=.*verify\.h/s/@[^@\n]*@// /^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o md5.o filemode.o/ /^BUILT_SOURCES *=/s/ *inttypes\.h// /^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)// @@ -554,8 +559,10 @@ # Fix the recipes for header files s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/ s/^@GL_GENERATE_STDBOOL_H_FALSE@// +s/^@GL_GENERATE_STDARG_H_TRUE@/\#/ +s/^@GL_GENERATE_STDARG_H_FALSE@/\#/ s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/ -s/^@GL_GENERATE_STDDEF_H_FALSE@// +s/^@GL_GENERATE_STDDEF_H_FALSE@/\#/ s/^@GL_GENERATE_STDINT_H_TRUE@// s/^@GL_GENERATE_STDINT_H_FALSE@/\#/ /^arg-nonnull\.h:/,/^[ ][ ]*mv /c\ === modified file 'src/ChangeLog' --- src/ChangeLog 2011-05-07 04:00:12 +0000 +++ src/ChangeLog 2011-05-07 11:25:05 +0000 @@ -1,3 +1,13 @@ +2011-05-07 Eli Zaretskii + + * callproc.c (call_process_cleanup): Don't close and unlink the + temporary file if Fcall_process didn't create it in the first + place. + (Fcall_process): Don't create tempfile if stdout of the child + process will be redirected to a file specified with `:file'. + Don't try to re-open tempfile in that case, and set fd[0] to -1 as + cue to call_process_cleanup not to close that handle. + 2011-05-07 Ben Key * makefile.w32-in: The bootstrap-temacs rule now makes use of === modified file 'src/callproc.c' --- src/callproc.c 2011-05-06 07:13:19 +0000 +++ src/callproc.c 2011-05-07 11:25:05 +0000 @@ -114,6 +114,7 @@ Lisp_Object fdpid = Fcdr (arg); #if defined (MSDOS) Lisp_Object file; + int fd; #else int pid; #endif @@ -122,9 +123,13 @@ #if defined (MSDOS) /* for MSDOS fdpid is really (fd . tempfile) */ + fd = XFASTINT (Fcar (fdpid)); file = Fcdr (fdpid); - emacs_close (XFASTINT (Fcar (fdpid))); - if (strcmp (SDATA (file), NULL_DEVICE) != 0) + /* FD is -1 and FILE is "" when we didn't actually create a + temporary file in call-process. */ + if (fd >= 0) + emacs_close (fd); + if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0')) unlink (SDATA (file)); #else /* not MSDOS */ pid = XFASTINT (Fcdr (fdpid)); @@ -199,7 +204,7 @@ Lisp_Object error_file; Lisp_Object output_file = Qnil; #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ - char *outf, *tempfile; + char *outf, *tempfile = NULL; int outfilefd; #endif int fd_output = -1; @@ -439,22 +444,23 @@ new_argv[0] = SDATA (path); #ifdef MSDOS /* MW, July 1993 */ - if ((outf = egetenv ("TMPDIR"))) - strcpy (tempfile = alloca (strlen (outf) + 20), outf); - else - { - tempfile = alloca (20); - *tempfile = '\0'; - } - dostounix_filename (tempfile); - if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/') - strcat (tempfile, "/"); - strcat (tempfile, "detmp.XXX"); - mktemp (tempfile); - /* If we're redirecting STDOUT to a file, this is already opened. */ + /* If we're redirecting STDOUT to a file, that file is already open + on fd_output. */ if (fd_output < 0) { + if ((outf = egetenv ("TMPDIR"))) + strcpy (tempfile = alloca (strlen (outf) + 20), outf); + else + { + tempfile = alloca (20); + *tempfile = '\0'; + } + dostounix_filename (tempfile); + if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/') + strcat (tempfile, "/"); + strcat (tempfile, "detmp.XXX"); + mktemp (tempfile); outfilefd = creat (tempfile, S_IREAD | S_IWRITE); if (outfilefd < 0) { emacs_close (filefd); @@ -561,15 +567,21 @@ if (fd_error != outfilefd) emacs_close (fd_error); fd1 = -1; /* No harm in closing that one! */ - /* Since CRLF is converted to LF within `decode_coding', we can - always open a file with binary mode. */ - fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0); - if (fd[0] < 0) + if (tempfile) { - unlink (tempfile); - emacs_close (filefd); - report_file_error ("Cannot re-open temporary file", Qnil); + /* Since CRLF is converted to LF within `decode_coding', we + can always open a file with binary mode. */ + fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0); + if (fd[0] < 0) + { + unlink (tempfile); + emacs_close (filefd); + report_file_error ("Cannot re-open temporary file", + Fcons (tempfile, Qnil)); + } } + else + fd[0] = -1; /* We are not going to read from tempfile. */ #else /* not MSDOS */ #ifdef WINDOWSNT pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, @@ -676,7 +688,7 @@ record_unwind_protect (call_process_cleanup, Fcons (Fcurrent_buffer (), Fcons (make_number (fd[0]), - build_string (tempfile)))); + build_string (tempfile ? tempfile : "")))); #else record_unwind_protect (call_process_cleanup, Fcons (Fcurrent_buffer (), ------------------------------------------------------------ revno: 104153 author: Julien Danjou committer: Katsumi Yamaoka branch nick: trunk timestamp: Sat 2011-05-07 10:41:20 +0000 message: shr.el (shr-link): Make shr-link inherit from link by default. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-05-06 23:33:12 +0000 +++ lisp/gnus/ChangeLog 2011-05-07 10:41:20 +0000 @@ -1,3 +1,7 @@ +2011-05-07 Julien Danjou + + * shr.el (shr-link): Make shr-link inherit from link by default. + 2011-05-06 Teodor Zlatanov * shr.el (shr-urlify, shr-link): Fix shr-link face. === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2011-05-06 23:33:12 +0000 +++ lisp/gnus/shr.el 2011-05-07 10:41:20 +0000 @@ -92,7 +92,7 @@ :group 'shr) (defface shr-link - '((t (:underline t :foreground "yellow" :background "black"))) + '((t (:inherit link))) "Font for link elements." :group 'shr) ------------------------------------------------------------ revno: 104152 committer: Michael Albinus branch nick: trunk timestamp: Sat 2011-05-07 09:45:35 +0200 message: New default value of `ange-ftp-binary-file-name-regexp'. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-05-07 01:22:01 +0000 +++ etc/NEWS 2011-05-07 07:45:35 +0000 @@ -663,6 +663,9 @@ *** The following access methods are discontinued: "ssh1_old", "ssh2_old", "scp1_old", "scp2_old", "imap", "imaps" and "fish". +*** The option `ange-ftp-binary-file-name-regexp' has changed its +default value to "". + ** VC and related modes *** Support for pulling on distributed version control systems. ------------------------------------------------------------ revno: 104151 fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8631 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2011-05-07 01:03:49 -0300 message: Make bytecomp.el understand that defmethod defines functions. * lisp/emacs-lisp/eieio.el (eieio--defalias, eieio--defgeneric-init-form): New functions. (defgeneric, eieio--defmethod): Use them. (eieio-defgeneric): Remove. (defmethod): Call defgeneric in a way visible to the byte-compiler. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-05-07 01:24:04 +0000 +++ lisp/ChangeLog 2011-05-07 04:03:49 +0000 @@ -1,3 +1,12 @@ +2011-05-07 Stefan Monnier + + Make bytecomp.el understand that defmethod defines funs (bug#8631). + * emacs-lisp/eieio.el (eieio--defalias, eieio--defgeneric-init-form): + New functions. + (defgeneric, eieio--defmethod): Use them. + (eieio-defgeneric): Remove. + (defmethod): Call defgeneric in a way visible to the byte-compiler. + 2011-05-07 Glenn Morris * calendar/timeclock.el (timeclock-log-data): Remove unused local. @@ -17,7 +26,7 @@ 2011-05-06 Stefan Monnier * lpr.el (print-region-1): Echo lpr-program's output, so error messages - and warnings are not silently discarded (e.g. use "-d" instead of "-P"). + and warnings are not silently discarded (e.g. use -d instead of -P). 2011-05-06 Glenn Morris === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2011-04-15 12:30:15 +0000 +++ lisp/emacs-lisp/bytecomp.el 2011-05-07 04:03:49 +0000 @@ -4173,6 +4173,7 @@ ;; Compile normally, but deal with warnings for the function being defined. (put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias) +;; Used for eieio--defalias as well. (defun byte-compile-file-form-defalias (form) (if (and (consp (cdr form)) (consp (nth 1 form)) (eq (car (nth 1 form)) 'quote) === modified file 'lisp/emacs-lisp/eieio.el' --- lisp/emacs-lisp/eieio.el 2011-05-05 03:42:09 +0000 +++ lisp/emacs-lisp/eieio.el 2011-05-07 04:03:49 +0000 @@ -420,6 +420,7 @@ (load-library (car (cdr (symbol-function cname)))))) (defun eieio-defclass (cname superclasses slots options-and-doc) + ;; FIXME: Most of this should be moved to the `defclass' macro. "Define CNAME as a new subclass of SUPERCLASSES. SLOTS are the slots residing in that class definition, and options or documentation OPTIONS-AND-DOC is the toplevel documentation for this class. @@ -1139,6 +1140,17 @@ ;;; CLOS methods and generics ;; + +(put 'eieio--defalias 'byte-hunk-handler + #'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler) +(defun eieio--defalias (name body) + "Like `defalias', but with less side-effects. +More specifically, it has no side-effects at all when the new function +definition is the same (`eq') as the old one." + (unless (and (fboundp name) + (eq (symbol-function name) body)) + (defalias name body))) + (defmacro defgeneric (method args &optional doc-string) "Create a generic function METHOD. DOC-STRING is the base documentation for this class. A generic @@ -1147,7 +1159,21 @@ `defgeneric' for you. With this implementation the ARGS are currently ignored. You can use `defgeneric' to apply specialized top level documentation to a method." - `(eieio-defgeneric (quote ,method) ,doc-string)) + `(eieio--defalias ',method + (eieio--defgeneric-init-form ',method ,doc-string))) + +(defun eieio--defgeneric-init-form (method doc-string) + "Form to use for the initial definition of a generic." + (cond + ((or (not (fboundp method)) + (eq 'autoload (car-safe (symbol-function method)))) + ;; Make sure the method tables are installed. + (eieiomt-install method) + ;; Construct the actual body of this function. + (eieio-defgeneric-form method doc-string)) + ((generic-p method) (symbol-function method)) ;Leave it as-is. + (t (error "You cannot create a generic/method over an existing symbol: %s" + method)))) (defun eieio-defgeneric-form (method doc-string) "The lambda form that would be used as the function defined on METHOD. @@ -1237,26 +1263,6 @@ (cdr entry) )))) -(defun eieio-defgeneric (method doc-string) - "Engine part to `defgeneric' macro defining METHOD with DOC-STRING." - (if (and (fboundp method) (not (generic-p method)) - (or (byte-code-function-p (symbol-function method)) - (not (eq 'autoload (car (symbol-function method))))) - ) - (error "You cannot create a generic/method over an existing symbol: %s" - method)) - ;; Don't do this over and over. - (unless (fboundp 'method) - ;; This defun tells emacs where the first definition of this - ;; method is defined. - `(defun ,method nil) - ;; Make sure the method tables are installed. - (eieiomt-install method) - ;; Apply the actual body of this function. - (fset method (eieio-defgeneric-form method doc-string)) - ;; Return the method - 'method)) - (defun eieio-unbind-method-implementations (method) "Make the generic method METHOD have no implementations. It will leave the original generic function in place, @@ -1292,12 +1298,17 @@ (let* ((key (if (keywordp (car args)) (pop args))) (params (car args)) (arg1 (car params)) - (class (if (consp arg1) (nth 1 arg1)))) - `(eieio--defmethod ',method ',key ',class - (lambda ,(if (consp arg1) - (cons (car arg1) (cdr params)) - params) - ,@(cdr args))))) + (args (if (consp arg1) + (cons (car arg1) (cdr params)) + params)) + (class (if (consp arg1) (nth 1 arg1))) + (code `(lambda ,args ,@(cdr args)))) + `(progn + ;; Make sure there is a generic and the byte-compiler sees it. + (defgeneric ,method ,args + ,(or (documentation code) + (format "Generically created method `%s'." method))) + (eieio--defmethod ',method ',key ',class ',code)))) (defun eieio--defmethod (method kind argclass code) "Work part of the `defmethod' macro defining METHOD with ARGS." @@ -1317,11 +1328,11 @@ method-static) ;; Primary key (t method-primary)))) - ;; make sure there is a generic - (eieio-defgeneric - method - (or (documentation code) - (format "Generically created method `%s'." method))) + ;; Make sure there is a generic (when called from defclass). + (eieio--defalias + method (eieio--defgeneric-init-form + method (or (documentation code) + (format "Generically created method `%s'." method)))) ;; create symbol for property to bind to. If the first arg is of ;; the form (varname vartype) and `vartype' is a class, then ;; that class will be the type symbol. If not, then it will fall ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.