changeset 108046:f61e8ca6c2fd

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Mon, 12 Apr 2010 22:58:14 +0000
parents ad01848d2984 (current diff) 2cdeb4c70d45 (diff)
children bf9a29f59be6
files
diffstat 12 files changed, 241 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Mon Apr 12 01:03:06 2010 +0000
+++ b/lib-src/ChangeLog	Mon Apr 12 22:58:14 2010 +0000
@@ -1,3 +1,8 @@
+2010-04-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* Makefile.in (ALL_CFLAGS, LINK_CFLAGS, CPP_CFLAGS): Move to the
+	non-cpp section.
+
 2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE): Define using
--- a/lib-src/Makefile.in	Mon Apr 12 01:03:06 2010 +0000
+++ b/lib-src/Makefile.in	Mon Apr 12 22:58:14 2010 +0000
@@ -152,6 +152,12 @@
 ## Extra libraries to use when linking movemail.
 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
 
+# Those files shared with other GNU utilities need HAVE_CONFIG_H
+# defined before they know they can take advantage of the information
+# in ../src/config.h.
+ALL_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
+LINK_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
+CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
 
 # ========================== start of cpp stuff =======================
 /* From here on, comments must be done in C syntax.  */
@@ -185,15 +191,6 @@
 
 LOADLIBES=LIBS_SYSTEM LIBS_MACHINE
 
-/* Those files shared with other GNU utilities need HAVE_CONFIG_H
-   defined before they know they can take advantage of the information
-   in ../src/config.h.  */
-ALL_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
-LINK_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
-CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
 
 .SUFFIXES: .m
 
--- a/lisp/ChangeLog	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/ChangeLog	Mon Apr 12 22:58:14 2010 +0000
@@ -1,3 +1,42 @@
+2010-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-dir.el (vc-dir-kill-line): New command.
+	(vc-dir-mode-map): Bind it to C-k.
+
+	* bookmark.el (bookmark-insert-location): Handle a nil filename.
+
+	* woman.el: Add bookmark declarations to silence the compiler.
+	(bookmark-prop-get): Use `man-args' rather than `filename' as a first
+	step to compatibility between man and woman bookmarks.
+	Adjust for Man-default-bookmark-title renaming.
+	(woman-bookmark-jump): Adjust accordingly.  Don't forget to autoload.
+
+	* man.el: Add bookmark declarations to silence the compiler.
+	(Man-name-local-regexp): Make it match NAME as well.
+	(Man-getpage-in-background): Return the buffer.
+	(Man-notify-when-ready): Use `case'.
+	(man-set-default-bookmark-title): Rename to Man-default-bookmark-title.
+	Don't hardcode "NAME".  Simplify.
+	(Man-bookmark-make-record): Use Man-arguments rather than buffer-name.
+	Rename from Man-bookmark-make-record.
+	(Man-bookmark-jump): Rename from man-bookmark-jump.  Simplify now that
+	we have the actual man-args.  Use Man-getpage-in-background rather
+	than `man' since the arg is already processed.  Let bookmark.el do the
+	window handling.  Only wait for the relevant process.
+	Don't forget to autoload.
+
+	* bookmark.el (bookmark-default-file): Use locate-user-emacs-file.
+
+2010-04-12  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+	* woman.el (woman-bookmark-make-record, woman-bookmark-jump):
+	New functions.
+	(woman-mode): Setup bookmark support.
+
+	* man.el (man-set-default-bookmark-title, man-bookmark-make-record)
+	(man-bookmark-jump): New functions.
+	(Man-mode): Setup bookmark support.
+
 2010-04-10  Jari Aalto  <jari.aalto@cante.net>
 
 	* comint.el (comint-password-prompt-regexp): Use regexp-opt, and
@@ -13,10 +52,9 @@
 
 	* net/tramp.el (tramp-completion-function-alist)
 	(tramp-file-name-regexp, tramp-chunksize)
