Merge changes from emacs-23 branch
authorChong Yidong <cyd@stupidchicken.com>
Sun, 31 Oct 2010 14:40:01 +0000 (10:40 -0400)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 31 Oct 2010 14:40:01 +0000 (10:40 -0400)
17 files changed:
1  2 
doc/lispref/ChangeLog
doc/misc/ChangeLog
doc/misc/cc-mode.texi
lisp/ChangeLog
lisp/cedet/ChangeLog
lisp/menu-bar.el
lisp/net/tramp.el
lisp/play/gomoku.el
lisp/play/landmark.el
lisp/progmodes/sql.el
lisp/select.el
lisp/speedbar.el
lisp/textmodes/bibtex.el
lisp/vc/add-log.el
src/ChangeLog
src/dbusbind.c
src/xterm.c

@@@ -1,8 -1,8 +1,12 @@@
 -2010-10-27  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
+       * maps.texi (Standard Keymaps): Update File menu description.
 -2010-10-22  Eli Zaretskii  <eliz@gnu.org>
 +2010-10-28  Glenn Morris  <rgm@gnu.org>
 +
 +      * Makefile.in (elisp.dvi, elisp.pdf): Also include $emacsdir.
 +
 +2010-10-24  Eli Zaretskii  <eliz@gnu.org>
  
        * display.texi (Window Systems): Deprecate use of window-system as
        a predicate.
@@@ -1,37 -1,12 +1,45 @@@
 -2010-10-30  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
+       * mh-e.texi (Preface, From Bill Wohler): Change 23 to past tense.
 -2010-10-29  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
+       * cc-mode.texi: Remove reference to defunct viewcvs URL.
 -2010-10-22  Juanma Barranquero  <lekktu@gmail.com>
 +2010-10-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 +
 +      * gnus.texi (Client-Side IMAP Splitting): Mention
 +      nnimap-unsplittable-articles.
 +
 +2010-10-29  Julien Danjou  <julien@danjou.info>
 +
 +      * gnus.texi (Finding the News): Remove references to obsoletes
 +      variables `gnus-nntp-server' and `gnus-secondary-servers'.
 +
 +2010-10-29  Eli Zaretskii  <eliz@gnu.org>
 +
 +      * makefile.w32-in (MAKEINFO): Add -I$(emacsdir).
 +      (ENVADD): Remove extra -I$(emacsdir), included in $(MAKEINFO).
 +      ($(infodir)/efaq): Remove -I$(emacsdir), included in $(MAKEINFO).
 +      ($(infodir)/calc, calc.dvi): Depend on $(emacsdir)/emacsver.texi.
 +
 +2010-10-28  Glenn Morris  <rgm@gnu.org>
 +
 +      * Makefile.in (MAKEINFO, ENVADD): Add $emacsdir to include path.
 +      (($(infodir)/calc, calc.dvi, calc.pdf): Depend on emacsver.texi.
 +      ($(infodir)/efaq): Remove -I option now in $MAKEINFO.
 +
 +2010-10-25  Daiki Ueno  <ueno@unixuser.org>
 +
 +      * epa.texi (Mail-mode integration): Add alternative key bindings
 +      for epa-mail commands; escape comma.
 +      Don't use the word "PGP", since it is a non-free program.
 +
 +2010-10-24  Jay Belanger  <jay.p.belanger@gmail.com>
 +
 +      * calc.texi: Use emacsver.texi to determine Emacs version.
 +
 +2010-10-24  Juanma Barranquero  <lekktu@gmail.com>
  
        * gnus.texi (Group Parameters, Buttons): Fix typos.
  
Simple merge
diff --cc lisp/ChangeLog
 -2010-10-30  Michael Albinus  <michael.albinus@gmx.de>
++2010-10-31  Michael Albinus  <michael.albinus@gmx.de>
+       * net/tramp.el (tramp-handle-insert-file-contents): For root,
+       preserve owner and group when editing files.  (Bug#7289)
 -2010-10-29  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * speedbar.el (speedbar-mode):
+       * play/fortune.el (fortune-in-buffer, fortune):
+       * play/gomoku.el (gomoku-mode):
+       * play/landmark.el (lm-mode):
+       * textmodes/bibtex.el (bibtex-validate, bibtex-validate-globally):
+       Replace inappropriate uses of toggle-read-only.  (Bug#7292)
 -2010-10-28  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
+       * select.el (x-selection): Mark it as an obsolete alias.
 -2010-10-27  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
++2010-10-31  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
+       * add-log.el (find-change-log): Use derived-mode-p rather than
+       major-mode (bug#7284).
 -2010-10-27  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
+       * menu-bar.el (menu-bar-files-menu): Make it into an actual alias,
+       rather than just an unused variable that inherits from the real one.
 -2010-10-23  Michael McNamara  <mac@mail.brushroad.com>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
++
++      * comint.el (comint-password-prompt-regexp):
++      Match "enter the password".  (Bug#7224)
++
 +2010-10-31  Alan Mackenzie  <acm@muc.de>
 +
 +      * progmodes/cc-cmds.el (c-mask-paragraph): Fix an off-by-1 error.
 +      This fixes bug #7185.
 +
 +2010-10-30  Chong Yidong  <cyd@stupidchicken.com>
 +
 +      * startup.el (command-line): Search for package directories, and
 +      don't load package.el if none are found.
 +
 +      * emacs-lisp/package.el (describe-package, list-packages): Call
 +      package-initialize if it has not been called yet.
 +
 +2010-10-30  Alan Mackenzie  <acm@muc.de>
 +
 +      * progmodes/cc-fonts.el (c-font-lock-enum-tail): New function
 +      which fontifies the tail of an enum.
 +      (c-basic-matchers-after): Insert a call to the above new function.
 +      This fixes bug #7264.
 +
 +2010-10-30  Glenn Morris  <rgm@gnu.org>
 +
 +      * cus-start.el: Add :set properties for minor modes menu-bar-mode,
 +      tool-bar-mode, transient-mark-mode.  (Bug#7306)
 +      Include the :set property in the dumped Emacs.
 +
 +2010-10-29  Stefan Monnier  <monnier@iro.umontreal.ca>
 +
 +      SMIE: change indent rules format, improve smie-setup.
 +      * emacs-lisp/smie.el (smie-precs-precedence-table)
 +      (smie-merge-prec2s, smie-bnf-precedence-table, smie-prec2-levels):
 +      Mark them pure so the tables gets built at compile time.
 +      (smie-bnf-precedence-table): Store the closer-alist in the table.
 +      (smie-prec2-levels): Preserve the closer-alist.
 +      (smie-blink-matching-open): Be more forgiving in case of indentation.
 +      (smie-hanging-p): Rename from smie-indent--hanging-p.
 +      (smie-bolp): Rename from smie-indent--bolp.
 +      (smie--parent, smie--after): New dynamic vars.
 +      (smie-parent-p, smie-next-p, smie-prev-p): New funs.
 +      (smie-indent-rules): Remove.
 +      (smie-indent--offset-rule): Remove fun.
 +      (smie-rules-function): New var.
 +      (smie-indent--rule): New fun.
 +      (smie-indent--offset, smie-indent-keyword, smie-indent-after-keyword)
 +      (smie-indent-exps): Use it.
 +      (smie-setup): Setup paren blinking; add keyword args for token
 +      functions; extract closer-alist from op-levels.
 +      (smie-indent-debug-log): Remove var.
 +      (smie-indent-debug): Remove fun.
 +      * progmodes/prolog.el (prolog-smie-indent-rules): Remove.
 +      (prolog-smie-rules): New fun to replace it.
 +      (prolog-mode-variables): Simplify.
 +      * progmodes/octave-mod.el (octave-smie-closer-alist): Remove, now that
 +      it's setup automatically.
 +      (octave-smie-indent-rules): Remove.
 +      (octave-smie-rules): New fun to replace it.
 +      (octave-mode): Simplify.
 +
 +2010-10-29  Glenn Morris  <rgm@gnu.org>
 +
 +      * files.el (temporary-file-directory): Remove (already defined in C).
 +      * cus-start.el: Add temporary-file-directory.
 +
 +      * abbrev.el (abbrev-mode):
 +      * composite.el (auto-composition-mode):
 +      * menu-bar.el (menu-bar-mode):
 +      * simple.el (transient-mark-mode):
 +      * tool-bar.el (tool-bar-mode): Adjust the define-minor-mode calls so
 +      that they do not define the associated variables twice.
 +      * simple.el (transient-mark-mode): Remove defvar.
 +      * composite.el (auto-composition-mode): Make variable auto-buffer-local.
 +      * cus-start.el: Add transient-mark-mode, menu-bar-mode, tool-bar-mode.
 +      Handle multiple groups, and also custom-delayed-init-variables.
 +      * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix.
 +
 +2010-10-29  Stefan Monnier  <monnier@iro.umontreal.ca>
 +
 +      * emacs-lisp/pcase.el (pcase): New `string' and `guard' patterns.
 +      (pcase-if): Add one minor optimization.
 +      (pcase-split-equal): Rename from pcase-split-eq.
 +      (pcase-split-member): Rename from pcase-split-memq.
 +      (pcase-u1): Add strings to the member optimization.
 +      Add `guard' variant of predicates.
 +      (pcase-q1): Add string patterns.
 +
 +2010-10-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 +
 +      * vc/log-edit.el (log-edit-rewrite-fixes): State its safety pred.
 +
 +2010-10-28  Glenn Morris  <rgm@gnu.org>
 +
 +      * term/ns-win.el (global-map, menu-bar-final-items, menu-bar-help-menu):
 +      Move menu-bar related settings to ../menu-bar.el.
 +      * menu-bar.el (global-map, menu-bar-final-items, menu-bar-help-menu):
 +      Move ns-specific settings here from term/ns-win.el.
 +
 +      * simple.el (x-selection-owner-p): Remove unused declaration.
 +
 +2010-10-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 +
 +      * minibuffer.el (completion-cycling): New var (bug#7266).
 +      (minibuffer-complete, completion--do-completion):
 +      Use completion--flush-all-sorted-completions.
 +      (minibuffer-complete): Only cycle if completion-cycling is set.
 +      (completion--flush-all-sorted-completions): Unset completion-cycling.
 +      (minibuffer-force-complete): Set completion-cycling.
 +      (completion-all-sorted-completions): Move declaration before first use.
 +
 +2010-10-28  Leo  <sdl.web@gmail.com>
 +
 +      * iswitchb.el (iswitchb-kill-buffer): Avoid `iswitchb-make-buflist'
 +      which changes the order of matches seen by users (bug#7231).
 +
 +2010-10-28  Jes Bodi Klinke  <jes@bodi-klinke.dk>  (tiny change)
 +
 +      * progmodes/compile.el (compilation-mode-font-lock-keywords):
 +      Don't confuse -omega as "-o mega".
 +
 +2010-10-27  Stefan Monnier  <monnier@iro.umontreal.ca>
 +
 +      * vc/log-edit.el (log-edit-rewrite-fixes): New var.
 +      (log-edit-author): New dynamic var.
 +      (log-edit-changelog-ours-p, log-edit-insert-changelog-entries): Use it
 +      to return the author if different from committer.
 +      (log-edit-insert-changelog): Use them to add Author: and Fixes headers.
 +
 +      * play/landmark.el: Adjust commenting convention.
 +      (lm-nil-score): Rename from nil-score.
 +      (Xscore, XXscore, XXXscore, XXXXscore, Oscore, OOscore, OOOscore)
 +      (OOOOscore): Move into a let in lm-score-trans-table.
 +      (lm-winning-threshold, lm-loosing-threshold): Use lm-score-trans-table.
 +
 +      * electric.el (electric-indent-chars): Autoload.
 +      * progmodes/octave-mod.el (octave-mode):
 +      * progmodes/ruby-mode.el (ruby-mode): Take advantage of it.
 +      (ruby-mode-abbrev-table): Merge initialization and declaration.
 +
 +2010-10-27  Glenn Morris  <rgm@gnu.org>
 +
 +      * abbrev.el (abbrev-mode): Remove one of the three definitions of this
 +      variable.
 +
 +      * server.el (server-host, server-port, server-auth-dir): Autoload risky.
 +
 +      * term/ns-win.el: Restore require of cl when compiling.
 +      (menu-bar-final-items): Remove non-existent `windows' menu.
 +      (ns-handle-nxopen): Optionally handle the temp-case.
 +      (ns-handle-nxopentemp): Just call ns-handle-nxopen.
 +      (ns-insert-file, ns-find-file): Use `pop'.
 +
 +2010-10-26  Glenn Morris  <rgm@gnu.org>
 +
 +      * term/common-win.el (xw-defined-colors): Simplify the 'ns case.
 +
 +2010-10-26  Adrian Robert  <Adrian.B.Robert@gmail.com>
 +
 +      * term/ns-win.el (ns-new-frame, ns-show-prefs): Don't add to
 +      global map.
 +      * term/common-win.el (x-setup-function-keys): Remove most of the
 +      keymappings.  Comment on the remaining ones.
 +
 +2010-10-26  Peter Oliver  <p.d.oliver@mavit.org.uk>  (tiny change)
 +
 +      * server.el (server-port): New option.  (Bug#854)
 +      (server-start): Use server-port.
 +
 +2010-10-26  Glenn Morris  <rgm@gnu.org>
 +
 +      * term/ns-win.el (ns-version-string): Remove unused declaration.
 +      (ns-invocation-args): Change to x-invocation-args.
 +      (ns-handle-switch, ns-handle-numeric-switch, ns-handle-iconic)
 +      (ns-handle-name-switch, ns-ignore-2-arg): Remove.
 +      (ns-handle-nxopen, ns-handle-nxopentemp, ns-ignore-1-arg):
 +      Use x-invocation-args instead of ns-invocation-args.
 +      (ns-initialize-window-system, handle-args-function-alist):
 +      Use x-handle-args instead of ns-handle-args.
 +      * term/common-win.el (x-handle-args): Also handle nextstep arguments.
 +      * startup.el (command-line-ns-option-alist): Replace
 +      ns-handle-name-switch, ns-handle-switch, ns-handle-numeric-switch,
 +      ns-handle-iconic with the x- equivalents.
 +
 +      * term/common-win.el (x-select-enable-clipboard):
 +      * term/pc-win.el (x-select-enable-clipboard): Doc fix.
 +
 +      * term/ns-win.el: No need to require cl when compiling.
 +      (x-display-name, x-setup-function-keys, x-select-text, x-colors)
 +      (xw-defined-colors): Use the common-win definitions.
 +      (ns-alternatives-map): Make it an obsolete alias for x-alternatives-map.
 +      (ns-handle-iconic): Make it an alias for x-handle-iconic.
 +      * term/common-win.el (x-select-text, x-alternatives-map)
 +      (x-setup-function-keys, x-colors, xw-defined-colors): Handle 'ns case.
 +      * loadup.el [ns]: Load common-win.
 +
 +2010-10-26  Daiki Ueno  <ueno@unixuser.org>
 +
 +      * epa-mail.el (epa-mail-encrypt): Handle local-part only
 +      recipients; expand mail aliases (Bug#7280).
 +
 +2010-10-25  Glenn Morris  <rgm@gnu.org>
 +
 +      * term/common-win.el (x-handle-switch): Simplify with pop.
 +      Optionally handle numeric switches.
 +      (x-handle-numeric-switch): Just call x-handle-switch.
 +      (x-handle-initial-switch, x-handle-xrm-switch, x-handle-geometry)
 +      (x-handle-name-switch, x-handle-display, x-handle-args):
 +      Simplify with pop.
 +
 +      * term/ns-win.el: Do not require easymenu.
 +      (menu-bar-edit-menu) <copy, paste, paste-from-menu, separator-undo>:
 +      <spell>: Move adjustments to menu-bar.el.
 +      * menu-bar.el (menu-bar-edit-menu) <copy, paste, paste-from-menu>:
 +      <separator-undo, spell>: Move ns-win's adjustments here.
 +      * loadup.el [ns]: Do not load easymenu.
 +
 +2010-10-24  Chong Yidong  <cyd@stupidchicken.com>
 +
 +      * image.el (image-checkbox-checked, image-checkbox-unchecked):
 +      Delete (Bug#7222).
 +
 +      * startup.el (fancy-startup-tail): Instead of using inline images,
 +      refer to image files from etc/.
 +
 +      * wid-edit.el (checkbox): Likewise.
 +      (widget-image-find): Center image specs.
 +
 +2010-10-24  Glenn Morris  <rgm@gnu.org>
 +
 +      * term/ns-win.el (x-select-text): Doc fix.
 +      * w32-fns.el (x-alternatives-map, x-setup-function-keys)
 +      (x-select-text): Move to term/common-win.
 +      * term/w32-win.el (xw-defined-colors): Move to common-win.
 +      * term/x-win.el (xw-defined-colors, x-alternatives-map)
 +      (x-setup-function-keys, x-select-text): Move to common-win.
 +      * term/common-win.el (x-select-text, x-alternatives-map)
 +      (x-setup-function-keys, xw-defined-colors): Merge x- and w32-
 +      definitions here.
 +
 +2010-10-24  T.V. Raman  <tv.raman.tv@gmail.com>  (tiny change)
 +
 +      * net/mairix.el (mairix-searches-mode-map):
 +      * mail/mspools.el (mspools-mode-map): Fix 2010-10-10 change.
 +
 +2010-10-24  Michael McNamara  <mac@mail.brushroad.com>
  
        * verilog-mode.el (verilog-directive-re): Make this variable
        auto-built for efficiency of execution and updating.
@@@ -1,3 -1,17 +1,17 @@@
 -2010-10-29  Glenn Morris  <rgm@gnu.org>
++2010-10-31  Glenn Morris  <rgm@gnu.org>
+       * mode-local.el (mode-local-augment-function-help):
+       * semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons):
+       * semantic/symref/list.el (semantic-symref-results-dump)
+       (semantic-symref-rb-toggle-expand-tag): Replace inappropriate uses
+       of toggle-read-only.
 -2010-10-12  Juanma Barranquero  <lekktu@gmail.com>
++2010-10-31  Juanma Barranquero  <lekktu@gmail.com>
+       * semantic/symref/list.el (semantic-symref-list-rename-open-hits):
+       Fix typo in message.
+       (semantic-symref-list-map-open-hits): Fix typo in docstring.
  2010-09-30  Chong Yidong  <cyd@stupidchicken.com>
  
        * semantic/bovine/el.el:
  (define-key global-map [menu-bar options]
    (cons (purecopy "Options") menu-bar-options-menu))
  (defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
 -(define-key global-map [menu-bar edit] (cons (purecopy "Edit") menu-bar-edit-menu))
 +(define-key global-map [menu-bar edit]
 +  (cons (purecopy "Edit") menu-bar-edit-menu))
  (defvar menu-bar-file-menu (make-sparse-keymap "File"))
 -(define-key global-map [menu-bar file] (cons (purecopy "File") menu-bar-file-menu))
 +(define-key global-map [menu-bar file]
 +  (cons (purecopy "File") menu-bar-file-menu))
 +
 +;; Put "Help" menu at the front, called "Info".
 +(and (featurep 'ns)
 +     (not (eq system-type 'darwin))
 +     (define-key global-map [menu-bar help-menu]
 +       (cons (purecopy "Info") menu-bar-help-menu)))
  
- ;; This alias is for compatibility with 19.28 and before.
- (defvar menu-bar-files-menu menu-bar-file-menu)
+ ;; Only declared obsolete (and only made a proper alias) in 23.3.
+ (define-obsolete-variable-alias 'menu-bar-files-menu 'menu-bar-file-menu "22.1")
  
  ;; This is referenced by some code below; it is defined in uniquify.el
  (defvar uniquify-buffer-name-style)
@@@ -2567,381 -6366,326 +2567,385 @@@ User is always nil.
       (forward-line 1)
       result))
  
 -;;; Internal Functions:
 +;;; Common file name handler functions for different backends:
  
 -(defun tramp-maybe-send-script (vec script name)
 -  "Define in remote shell function NAME implemented as SCRIPT.
 -Only send the definition if it has not already been done."
 -  (let* ((p (tramp-get-connection-process vec))
 -       (scripts (tramp-get-connection-property p "scripts" nil)))
 -    (unless (member name scripts)
 -      (with-progress-reporter vec 5 (format "Sending script `%s'" name)
 -      ;; The script could contain a call of Perl.  This is masked with `%s'.
 -      (tramp-send-command-and-check
 -       vec
 -       (format "%s () {\n%s\n}" name
 -               (format script (tramp-get-remote-perl vec))))
 -      (tramp-set-connection-property p "scripts" (cons name scripts))))))
 -
 -(defun tramp-set-auto-save ()
 -  (when (and ;; ange-ftp has its own auto-save mechanism
 -           (eq (tramp-find-foreign-file-name-handler (buffer-file-name))
 -               'tramp-sh-file-name-handler)
 -             auto-save-default)
 -    (auto-save-mode 1)))
 -(add-hook 'find-file-hooks 'tramp-set-auto-save t)
 -(add-hook 'tramp-unload-hook
 -        (lambda ()
 -          (remove-hook 'find-file-hooks 'tramp-set-auto-save)))
 +(defvar tramp-handle-file-local-copy-hook nil
 +  "Normal hook to be run at the end of `tramp-*-handle-file-local-copy'.")
 +
 +(defvar tramp-handle-write-region-hook nil
 +  "Normal hook to be run at the end of `tramp-*-handle-write-region'.")
 +
 +(defun tramp-handle-directory-file-name (directory)
 +  "Like `directory-file-name' for Tramp files."
 +  ;; If localname component of filename is "/", leave it unchanged.
 +  ;; Otherwise, remove any trailing slash from localname component.
 +  ;; Method, host, etc, are unchanged.  Does it make sense to try
 +  ;; to avoid parsing the filename?
 +  (with-parsed-tramp-file-name directory nil
 +    (if (and (not (zerop (length localname)))
 +           (eq (aref localname (1- (length localname))) ?/)
 +           (not (string= localname "/")))
 +      (substring directory 0 -1)
 +      directory)))
 +
 +(defun tramp-handle-directory-files
 +  (directory &optional full match nosort files-only)
 +  "Like `directory-files' for Tramp files."
 +  ;; FILES-ONLY is valid for XEmacs only.
 +  (when (file-directory-p directory)
 +    (setq directory (file-name-as-directory (expand-file-name directory)))
 +    (let ((temp (nreverse (file-name-all-completions "" directory)))
 +        result item)
 +
 +      (while temp
 +      (setq item (directory-file-name (pop temp)))
 +      (when (and (or (null match) (string-match match item))
 +                 (or (null files-only)
 +                     ;; Files only.
 +                     (and (equal files-only t) (file-regular-p item))
 +                     ;; Directories only.
 +                     (file-directory-p item)))
 +        (push (if full (concat directory item) item)
 +              result)))
 +      (if nosort result (sort result 'string<)))))
 +
 +(defun tramp-handle-directory-files-and-attributes
 +  (directory &optional full match nosort id-format)
 +  "Like `directory-files-and-attributes' for Tramp files."
 +  (mapcar
 +   (lambda (x)
 +     (cons x (tramp-compat-file-attributes
 +            (if full x (expand-file-name x directory)) id-format)))
 +   (directory-files directory full match nosort)))
 +
 +(defun tramp-handle-dired-uncache (dir &optional dir-p)
 +  "Like `dired-uncache' for Tramp files."
 +  ;; DIR-P is valid for XEmacs only.
 +  (with-parsed-tramp-file-name
 +      (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
 +    (tramp-flush-directory-property v localname)))
 +
 +(defun tramp-handle-file-exists-p (filename)
 +  "Like `file-exists-p' for Tramp files."
 +  (not (null (file-attributes filename))))
 +
 +(defun tramp-handle-file-modes (filename)
 +  "Like `file-modes' for Tramp files."
 +  (let ((truename (or (file-truename filename) filename)))
 +    (when (file-exists-p truename)
 +      (tramp-mode-string-to-int (nth 8 (file-attributes truename))))))
 +
 +;; Localname manipulation functions that grok Tramp localnames...
 +(defun tramp-handle-file-name-as-directory (file)
 +  "Like `file-name-as-directory' but aware of Tramp files."
 +  ;; `file-name-as-directory' would be sufficient except localname is
 +  ;; the empty string.
 +  (let ((v (tramp-dissect-file-name file t)))
 +    ;; Run the command on the localname portion only.
 +    (tramp-make-tramp-file-name
 +     (tramp-file-name-method v)
 +     (tramp-file-name-user v)
 +     (tramp-file-name-host v)
 +     (tramp-run-real-handler
 +      'file-name-as-directory (list (or (tramp-file-name-localname v) ""))))))
 +
 +(defun tramp-handle-file-name-completion
 +  (filename directory &optional predicate)
 +  "Like `file-name-completion' for Tramp files."
 +  (unless (tramp-tramp-file-p directory)
 +    (error
 +     "tramp-handle-file-name-completion invoked on non-tramp directory `%s'"
 +     directory))
 +  (try-completion
 +   filename
 +   (mapcar 'list (file-name-all-completions filename directory))
 +   (when predicate
 +     (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
 +
 +(defun tramp-handle-file-name-directory (file)
 +  "Like `file-name-directory' but aware of Tramp files."
 +  ;; Everything except the last filename thing is the directory.  We
 +  ;; cannot apply `with-parsed-tramp-file-name', because this expands
 +  ;; the remote file name parts.  This is a problem when we are in
 +  ;; file name completion.
 +  (let ((v (tramp-dissect-file-name file t)))
 +    ;; Run the command on the localname portion only.
 +    (tramp-make-tramp-file-name
 +     (tramp-file-name-method v)
 +     (tramp-file-name-user v)
 +     (tramp-file-name-host v)
 +     (tramp-run-real-handler
 +      'file-name-directory (list (or (tramp-file-name-localname v) ""))))))
 +
 +(defun tramp-handle-file-name-nondirectory (file)
 +  "Like `file-name-nondirectory' but aware of Tramp files."
 +  (with-parsed-tramp-file-name file nil
 +    (tramp-run-real-handler 'file-name-nondirectory (list localname))))
 +
 +(defun tramp-handle-file-newer-than-file-p (file1 file2)
 +  "Like `file-newer-than-file-p' for Tramp files."
 +  (cond
 +   ((not (file-exists-p file1)) nil)
 +   ((not (file-exists-p file2)) t)
 +   (t (tramp-time-less-p (nth 5 (file-attributes file2))
 +                       (nth 5 (file-attributes file1))))))
 +
 +(defun tramp-handle-file-regular-p (filename)
 +  "Like `file-regular-p' for Tramp files."
 +  (and (file-exists-p filename)
 +       (eq ?- (aref (nth 8 (file-attributes filename)) 0))))
 +
 +(defun tramp-handle-file-remote-p (filename &optional identification connected)
 +  "Like `file-remote-p' for Tramp files."
 +  (let ((tramp-verbose 3))
 +    (when (tramp-tramp-file-p filename)
 +      (let* ((v (tramp-dissect-file-name filename))
 +           (p (tramp-get-connection-process v))
 +           (c (and p (processp p) (memq (process-status p) '(run open)))))
 +      ;; We expand the file name only, if there is already a connection.
 +      (with-parsed-tramp-file-name
 +          (if c (expand-file-name filename) filename) nil
 +        (and (or (not connected) c)
 +             (cond
 +              ((eq identification 'method) method)
 +              ((eq identification 'user) user)
 +              ((eq identification 'host) host)
 +              ((eq identification 'localname) localname)
 +              (t (tramp-make-tramp-file-name method user host "")))))))))
  
 -(defun tramp-run-test (switch filename)
 -  "Run `test' on the remote system, given a SWITCH and a FILENAME.
 -Returns the exit code of the `test' program."
 +(defun tramp-handle-file-symlink-p (filename)
 +  "Like `file-symlink-p' for Tramp files."
    (with-parsed-tramp-file-name filename nil
 -    (tramp-send-command-and-check
 -     v
 -     (format
 -      "%s %s %s"
 -      (tramp-get-test-command v)
 -      switch
 -      (tramp-shell-quote-argument localname)))))
 -
 -(defun tramp-run-test2 (format-string file1 file2)
 -  "Run `test'-like program on the remote system, given FILE1, FILE2.
 -FORMAT-STRING contains the program name, switches, and place holders.
 -Returns the exit code of the `test' program.  Barfs if the methods,
 -hosts, or files, disagree."
 -  (unless (tramp-equal-remote file1 file2)
 -    (with-parsed-tramp-file-name (if (tramp-tramp-file-p file1) file1 file2) nil
 -      (tramp-error
 -       v 'file-error
 -       "tramp-run-test2 only implemented for same method, user, host")))
 -  (with-parsed-tramp-file-name file1 v1
 -    (with-parsed-tramp-file-name file1 v2
 -      (tramp-send-command-and-check
 -       v1
 -       (format format-string
 -             (tramp-shell-quote-argument v1-localname)
 -             (tramp-shell-quote-argument v2-localname))))))
 +    (let ((x (car (file-attributes filename))))
 +      (when (stringp x)
 +      ;; When Tramp is running on VMS, then `file-name-absolute-p'
 +      ;; might do weird things.
 +      (if (file-name-absolute-p x)
 +          (tramp-make-tramp-file-name method user host x)
 +        x)))))
  
 -(defun tramp-buffer-name (vec)
 -  "A name for the connection buffer VEC."
 -  ;; We must use `tramp-file-name-real-host', because for gateway
 -  ;; methods the default port will be expanded later on, which would
 -  ;; tamper the name.
 -  (let ((method (tramp-file-name-method vec))
 -      (user   (tramp-file-name-user vec))
 -      (host   (tramp-file-name-real-host vec)))
 -    (if (not (zerop (length user)))
 -      (format "*tramp/%s %s@%s*" method user host)
 -      (format "*tramp/%s %s*" method host))))
 +(defun tramp-handle-find-backup-file-name (filename)
 +  "Like `find-backup-file-name' for Tramp files."
 +  (with-parsed-tramp-file-name filename nil
 +    ;; We set both variables. It doesn't matter whether it is
 +    ;; Emacs or XEmacs.
 +    (let ((backup-directory-alist
 +         ;; Emacs case.
 +         (when (boundp 'backup-directory-alist)
 +           (if (symbol-value 'tramp-backup-directory-alist)
 +               (mapcar
 +                (lambda (x)
 +                  (cons
 +                   (car x)
 +                   (if (and (stringp (cdr x))
 +                            (file-name-absolute-p (cdr x))
 +                            (not (tramp-file-name-p (cdr x))))
 +                       (tramp-make-tramp-file-name method user host (cdr x))
 +                     (cdr x))))
 +                (symbol-value 'tramp-backup-directory-alist))
 +             (symbol-value 'backup-directory-alist))))
  
 -(defun tramp-delete-temp-file-function ()
 -  "Remove temporary files related to current buffer."
 -  (when (stringp tramp-temp-buffer-file-name)
 -    (condition-case nil
 -      (delete-file tramp-temp-buffer-file-name)
 -      (error nil))))
 +        (bkup-backup-directory-info
 +         ;; XEmacs case.
 +         (when (boundp 'bkup-backup-directory-info)
 +           (if (symbol-value 'tramp-bkup-backup-directory-info)
 +               (mapcar
 +                (lambda (x)
 +                  (nconc
 +                   (list (car x))
 +                   (list
 +                    (if (and (stringp (car (cdr x)))
 +                             (file-name-absolute-p (car (cdr x)))
 +                             (not (tramp-file-name-p (car (cdr x)))))
 +                        (tramp-make-tramp-file-name
 +                         method user host (car (cdr x)))
 +                      (car (cdr x))))
 +                   (cdr (cdr x))))
 +                (symbol-value 'tramp-bkup-backup-directory-info))
 +             (symbol-value 'bkup-backup-directory-info)))))
  
 -(add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function)
 -(add-hook 'tramp-cache-unload-hook
 -        (lambda ()
 -          (remove-hook 'kill-buffer-hook
 -                       'tramp-delete-temp-file-function)))
 +      (tramp-run-real-handler 'find-backup-file-name (list filename)))))
  
 -(defun tramp-get-buffer (vec)
 -  "Get the connection buffer to be used for VEC."
 -  (or (get-buffer (tramp-buffer-name vec))
 -      (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
 -      (setq buffer-undo-list t)
 -      (setq default-directory
 -            (tramp-make-tramp-file-name
 -             (tramp-file-name-method vec)
 -             (tramp-file-name-user vec)
 -             (tramp-file-name-host vec)
 -             "/"))
 -      (current-buffer))))
 +(defun tramp-handle-insert-file-contents
 +  (filename &optional visit beg end replace)
 +  "Like `insert-file-contents' for Tramp files."
 +  (barf-if-buffer-read-only)
 +  (setq filename (expand-file-name filename))
 +  (let (result local-copy remote-copy)
 +    (with-parsed-tramp-file-name filename nil
 +      (unwind-protect
 +        (if (not (file-exists-p filename))
 +            ;; We don't raise a Tramp error, because it might be
 +            ;; suppressed, like in `find-file-noselect-1'.
 +            (signal 'file-error
 +                    (list "File not found on remote host" filename))
  
 -(defun tramp-get-connection-buffer (vec)
 -  "Get the connection buffer to be used for VEC.
 -In case a second asynchronous communication has been started, it is different
 -from `tramp-get-buffer'."
 -  (or (tramp-get-connection-property vec "process-buffer" nil)
 -      (tramp-get-buffer vec)))
 +          (if (and (tramp-local-host-p v)
 +                   (let (file-name-handler-alist)
 +                     (file-readable-p localname)))
 +              ;; Short track: if we are on the local host, we can
 +              ;; run directly.
 +              (setq result
 +                    (tramp-run-real-handler
 +                     'insert-file-contents
 +                     (list localname visit beg end replace)))
 +
 +            ;; When we shall insert only a part of the file, we copy
 +            ;; this part.
 +            (when (or beg end)
 +              (setq remote-copy (tramp-make-tramp-temp-file v))
 +              ;; This is defined in tramp-sh.el.  Let's assume this
 +              ;; is loaded already.
 +              (tramp-compat-funcall 'tramp-send-command
 +               v
 +               (cond
 +                ((and beg end)
 +                 (format "tail -c +%d %s | head -c +%d >%s"
 +                         (1+ beg) (tramp-shell-quote-argument localname)
 +                         (- end beg) remote-copy))
 +                (beg
 +                 (format "tail -c +%d %s >%s"
 +                         (1+ beg) (tramp-shell-quote-argument localname)
 +                         remote-copy))
 +                (end
 +                 (format "head -c +%d %s >%s"
 +                         (1+ end) (tramp-shell-quote-argument localname)
 +                         remote-copy)))))
  
 -(defun tramp-get-connection-process (vec)
 -  "Get the connection process to be used for VEC.
 -In case a second asynchronous communication has been started, it is different
 -from the default one."
 -  (get-process
 -   (or (tramp-get-connection-property vec "process-name" nil)
 -       (tramp-buffer-name vec))))
 +            ;; `insert-file-contents-literally' takes care to avoid
 +            ;; calling jka-compr.  By let-binding
 +            ;; `inhibit-file-name-operation', we propagate that care
 +            ;; to the `file-local-copy' operation.
 +            (setq local-copy
 +                  (let ((inhibit-file-name-operation
 +                         (when (eq inhibit-file-name-operation
 +                                   'insert-file-contents)
 +                           'file-local-copy)))
 +                    (cond
 +                     ((stringp remote-copy)
 +                      (file-local-copy
 +                       (tramp-make-tramp-file-name
 +                        method user host remote-copy)))
 +                     ((stringp tramp-temp-buffer-file-name)
 +                      (copy-file filename tramp-temp-buffer-file-name 'ok)
 +                      tramp-temp-buffer-file-name)
 +                     (t (file-local-copy filename)))))
  
 -(defun tramp-debug-buffer-name (vec)
 -  "A name for the debug buffer for VEC."
 -  ;; We must use `tramp-file-name-real-host', because for gateway
 -  ;; methods the default port will be expanded later on, which would
 -  ;; tamper the name.
 -  (let ((method (tramp-file-name-method vec))
 -      (user   (tramp-file-name-user vec))
 -      (host   (tramp-file-name-real-host vec)))
 -    (if (not (zerop (length user)))
 -      (format "*debug tramp/%s %s@%s*" method user host)
 -      (format "*debug tramp/%s %s*" method host))))
 +            ;; When the file is not readable for the owner, it
 +            ;; cannot be inserted, even it is redable for the group
 +            ;; or for everybody.
 +            (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600"))
  
 -(defconst tramp-debug-outline-regexp
 -  "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
 +            (when (and (null remote-copy)
 +                       (tramp-get-method-parameter
 +                        method 'tramp-copy-keep-tmpfile))
 +              ;; We keep the local file for performance reasons,
 +              ;; useful for "rsync".
 +              (setq tramp-temp-buffer-file-name local-copy)
 +              (put 'tramp-temp-buffer-file-name 'permanent-local t))
  
 -(defun tramp-get-debug-buffer (vec)
 -  "Get the debug buffer for VEC."
 -  (with-current-buffer
 -      (get-buffer-create (tramp-debug-buffer-name vec))
 -    (when (bobp)
 -      (setq buffer-undo-list t)
 -      ;; Activate `outline-mode'.  This runs `text-mode-hook' and
 -      ;; `outline-mode-hook'.  We must prevent that local processes
 -      ;; die.  Yes: I've seen `flyspell-mode', which starts "ispell".
 -      ;; Furthermore, `outline-regexp' must have the correct value
 -      ;; already, because it is used by `font-lock-compile-keywords'.
 -      (let ((default-directory (tramp-compat-temporary-file-directory))
 -          (outline-regexp tramp-debug-outline-regexp))
 -      (outline-mode))
 -      (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp)
 -      (set (make-local-variable 'outline-level) 'tramp-outline-level))
 -    (current-buffer)))
 +            (with-progress-reporter
 +                v 3 (format "Inserting local temp file `%s'" local-copy)
 +              ;; We must ensure that `file-coding-system-alist'
 +              ;; matches `local-copy'.
 +              (let ((file-coding-system-alist
 +                     (tramp-find-file-name-coding-system-alist
 +                      filename local-copy)))
 +                (setq result
 +                      (insert-file-contents
 +                       local-copy nil nil nil replace))))))
  
 -(defun tramp-outline-level ()
 -  "Return the depth to which a statement is nested in the outline.
 -Point must be at the beginning of a header line.
 +      ;; Save exit.
 +      (progn
 +        (when visit
 +          (setq buffer-file-name filename)
 +          (setq buffer-read-only (not (file-writable-p filename)))
 +          (set-visited-file-modtime)
-           (set-buffer-modified-p nil))
++          (set-buffer-modified-p nil)
++          ;; For root, preserve owner and group when editing files.
++          (when (string-equal (file-remote-p filename 'user) "root")
++            (set (make-local-variable 'backup-by-copying-when-mismatch) t)
++            (put 'backup-by-copying-when-mismatch 'permanent-local t)))
 +        (when (and (stringp local-copy)
 +                   (or remote-copy (null tramp-temp-buffer-file-name)))
 +          (delete-file local-copy))
 +        (when (stringp remote-copy)
 +          (delete-file
 +           (tramp-make-tramp-file-name method user host remote-copy))))))
  
 -The outline level is equal to the verbosity of the Tramp message."
 -  (1+ (string-to-number (match-string 1))))
 +    ;; Result.
 +    (list (expand-file-name filename)
 +        (cadr result))))
  
 -(defun tramp-find-executable
 -  (vec progname dirlist &optional ignore-tilde ignore-path)
 -  "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST.
 -First arg VEC specifies the connection, PROGNAME is the program
 -to search for, and DIRLIST gives the list of directories to
 -search.  If IGNORE-TILDE is non-nil, directory names starting
 -with `~' will be ignored. If IGNORE-PATH is non-nil, searches
 -only in DIRLIST.
 +(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
 +  "Like `load' for Tramp files."
 +  (with-parsed-tramp-file-name (expand-file-name file) nil
 +    (unless nosuffix
 +      (cond ((file-exists-p (concat file ".elc"))
 +           (setq file (concat file ".elc")))
 +          ((file-exists-p (concat file ".el"))
 +           (setq file (concat file ".el")))))
 +    (when must-suffix
 +      ;; The first condition is always true for absolute file names.
 +      ;; Included for safety's sake.
 +      (unless (or (file-name-directory file)
 +                (string-match "\\.elc?\\'" file))
 +      (tramp-error
 +       v 'file-error
 +       "File `%s' does not include a `.el' or `.elc' suffix" file)))
 +    (unless noerror
 +      (when (not (file-exists-p file))
 +      (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file)))
 +    (if (not (file-exists-p file))
 +      nil
 +      (let ((tramp-message-show-message (not nomessage)))
 +      (with-progress-reporter v 0 (format "Loading %s" file)
 +        (let ((local-copy (file-local-copy file)))
 +          ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
 +          (unwind-protect
 +              (load local-copy noerror t t)
 +            (delete-file local-copy)))))
 +      t)))
  
 -Returns the absolute file name of PROGNAME, if found, and nil otherwise.
 +(defun tramp-handle-substitute-in-file-name (filename)
 +  "Like `substitute-in-file-name' for Tramp files.
 +\"//\" and \"/~\" substitute only in the local filename part.
 +If the URL Tramp syntax is chosen, \"//\" as method delimeter and \"/~\" at
 +beginning of local filename are not substituted."
 +  ;; First, we must replace environment variables.
 +  (setq filename (tramp-replace-environment-variables filename))
 +  (with-parsed-tramp-file-name filename nil
 +    (if (equal tramp-syntax 'url)
 +      ;; We need to check localname only.  The other parts cannot contain
 +      ;; "//" or "/~".
 +      (if (and (> (length localname) 1)
 +               (or (string-match "//" localname)
 +                   (string-match "/~" localname 1)))
 +          (tramp-run-real-handler 'substitute-in-file-name (list filename))
 +        (tramp-make-tramp-file-name
 +         (when method (substitute-in-file-name method))
 +         (when user (substitute-in-file-name user))
 +         (when host (substitute-in-file-name host))
 +         (when localname
 +           (tramp-run-real-handler
 +            'substitute-in-file-name (list localname)))))
 +      ;; Ignore in LOCALNAME everything before "//" or "/~".
 +      (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
 +      (setq filename
 +            (concat (file-remote-p filename)
 +                    (replace-match "\\1" nil nil localname)))
 +      ;; "/m:h:~" does not work for completion.  We use "/m:h:~/".
 +      (when (string-match "~$" filename)
 +        (setq filename (concat filename "/"))))
 +      (tramp-run-real-handler 'substitute-in-file-name (list filename)))))
  
 -This function expects to be in the right *tramp* buffer."
 -  (with-current-buffer (tramp-get-connection-buffer vec)
 -    (let (result)
 -      ;; Check whether the executable is in $PATH. "which(1)" does not
 -      ;; report always a correct error code; therefore we check the
 -      ;; number of words it returns.
 -      (unless ignore-path
 -      (tramp-send-command vec (format "which \\%s | wc -w" progname))
 -      (goto-char (point-min))
 -      (if (looking-at "^\\s-*1$")
 -          (setq result (concat "\\" progname))))
 -      (unless result
 -      (when ignore-tilde
 -        ;; Remove all ~/foo directories from dirlist.  In XEmacs,
 -        ;; `remove' is in CL, and we want to avoid CL dependencies.
 -        (let (newdl d)
 -          (while dirlist
 -            (setq d (car dirlist))
 -            (setq dirlist (cdr dirlist))
 -            (unless (char-equal ?~ (aref d 0))
 -              (setq newdl (cons d newdl))))
 -          (setq dirlist (nreverse newdl))))
 -      (tramp-send-command
 -       vec
 -       (format (concat "while read d; "
 -                       "do if test -x $d/%s -a -f $d/%s; "
 -                       "then echo tramp_executable $d/%s; "
 -                       "break; fi; done <<'EOF'\n"
 -                       "%s\nEOF")
 -               progname progname progname (mapconcat 'identity dirlist "\n")))
 -      (goto-char (point-max))
 -      (when (search-backward "tramp_executable " nil t)
 -        (skip-chars-forward "^ ")
 -        (skip-chars-forward " ")
 -        (setq result (buffer-substring
 -                      (point) (tramp-compat-line-end-position)))))
 -    result)))
 -
 -(defun tramp-set-remote-path (vec)
 -  "Sets the remote environment PATH to existing directories.
 -I.e., for each directory in `tramp-remote-path', it is tested
 -whether it exists and if so, it is added to the environment
 -variable PATH."
 -  (tramp-message vec 5 (format "Setting $PATH environment variable"))
 -  (tramp-send-command
 -   vec (format "PATH=%s; export PATH"
 -             (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
 -
 -;; ------------------------------------------------------------
 -;; -- Communication with external shell --
 -;; ------------------------------------------------------------
 -
 -(defun tramp-find-file-exists-command (vec)
 -  "Find a command on the remote host for checking if a file exists.
 -Here, we are looking for a command which has zero exit status if the
 -file exists and nonzero exit status otherwise."
 -  (let ((existing "/")
 -        (nonexisting
 -       (tramp-shell-quote-argument "/ this file does not exist "))
 -      result)
 -    ;; The algorithm is as follows: we try a list of several commands.
 -    ;; For each command, we first run `$cmd /' -- this should return
 -    ;; true, as the root directory always exists.  And then we run
 -    ;; `$cmd /this\ file\ does\ not\ exist ', hoping that the file indeed
 -    ;; does not exist.  This should return false.  We use the first
 -    ;; command we find that seems to work.
 -    ;; The list of commands to try is as follows:
 -    ;; `ls -d'            This works on most systems, but NetBSD 1.4
 -    ;;                    has a bug: `ls' always returns zero exit
 -    ;;                    status, even for files which don't exist.
 -    ;; `test -e'          Some Bourne shells have a `test' builtin
 -    ;;                    which does not know the `-e' option.
 -    ;; `/bin/test -e'     For those, the `test' binary on disk normally
 -    ;;                    provides the option.  Alas, the binary
 -    ;;                    is sometimes `/bin/test' and sometimes it's
 -    ;;                    `/usr/bin/test'.
 -    ;; `/usr/bin/test -e' In case `/bin/test' does not exist.
 -    (unless (or
 -             (and (setq result (format "%s -e" (tramp-get-test-command vec)))
 -                (zerop (tramp-send-command-and-check
 -                        vec (format "%s %s" result existing)))
 -                  (not (zerop (tramp-send-command-and-check
 -                             vec (format "%s %s" result nonexisting)))))
 -             (and (setq result "/bin/test -e")
 -                (zerop (tramp-send-command-and-check
 -                        vec (format "%s %s" result existing)))
 -                  (not (zerop (tramp-send-command-and-check
 -                             vec (format "%s %s" result nonexisting)))))
 -             (and (setq result "/usr/bin/test -e")
 -                (zerop (tramp-send-command-and-check
 -                        vec (format "%s %s" result existing)))
 -                  (not (zerop (tramp-send-command-and-check
 -                             vec (format "%s %s" result nonexisting)))))
 -             (and (setq result (format "%s -d" (tramp-get-ls-command vec)))
 -                (zerop (tramp-send-command-and-check
 -                        vec (format "%s %s" result existing)))
 -                  (not (zerop (tramp-send-command-and-check
 -                             vec (format "%s %s" result nonexisting))))))
 -      (tramp-error
 -       vec 'file-error "Couldn't find command to check if file exists"))
 -    result))
 +(defun tramp-handle-unhandled-file-name-directory (filename)
 +  "Like `unhandled-file-name-directory' for Tramp files."
 +  ;; With Emacs 23, we could simply return `nil'.  But we must keep it
 +  ;; for backward compatibility.
 +  (expand-file-name "~/"))
  
 -(defun tramp-open-shell (vec shell)
 -  "Opens shell SHELL."
 -  (with-progress-reporter vec 5 (format "Opening remote shell `%s'" shell)
 -    ;; Find arguments for this shell.
 -    (let ((tramp-end-of-output tramp-initial-end-of-output)
 -        (alist tramp-sh-extra-args)
 -        item extra-args)
 -      (while (and alist (null extra-args))
 -      (setq item (pop alist))
 -      (when (string-match (car item) shell)
 -        (setq extra-args (cdr item))))
 -      (when extra-args (setq shell (concat shell " " extra-args)))
 -      (tramp-send-command
 -       vec (format "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s"
 -                 (shell-quote-argument tramp-end-of-output) shell)
 -       t))
 -    ;; Setting prompts.
 -    (tramp-send-command
 -     vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
 -    (tramp-send-command vec "PS2=''" t)
 -    (tramp-send-command vec "PS3=''" t)
 -    (tramp-send-command vec "PROMPT_COMMAND=''" t)))
 -
 -(defun tramp-find-shell (vec)
 -  "Opens a shell on the remote host which groks tilde expansion."
 -  (unless (tramp-get-connection-property vec "remote-shell" nil)
 -    (let (shell)
 -      (with-current-buffer (tramp-get-buffer vec)
 -      (tramp-send-command vec "echo ~root" t)
 -      (cond
 -       ((or (string-match "^~root$" (buffer-string))
 -            ;; The default shell (ksh93) of OpenSolaris is buggy.
 -            (string-equal (tramp-get-connection-property vec "uname" "")
 -                          "SunOS 5.11"))
 -        (setq shell
 -              (or (tramp-find-executable
 -                   vec "bash" (tramp-get-remote-path vec) t t)
 -                  (tramp-find-executable
 -                   vec "ksh" (tramp-get-remote-path vec) t t)))
 -        (unless shell
 -          (tramp-error
 -           vec 'file-error
 -           "Couldn't find a shell which groks tilde expansion"))
 -        (tramp-message
 -         vec 5 "Starting remote shell `%s' for tilde expansion" shell)
 -        (tramp-open-shell vec shell))
 -
 -       (t (tramp-message
 -           vec 5 "Remote `%s' groks tilde expansion, good"
 -           (tramp-set-connection-property
 -            vec "remote-shell"
 -            (tramp-get-method-parameter
 -             (tramp-file-name-method vec) 'tramp-remote-sh)))))))))
 -
 -;; ------------------------------------------------------------
 -;; -- Functions for establishing connection --
 -;; ------------------------------------------------------------
 +;;; Functions for establishing connection:
  
  ;; The following functions are actions to be taken when seeing certain
  ;; prompts from the remote host.  See the variable
@@@ -188,15 -187,23 +188,15 @@@ One useful value to include is `turn-on
  You and Emacs play in turn by marking a free square.  You mark it with X
  and Emacs marks it with O.  The winner is the first to get five contiguous
  marks horizontally, vertically or in diagonal.
 -
 +\\<gomoku-mode-map>
  You play by moving the cursor over the square you choose and hitting \\[gomoku-human-plays].
  
 -Other useful commands:
 -\\{gomoku-mode-map}
 -Entry to this mode calls the value of `gomoku-mode-hook' if that value
 -is non-nil."
 -  (interactive)
 -  (kill-all-local-variables)
 -  (setq major-mode 'gomoku-mode
 -      mode-name "Gomoku")
 +Other useful commands:\n
 +\\{gomoku-mode-map}"
    (gomoku-display-statistics)
 -  (use-local-map gomoku-mode-map)
    (make-local-variable 'font-lock-defaults)
-   (setq font-lock-defaults '(gomoku-font-lock-keywords t))
-   (toggle-read-only t))
+   (setq font-lock-defaults '(gomoku-font-lock-keywords t)
 -      buffer-read-only t)
 -  (run-mode-hooks 'gomoku-mode-hook))
++      buffer-read-only t))
  \f
  ;;;
  ;;; THE BOARD.
Simple merge
@@@ -5,9 -5,10 +5,10 @@@
  
  ;; Author: Alex Schroeder <alex@gnu.org>
  ;; Maintainer: Michael Mauger <mmaug@yahoo.com>
 -;; Version: 2.0.2
 +;; Version: 2.8
  ;; Keywords: comm languages processes
- ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el
+ ;; URL: http://savannah.gnu.org/projects/emacs/
+ ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
  
  ;; This file is part of GNU Emacs.
  
@@@ -4270,6 -2885,4 +4271,5 @@@ buffer
  
  (provide 'sql)
  
- ;; arch-tag: 7e1fa1c4-9ca2-402e-87d2-83a5eccb7ac3
  ;;; sql.el ends here
 +
diff --cc lisp/select.el
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/ChangeLog
@@@ -1,46 -1,15 +1,58 @@@
 -2010-10-25  Michael Albinus  <michael.albinus@gmx.de>
+ 2010-10-31  Chong Yidong  <cyd@stupidchicken.com>
+       * xterm.c (x_connection_closed): Print informative error message
+       when aborting on GTK.  This requires using shut_down_emacs
+       directly instead of Fkill_emacs.
++2010-10-31  Michael Albinus  <michael.albinus@gmx.de>
+       * dbusbind.c (Fdbus_call_method_asynchronously)
+       (Fdbus_register_signal, Fdbus_register_method): Check, whether
+       `dbus-registered-objects-table' is initialized.
 +2010-10-29  Eli Zaretskii  <eliz@gnu.org>
 +
 +      * emacs.c (main): Call syms_of_filelock unconditionally.
 +
 +      * filelock.c (syms_of_filelock): Move out of #ifdef CLASH_DETECTION
 +      clause, but keep part of it conditioned on CLASH_DETECTION.
 +
 +2010-10-29  Glenn Morris  <rgm@gnu.org>
 +
 +      * nsfns.m (Fx-display-save-under, Fx-open-connection)
 +      (Fxw-color-defined-p, Fxw-display-color-p, Fx-show-tip):
 +      * w32fns.c (Fxw_color_defined_p, Fx_open_connection):
 +      * xfns.c (Fxw_color_defined_p, Fx_open_connection):
 +      Sync docs between X, W32, NS.
 +
 +      * buffer.c (syms_of_buffer) <abbrev-mode, transient-mark-mode>:
 +      * frame.c (syms_of_frame) <tool-bar-mode>: Move doc here from Lisp.
 +
 +2010-10-26  Juanma Barranquero  <lekktu@gmail.com>
 +
 +      * eval.c (init_eval_once): Set max_lisp_eval_depth to 600;
 +      otherwise, bootstrapping on Windows fails to compile macroexp.el.
 +
 +2010-10-26  Eli Zaretskii  <eliz@gnu.org>
 +
 +      * cmds.c (internal_self_insert): Don't insert if argument N is
 +      zero or negative.  (Bug#7281)
 +
 +2010-10-26  Jan Djärv  <jan.h.d@swipnet.se>
 +
 +      * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278).
 +
 +2010-10-25  Glenn Morris  <rgm@gnu.org>
 +
 +      * Makefile.in (SOME_MACHINE_LISP): Remove easymenu.elc.
 +
 +2010-10-24  Glenn Morris  <rgm@gnu.org>
 +
 +      * w32fns.c (Fx_synchronize, Fx_change_window_property)
 +      (Fx_window_property, Fx_file_dialog):
 +      * xfns.c (Fx_synchronize, Fx_change_window_property)
 +      (Fx_window_property, Fx_file_dialog): Sync docs between w32 and X.
 +
  2010-10-24  Chong Yidong  <cyd@stupidchicken.com>
  
        * xterm.c (x_connection_closed): Kill Emacs unconditionally.
diff --cc src/dbusbind.c
@@@ -1232,8 -1175,12 +1232,12 @@@ usage: (dbus-call-method-asynchronousl
                    SDATA (interface),
                    SDATA (method));
  
+   /* Check dbus-registered-objects-table.  */
+   if (!HASH_TABLE_P (Vdbus_registered_objects_table))
+     XD_SIGNAL1 (build_string ("dbus.el is not loaded"));
    /* Open a connection to the bus.  */
 -  connection = xd_initialize (bus);
 +  connection = xd_initialize (bus, TRUE);
  
    /* Create the message.  */
    dmessage = dbus_message_new_method_call (SDATA (service),
@@@ -1981,8 -1984,12 +1989,12 @@@ used for composing the returning D-Bus 
    /* TODO: We must check for a valid service name, otherwise there is
       a segmentation fault.  */
  
+   /* Check dbus-registered-objects-table.  */
+   if (!HASH_TABLE_P (Vdbus_registered_objects_table))
+     XD_SIGNAL1 (build_string ("dbus.el is not loaded"));
    /* Open a connection to the bus.  */
 -  connection = xd_initialize (bus);
 +  connection = xd_initialize (bus, TRUE);
  
    /* Request the known name from the bus.  We can ignore the result,
       it is set to -1 if there is an error - kind of redundancy.  */
diff --cc src/xterm.c
Simple merge