-	(tramp-local-coding-commands, tramp-remote-coding-commands): Fix
-	docstring.
-	(tramp-remote-process-environment): Use `format' instead of
-	`concat'.
+	(tramp-local-coding-commands, tramp-remote-coding-commands):
+	Fix docstring.
+	(tramp-remote-process-environment): Use `format' instead of `concat'.
 	(tramp-handle-directory-files-and-attributes)
 	(tramp-get-remote-path): Use `copy-tree'.
 	(tramp-handle-file-name-all-completions): Backward/ XEmacs
@@ -24,11 +62,11 @@
 	`read-file-name-completion-ignore-case' does not exist.
 	(tramp-do-copy-or-rename-file-directly): Do not use
 	`tramp-handle-file-remote-p'.
-	(tramp-do-copy-or-rename-file-out-of-band): Use
-	`tramp-compat-delete-directory'.
+	(tramp-do-copy-or-rename-file-out-of-band):
+	Use `tramp-compat-delete-directory'.
 	(tramp-do-copy-or-rename-file-out-of-band)
-	(tramp-compute-multi-hops, tramp-maybe-open-connection): Use
-	`format-spec-make'.
+	(tramp-compute-multi-hops, tramp-maybe-open-connection):
+	Use `format-spec-make'.
 	(tramp-find-foreign-file-name-handler)
 	(tramp-advice-make-auto-save-file-name)
 	(tramp-set-auto-save-file-modes): Remove superfluous check for
@@ -38,8 +76,8 @@
 	(tramp-check-for-regexp): Use (forward-line 1).
 	(tramp-set-auto-save-file-modes): Adapt version check.
 
-	* net/tramp-compat.el (tramp-advice-file-expand-wildcards): Wrap
-	call of `featurep' for 2nd argument.
+	* net/tramp-compat.el (tramp-advice-file-expand-wildcards):
+	Wrap call of `featurep' for 2nd argument.
 	(tramp-compat-make-temp-file): Simplify fallback implementation.
 	(tramp-compat-copy-tree): Remove function.
 	(tramp-compat-delete-directory): Provide implementation for older
@@ -69,8 +107,8 @@
 	Add --author support to git commit.
 	* vc-git.el (vc-git-checkin): Pass extra-args to the commit command.
 	(vc-git-log-edit-mode): New minor mode.
-	(log-edit-mode, log-edit-extra-flags, log-edit-mode): New
-	declarations.
+	(log-edit-mode, log-edit-extra-flags, log-edit-mode):
+	New declarations.
 
 2010-04-09  Eric Raymond  <esr@snark.thyrsus.com>
 
--- a/lisp/bookmark.el	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/bookmark.el	Mon Apr 12 22:58:14 2010 +0000
@@ -92,7 +92,7 @@
   (if bookmark-file
       ;; In case user set `bookmark-file' in her .emacs:
       bookmark-file
-    (convert-standard-filename "~/.emacs.bmk"))
+    (locate-user-emacs-file "bookmarks" ".emacs.bmk"))
   "File in which to save bookmarks by default."
   :type 'file
   :group 'bookmark)
@@ -1176,7 +1176,9 @@
   (or no-history (bookmark-maybe-historicize-string bookmark))
   (let ((start (point)))
     (prog1
-	(insert (bookmark-location bookmark)) ; *Return this line*
+        ;; FIXME: Each bookmark should come with a `location' method
+        ;; rather than just say "-- no file --".
+	(insert (or (bookmark-location bookmark) "   -- no file --"))
       (if (display-mouse-p)
 	  (add-text-properties
 	   start
--- a/lisp/gnus/ChangeLog	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/gnus/ChangeLog	Mon Apr 12 22:58:14 2010 +0000
@@ -1,3 +1,18 @@
+2010-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* gnus-sum.el: Add bookmark declarations to silence the compiler.
+	(gnus-mark-xrefs-as-read, gnus-summary-limit-to-bodies):
+	Use with-current-buffer to silence the byte-compiler.
+	(gnus-summary-bookmark-make-record): Use derived-mode-p and don't
+	bother to require `gnus'.
+	(gnus-summary-bookmark-jump): Don't forget to autoload.  Simplify.
+
+2010-04-12  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+	* gnus-sum.el (gnus-summary-bookmark-make-record)
+	(gnus-summary-bookmark-jump): New functions.
+	(gnus-summary-mode): Setup bookmark support.
+
 2010-04-01  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system
--- a/lisp/gnus/gnus-sum.el	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/gnus/gnus-sum.el	Mon Apr 12 22:58:14 2010 +0000
@@ -3017,7 +3017,7 @@
 
 
 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
-
+(defvar bookmark-make-record-function)
 
 
 (defun gnus-summary-mode (&optional group)
@@ -3072,6 +3072,8 @@
   (gnus-run-mode-hooks 'gnus-summary-mode-hook)
   (turn-on-gnus-mailing-list-mode)
   (mm-enable-multibyte)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'gnus-summary-bookmark-make-record)
   (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
   (gnus-update-summary-mark-positions))
 
@@ -6090,8 +6092,7 @@
   "Look through all the headers and mark the Xrefs as read."
   (let ((virtual (gnus-virtual-group-p from-newsgroup))
 	name info xref-hashtb idlist method nth4)
-    (save-excursion
-      (set-buffer gnus-group-buffer)
+    (with-current-buffer gnus-group-buffer
       (when (setq xref-hashtb
 		  (gnus-create-xref-hashtb from-newsgroup headers unreads))
 	(mapatoms
@@ -8341,8 +8342,7 @@
     (dolist (data gnus-newsgroup-data)
       (let (gnus-mark-article-hook)
 	(gnus-summary-select-article t t nil (gnus-data-number data)))
-      (save-excursion
-	(set-buffer gnus-article-buffer)
+      (with-current-buffer gnus-article-buffer
 	(article-goto-body)
 	(let* ((case-fold-search t)
 	       (found (if headersp
@@ -9026,7 +9026,7 @@
       (setq group (format "%s-%d" gnus-newsgroup-name article))
       (gnus-summary-remove-process-mark article)
       (when (gnus-summary-display-article article)
-	(save-excursion
+	(save-excursion ;;What for?
 	  (with-temp-buffer
 	    (insert-buffer-substring gnus-original-article-buffer)
 	    ;; Remove some headers that may lead nndoc to make
@@ -12640,6 +12640,41 @@
 	  (gnus-summary-limit (gnus-sorted-nunion old new))))
     (gnus-summary-position-point)))
 
+;;; Bookmark support for Gnus.
+(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+
+(defun gnus-summary-bookmark-make-record ()
+  "Make a bookmark entry for a Gnus summary buffer."
+  (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
+    (error "Please retry from the Gnus summary buffer")) ;[1]
+  (let* ((subject (elt (gnus-summary-article-header) 1))
+         (grp     (car gnus-article-current))
+         (art     (cdr gnus-article-current))
+         (head    (gnus-summary-article-header art))
+         (id      (mail-header-id head)))
+    `(,subject
+      ,@(bookmark-make-record-default 'point-only)
+        (group . ,grp) (article . ,art)
+        (message-id . ,id) (handler . gnus-summary-bookmark-jump))))
+
+;;;###autoload
+(defun gnus-summary-bookmark-jump (bookmark)
+  "Handler function for record returned by `gnus-summary-bookmark-make-record'.
+BOOKMARK is a bookmark name or a bookmark record."
+  (let ((group    (bookmark-prop-get bookmark 'group))
+        (article  (bookmark-prop-get bookmark 'article))
+        (id       (bookmark-prop-get bookmark 'message-id)))
+    (gnus-fetch-group group (list article))
+    (gnus-summary-insert-cached-articles)
+    (gnus-summary-goto-article id nil 'force)
+    (bookmark-default-handler
+     `(""
+       (buffer . ,(current-buffer))
+       . ,(bookmark-get-bookmark-record bookmark)))))
+
 (gnus-summary-make-all-marking-commands)
 
 (gnus-ems-redefine)
--- a/lisp/man.el	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/man.el	Mon Apr 12 22:58:14 2010 +0000
@@ -221,6 +221,11 @@
   :type '(repeat string)
   :group 'man)
 
+(defcustom Man-name-local-regexp (concat "^" (regexp-opt '("NOM" "NAME")) "$")
+  "Regexp that matches the text that precedes the command's name.
+Used in `bookmark-set' to get the default bookmark name."
+  :type 'string :group 'bookmark)
+
 (defvar manual-program "man"
   "The name of the program that produces man pages.")
 
@@ -883,7 +888,8 @@
     (man man-args)))
 
 (defun Man-getpage-in-background (topic)
-  "Use TOPIC to build and fire off the manpage and cleaning command."
+  "Use TOPIC to build and fire off the manpage and cleaning command.
+Return the buffer in which the manpage will appear."
   (let* ((man-args topic)
 	 (bufname (concat "*Man " man-args "*"))
 	 (buffer  (get-buffer bufname)))
@@ -961,15 +967,16 @@
 			   (format "exited abnormally with code %d"
 				   exit-status)))
 		(setq msg exit-status))
-	    (Man-bgproc-sentinel bufname msg)))))))
+	    (Man-bgproc-sentinel bufname msg)))))
+    buffer))
 
 (defun Man-notify-when-ready (man-buffer)
   "Notify the user when MAN-BUFFER is ready.
 See the variable `Man-notify-method' for the different notification behaviors."
   (let ((saved-frame (with-current-buffer man-buffer
 		       Man-original-frame)))
-    (cond
-     ((eq Man-notify-method 'newframe)
+    (case Man-notify-method
+     (newframe
       ;; Since we run asynchronously, perhaps while Emacs is waiting
       ;; for input, we must not leave a different buffer current.  We
       ;; can't rely on the editor command loop to reselect the
@@ -980,28 +987,27 @@
           (set-window-dedicated-p (frame-selected-window frame) t)
 	  (or (display-multi-frame-p frame)
 	      (select-frame frame)))))
-     ((eq Man-notify-method 'pushy)
+     (pushy
       (switch-to-buffer man-buffer))
-     ((eq Man-notify-method 'bully)
+     (bully
       (and (frame-live-p saved-frame)
 	   (select-frame saved-frame))
       (pop-to-buffer man-buffer)
       (delete-other-windows))
-     ((eq Man-notify-method 'aggressive)
+     (aggressive
       (and (frame-live-p saved-frame)
 	   (select-frame saved-frame))
       (pop-to-buffer man-buffer))
-     ((eq Man-notify-method 'friendly)
+     (friendly
       (and (frame-live-p saved-frame)
 	   (select-frame saved-frame))
       (display-buffer man-buffer 'not-this-window))
-     ((eq Man-notify-method 'polite)
+     (polite
       (beep)
       (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-     ((eq Man-notify-method 'quiet)
+     (quiet
       (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-     ((or (eq Man-notify-method 'meek)
-	  t)
+     (t ;; meek
       (message ""))
      )))
 
@@ -1269,6 +1275,8 @@
 ;; ======================================================================
 ;; set up manual mode in buffer and build alists
 
+(defvar bookmark-make-record-function)
+
 (put 'Man-mode 'mode-class 'special)
 
 (defun Man-mode ()
@@ -1325,6 +1333,8 @@
   (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
   (set (make-local-variable 'outline-regexp) Man-heading-regexp)
   (set (make-local-variable 'outline-level) (lambda () 1))
+  (set (make-local-variable 'bookmark-make-record-function)
+       'Man-bookmark-make-record)
   (Man-build-page-list)
   (Man-strip-page-headers)
   (Man-unindent)
@@ -1659,6 +1669,44 @@
                  (setq path nil))
         (setq complete-path nil)))
     complete-path))
+
+;;; Bookmark Man Support
+(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+
+(defun Man-default-bookmark-title ()
+  "Default bookmark name for Man or WoMan pages.
+Uses `Man-name-local-regexp'."
+  (save-excursion
+    (goto-char (point-min))
+    (when (re-search-forward Man-name-local-regexp nil t)
+      (skip-chars-forward "\n\t ")
+      (buffer-substring-no-properties (point) (line-end-position)))))
+
+(defun Man-bookmark-make-record ()
+  "Make a bookmark entry for a Man buffer."
+  `(,(Man-default-bookmark-title)
+    ,@(bookmark-make-record-default 'point-only)
+      (man-args . ,Man-arguments)
+      (handler . Man-bookmark-jump)))
+
+;;;###autoload
+(defun Man-bookmark-jump (bookmark)
+  "Default bookmark handler for Man buffers."
+  (let* ((man-args (bookmark-prop-get bookmark 'man-args))
+         ;; Let bookmark.el do the window handling.
+         ;; This let-binding needs to be active during the call to both
+         ;; Man-getpage-in-background and accept-process-output.
+         (Man-notify-method 'meek)
+         (buf (Man-getpage-in-background man-args))
+         (proc (get-buffer-process buf)))
+    (while (and proc (eq (process-status proc) 'run))
+      (accept-process-output proc))
+    (bookmark-default-handler
+     `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
+
 
 ;; Init the man package variables, if not already done.
 (Man-init-defvars)
--- a/lisp/vc-dir.el	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/vc-dir.el	Mon Apr 12 22:58:14 2010 +0000
@@ -263,6 +263,7 @@
     (define-key map [mouse-2] 'vc-dir-toggle-mark)
     (define-key map [follow-link] 'mouse-face)
     (define-key map "x" 'vc-dir-hide-up-to-date)
+    (define-key map [?\C-k] 'vc-dir-kill-line)
     (define-key map "S" 'vc-dir-search) ;; FIXME: Maybe use A like dired?
     (define-key map "Q" 'vc-dir-query-replace-regexp)
     (define-key map (kbd "M-s a C-s")   'vc-dir-isearch)
@@ -1088,6 +1089,13 @@
 	    (ewoc-delete vc-ewoc crt))
 	  (setq crt prev)))))
 
+(defun vc-dir-kill-line ()
+  "Remove the current line from display."
+  (interactive)
+  (let ((crt (ewoc-locate vc-ewoc))
+        (inhibit-read-only t))
+    (ewoc-delete vc-ewoc crt)))
+
 (defun vc-dir-printer (fileentry)
   (vc-call-backend vc-dir-backend 'dir-printer fileentry))
 
--- a/lisp/woman.el	Mon Apr 12 01:03:06 2010 +0000
+++ b/lisp/woman.el	Mon Apr 12 22:58:14 2010 +0000
@@ -1897,6 +1897,7 @@
   (setq woman-emulation value)
   (woman-reformat-last-file))
 
+(defvar bookmark-make-record-function)
 (put 'woman-mode 'mode-class 'special)
 
 (defun woman-mode ()
@@ -1934,6 +1935,9 @@
        ;; `make-local-variable' in case imenu not yet loaded!
        woman-imenu-generic-expression)
   (set (make-local-variable 'imenu-space-replacement) " ")
+  ;; Bookmark support.
+  (set (make-local-variable 'bookmark-make-record-function)
+       'woman-bookmark-make-record)
   ;; For reformat ...
   ;; necessary when reformatting a file in its old buffer:
   (setq imenu--last-menubar-index-alist nil)
@@ -4516,6 +4520,35 @@
 		    (recenter 0))))))))
   nil)					; for woman-file-readable-p etc.
 
+;;; Bookmark Woman support.
+(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+
+;; FIXME: woman.el and man.el should be better integrated so, for
+;; example, bookmarks of one can be used with the other.
+
+(defun woman-bookmark-make-record ()
+  "Make a bookmark entry for a Woman buffer."
+  `(,(Man-default-bookmark-title)
+    ,@(bookmark-make-record-default 'point-only)
+    ;; Use the same form as man's bookmarks, as much as possible.
+    (man-args . ,woman-last-file-name)
+    (handler . woman-bookmark-jump)))
+
+;;;###autoload
+(defun woman-bookmark-jump (bookmark)
+  "Default bookmark handler for Woman buffers."
+  (let* ((file (bookmark-prop-get bookmark 'man-args))
+         ;; FIXME: we need woman-find-file-noselect, since
+         ;; save-window-excursion can't protect us from the case where
+         ;; woman-find-file creates a new frame.
+         (buf  (save-window-excursion
+                 (woman-find-file file) (current-buffer))))
+    (bookmark-default-handler
+     `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
+
 (provide 'woman)
 
 ;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651
--- a/src/ChangeLog	Mon Apr 12 01:03:06 2010 +0000
+++ b/src/ChangeLog	Mon Apr 12 22:58:14 2010 +0000
@@ -1,3 +1,12 @@
+2010-04-12  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xfns.c (select_visual): Don't call error if XGetVisualInfo returns
+	more than one visual (Bug#5938).
+
+2010-04-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE): Undefine.
+
 2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Remove C_SWITCH_SYSTEM_TEMACS.
--- a/src/Makefile.in	Mon Apr 12 01:03:06 2010 +0000
+++ b/src/Makefile.in	Mon Apr 12 22:58:14 2010 +0000
@@ -94,6 +94,11 @@
 DEPFLAGS = -MMD -MF deps/$*.d
 #endif
 
+/* Undefine until the user can be moved in the non-cpp section. */
+#undef C_SWITCH_SYSTEM
+#undef C_SWITCH_MACHINE
+#undef C_SWITCH_X_SITE
+
 /* Do not let the file name mktime.c get messed up.  */
 #ifdef mktime
 #undef mktime
@@ -250,6 +255,10 @@
    -DHAVE_CONFIG_H is needed for some other files to take advantage of
    the information in ``config.h''.  */
 
+#undef C_SWITCH_MACHINE
+#undef C_SWITCH_SYSTEM
+#undef C_SWITCH_X_SITE
+
 /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
    since it may have -I options that should override those two.  */
 ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
--- a/src/xfns.c	Mon Apr 12 01:03:06 2010 +0000
+++ b/src/xfns.c	Mon Apr 12 22:58:14 2010 +0000
@@ -4129,7 +4129,7 @@
       vinfo_template.screen = XScreenNumberOfScreen (screen);
       vinfo = XGetVisualInfo (dpy, VisualIDMask | VisualScreenMask,
 			      &vinfo_template, &n_visuals);
-      if (n_visuals != 1)
+      if (n_visuals <= 0)
 	fatal ("Can't get proper X visual info");
 
       dpyinfo->n_planes = vinfo->depth;