commit 8599360928a0169b232fe1d67cc8228edd4f790c (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Sun Mar 15 14:21:04 2015 -0400 (url-insert-file-contents): Set buffer-file-coding-system Fixes: debbugs:20010 * lisp/url/url-handlers.el (url-insert-file-contents): Call after-insert-file-set-coding like insert-file-contents, to set buffer-file-coding-system. diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 0f46413..8733614 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,9 @@ +2015-03-15 Stefan Monnier + + * url-handlers.el (url-insert-file-contents): Call + after-insert-file-set-coding like insert-file-contents, to set + buffer-file-coding-system (bug#20010). + 2015-01-22 Paul Eggert Don't downcase system diagnostics' first letters diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 23006e1..ff3eafd 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -1,4 +1,4 @@ -;;; url-handlers.el --- file-name-handler stuff for URL loading +;;; url-handlers.el --- file-name-handler stuff for URL loading -*- lexical-binding:t -*- ;; Copyright (C) 1996-1999, 2004-2015 Free Software Foundation, Inc. @@ -228,7 +228,7 @@ the arguments that would have been passed to OPERATION." ;; a local process. nil))) -(defun url-handler-file-remote-p (filename &optional identification connected) +(defun url-handler-file-remote-p (filename &optional identification _connected) (let ((url (url-generic-parse-url filename))) (if (and (url-type url) (not (equal (url-type url) "file"))) ;; Maybe we can find a suitable check for CONNECTED. For now, @@ -250,7 +250,7 @@ the arguments that would have been passed to OPERATION." ;; The actual implementation ;;;###autoload (defun url-copy-file (url newname &optional ok-if-already-exists - keep-time preserve-uid-gid) + _keep-time _preserve-uid-gid) "Copy URL to NEWNAME. Both args must be strings. Signals a `file-already-exists' error if file NEWNAME already exists, unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. @@ -334,8 +334,13 @@ They count bytes from the beginning of the body." (unless (cadr size-and-charset) ;; If the headers don't specify any particular charset, use the ;; usual heuristic/rules that we apply to files. - (decode-coding-inserted-region start (point) url visit beg end replace)) - (list url (car size-and-charset)))))) + (decode-coding-inserted-region start (point) url + visit beg end replace)) + (let ((inserted (car size-and-charset))) + (when (fboundp 'after-insert-file-set-coding) + (let ((insval (after-insert-file-set-coding inserted visit))) + (if insval (setq inserted insval)))) + (list url inserted)))))) (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) commit 4e5eb85425214d62cd3962914565b281b74504ce Author: Eli Zaretskii Date: Sun Mar 15 19:17:46 2015 +0200 Fix subtle problems with linum-mode and invisible text src/xdisp.c (handle_invisible_prop): Fix up it->position even when we are going to load overlays at the beginning of the invisible text. (setup_for_ellipsis): Reset the ignore_overlay_strings_at_pos_p flag also here. (next_overlay_string): Set the overlay_strings_at_end_processed_p flag only if the overlays just processed were actually loaded at EOB. diff --git a/src/ChangeLog b/src/ChangeLog index cb4aad6..e328afc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2015-03-15 Eli Zaretskii + + * xdisp.c (handle_invisible_prop): Fix up it->position even when + we are going to load overlays at the beginning of the invisible + text. + (setup_for_ellipsis): Reset the ignore_overlay_strings_at_pos_p + flag also here. + (next_overlay_string): Set the overlay_strings_at_end_processed_p + flag only if the overlays just processed were actually loaded at + EOB. + 2015-03-14 Daniel Colascione * emacs.c (standard_args): Add --no-x-resources. diff --git a/src/xdisp.c b/src/xdisp.c index ce685fd..a17f5a9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4412,6 +4412,27 @@ handle_invisible_prop (struct it *it) IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos); } + if (display_ellipsis_p) + { + /* Make sure that the glyphs of the ellipsis will get + correct `charpos' values. If we would not update + it->position here, the glyphs would belong to the + last visible character _before_ the invisible + text, which confuses `set_cursor_from_row'. + + We use the last invisible position instead of the + first because this way the cursor is always drawn on + the first "." of the ellipsis, whenever PT is inside + the invisible text. Otherwise the cursor would be + placed _after_ the ellipsis when the point is after the + first invisible character. */ + if (!STRINGP (it->object)) + { + it->position.charpos = newpos - 1; + it->position.bytepos = CHAR_TO_BYTE (it->position.charpos); + } + } + /* If there are before-strings at the start of invisible text, and the text is invisible because of a text property, arrange to show before-strings because 20.x did @@ -4443,23 +4464,6 @@ handle_invisible_prop (struct it *it) } else if (display_ellipsis_p) { - /* Make sure that the glyphs of the ellipsis will get - correct `charpos' values. If we would not update - it->position here, the glyphs would belong to the - last visible character _before_ the invisible - text, which confuses `set_cursor_from_row'. - - We use the last invisible position instead of the - first because this way the cursor is always drawn on - the first "." of the ellipsis, whenever PT is inside - the invisible text. Otherwise the cursor would be - placed _after_ the ellipsis when the point is after the - first invisible character. */ - if (!STRINGP (it->object)) - { - it->position.charpos = newpos - 1; - it->position.bytepos = CHAR_TO_BYTE (it->position.charpos); - } it->ellipsis_p = true; /* Let the ellipsis display before considering any properties of the following char. @@ -4504,6 +4508,11 @@ setup_for_ellipsis (struct it *it, int len) if (it->saved_face_id < 0 || it->saved_face_id != it->face_id) it->saved_face_id = it->face_id = DEFAULT_FACE_ID; + /* If the ellipsis represents buffer text, it means we advanced in + the buffer, so we should no longer ignore overlay strings. */ + if (it->method == GET_FROM_BUFFER) + it->ignore_overlay_strings_at_pos_p = false; + it->method = GET_FROM_DISPLAY_VECTOR; it->ellipsis_p = true; } @@ -5427,7 +5436,6 @@ next_overlay_string (struct it *it) && it->stop_charpos <= it->end_charpos)); it->current.overlay_string_index = -1; it->n_overlay_strings = 0; - it->overlay_strings_charpos = -1; /* If there's an empty display string on the stack, pop the stack, to resync the bidi iterator with IT's position. Such empty strings are pushed onto the stack in @@ -5444,8 +5452,18 @@ next_overlay_string (struct it *it) /* If we're at the end of the buffer, record that we have processed the overlay strings there already, so that next_element_from_buffer doesn't try it again. */ - if (NILP (it->string) && IT_CHARPOS (*it) >= it->end_charpos) + if (NILP (it->string) + && IT_CHARPOS (*it) >= it->end_charpos + && it->overlay_strings_charpos >= it->end_charpos) it->overlay_strings_at_end_processed_p = true; + /* Note: we reset overlay_strings_charpos only here, to make + sure the just-processed overlays were indeed at EOB. + Otherwise, overlays on text with invisible text property, + which are processed with IT's position past the invisible + text, might fool us into thinking the overlays at EOB were + already processed (linum-mode can cause this, for + example). */ + it->overlay_strings_charpos = -1; } else { commit 28caedba0f5c387d9c8e8fc8de26b5399afeb68b Author: Michael Albinus Date: Sun Mar 15 16:07:03 2015 +0100 In Tramp. check ssh Control* options only when needed Fixes: debbugs:20015 * net/tramp-adb.el: * net/tramp-gvfs.el: * net/tramp-sh.el: * net/tramp-smb.el: Set tramp-autoload cookie for all defcustoms. * net/tramp-sh.el (tramp-use-ssh-controlmaster-options): New defcustom, moved from tramp.el. (tramp-ssh-controlmaster-options): New defvar, moved from tramp.el but with a nil initial value. (tramp-ssh-controlmaster-options): New defun. (tramp-do-copy-or-rename-file-out-of-band) (tramp-maybe-open-connection): Use it. * net/tramp.el (tramp-ssh-controlmaster-options) (tramp-use-ssh-controlmaster-options): Move them to tramp-sh.el. (tramp-default-method): Do not check for `tramp-ssh-controlmaster-options'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 73ba035..747a1d6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2015-03-15 Michael Albinus + + * net/tramp-adb.el: + * net/tramp-gvfs.el: + * net/tramp-sh.el: + * net/tramp-smb.el: Set tramp-autoload cookie for all defcustoms. + + * net/tramp.el (tramp-ssh-controlmaster-options) + (tramp-use-ssh-controlmaster-options): Move them to tramp-sh.el. + (tramp-default-method): Do not check for + `tramp-ssh-controlmaster-options'. + + * net/tramp-sh.el (tramp-use-ssh-controlmaster-options): + New defcustom, moved from tramp.el. + (tramp-ssh-controlmaster-options): New defvar, moved from tramp.el + but with a nil initial value. + (tramp-ssh-controlmaster-options): New defun. + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-maybe-open-connection): Use it. (Bug#20015) + 2015-03-15 Tassilo Horn * emacs-lisp/lisp-mode.el (lisp--el-macro-regexp): New defconst. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 6696dcf..a92ca4d 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -38,12 +38,14 @@ ;; Pacify byte-compiler. (defvar directory-sep-char) +;;;###tramp-autoload (defcustom tramp-adb-program "adb" "Name of the Android Debug Bridge program." :group 'tramp :version "24.4" :type 'string) +;;;###tramp-autoload (defcustom tramp-adb-connect-if-not-connected nil "Try to run `adb connect' if provided device is not connected currently. It is used for TCP/IP devices." @@ -55,6 +57,7 @@ It is used for TCP/IP devices." (defconst tramp-adb-method "adb" "*When this method name is used, forward all calls to Android Debug Bridge.") +;;;###tramp-autoload (defcustom tramp-adb-prompt "^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]]*@[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]" "Regexp used as prompt in almquist shell." diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 1ea52eb..5988a28 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -127,6 +127,7 @@ ;;;###tramp-autoload (add-to-list 'tramp-default-user-alist '("\\`synce\\'" nil nil)) +;;;###tramp-autoload (defcustom tramp-gvfs-zeroconf-domain "local" "Zeroconf domain to be used for discovering services, like host names." :group 'tramp @@ -374,6 +375,7 @@ It has been changed in GVFS 1.14.") ;; ;; +;;;###tramp-autoload (defcustom tramp-bluez-discover-devices-timeout 60 "Defines seconds since last bluetooth device discovery before rescanning. A value of 0 would require an immediate discovery during hostname diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 76d2b01..73ad8c7 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -40,6 +40,7 @@ (defvar vc-git-program) (defvar vc-hg-program) +;;;###tramp-autoload (defcustom tramp-inline-compress-start-size 4096 "The minimum size of compressing where inline transfer. When inline transfer, compress transferred data of file @@ -48,6 +49,7 @@ If it is nil, no compression at all will be applied." :group 'tramp :type '(choice (const nil) integer)) +;;;###tramp-autoload (defcustom tramp-copy-size-limit 10240 "The maximum file size where inline copying is preferred over an \ out-of-the-band copy. @@ -105,6 +107,27 @@ detected as prompt when being sent on echoing hosts, therefore.") (defconst tramp-end-of-heredoc (md5 tramp-end-of-output) "String used to recognize end of heredoc strings.") +;;;###tramp-autoload +(defcustom tramp-use-ssh-controlmaster-options t + "Whether to use `tramp-ssh-controlmaster-options'." + :group 'tramp + :version "24.4" + :type 'boolean) + +(defvar tramp-ssh-controlmaster-options nil + "Which ssh Control* arguments to use. + +If it is a string, it should have the form +\"-o ControlMaster=auto -o ControlPath='tramp.%%r@%%h:%%p' +-o ControlPersist=no\". Percent characters in the ControlPath +spec must be doubled, because the string is used as format string. + +Otherwise, it will be auto-detected by Tramp, if +`tramp-use-ssh-controlmaster-options' is non-nil. The value +depends on the installed local ssh version. + +The string is used in `tramp-methods'.") + ;; Initialize `tramp-methods' with the supported methods. ;;;###tramp-autoload (add-to-list 'tramp-methods @@ -489,6 +512,7 @@ not be set here. Instead, it should be set via `tramp-remote-path'." :version "24.4" :type '(repeat string)) +;;;###tramp-autoload (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) "Alist specifying extra arguments to pass to the remote shell. Entries are (REGEXP . ARGS) where REGEXP is a regular expression @@ -2354,10 +2378,7 @@ The method used must be an out-of-band method." spec (format-spec-make ?t (tramp-get-connection-property (tramp-get-connection-process v) "temp-file" "")) - options (format-spec - (if tramp-use-ssh-controlmaster-options - tramp-ssh-controlmaster-options "") - spec) + options (format-spec (tramp-ssh-controlmaster-options v) spec) spec (format-spec-make ?h host ?u user ?p port ?r listener ?c options ?k (if keep-date " " "")) @@ -4566,6 +4587,49 @@ Gateway hops are already opened." ;; Result. target-alist)) +(defun tramp-ssh-controlmaster-options (vec) + "Return the Control* arguments of the local ssh." + (cond + ;; No options to be computed. + ((or (null tramp-use-ssh-controlmaster-options) + (null (assoc "%c" (tramp-get-method-parameter + (tramp-file-name-method vec) 'tramp-login-args)))) + "") + + ;; There is already a value to be used. + ((stringp tramp-ssh-controlmaster-options) tramp-ssh-controlmaster-options) + + ;; Determine the options. + (t (setq tramp-ssh-controlmaster-options "") + (let ((case-fold-search t)) + (ignore-errors + (when (executable-find "ssh") + (with-temp-buffer + (tramp-call-process vec "ssh" nil t nil "-o" "ControlMaster") + (goto-char (point-min)) + (when (search-forward-regexp "missing.+argument" nil t) + (setq tramp-ssh-controlmaster-options "-o ControlMaster=auto"))) + (unless (zerop (length tramp-ssh-controlmaster-options)) + (with-temp-buffer + (tramp-call-process + vec "ssh" nil t nil + "-o" "ControlPath=%C" "host.does.not.exist") + (goto-char (point-min)) + (setq tramp-ssh-controlmaster-options + (if (search-forward-regexp "unknown.+key" nil t) + (concat tramp-ssh-controlmaster-options + " -o ControlPath='tramp.%%r@%%h:%%p'") + (concat tramp-ssh-controlmaster-options + " -o ControlPath='tramp.%%C'")))) + (with-temp-buffer + (tramp-call-process vec "ssh" nil t nil "-o" "ControlPersist") + (goto-char (point-min)) + (when (search-forward-regexp "missing.+argument" nil t) + (setq tramp-ssh-controlmaster-options + (concat tramp-ssh-controlmaster-options + " -o ControlPersist=no")))))))) + tramp-ssh-controlmaster-options))) + (defun tramp-maybe-open-connection (vec) "Maybe open a connection VEC. Does not do anything if a connection is already open, but re-opens the @@ -4647,8 +4711,7 @@ connection if a previous connection has died for some reason." (let* ((target-alist (tramp-compute-multi-hops vec)) ;; We will apply `tramp-ssh-controlmaster-options' ;; only for the first hop. - (options (if tramp-use-ssh-controlmaster-options - tramp-ssh-controlmaster-options "")) + (options (tramp-ssh-controlmaster-options vec)) (process-connection-type tramp-process-connection-type) (process-adaptive-read-buffering nil) (coding-system-for-read nil) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index d5fe17f..14360b9 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -70,17 +70,20 @@ tramp-smb-method '((tramp-parse-netrc "~/.netrc")))) +;;;###tramp-autoload (defcustom tramp-smb-program "smbclient" "Name of SMB client to run." :group 'tramp :type 'string) +;;;###tramp-autoload (defcustom tramp-smb-acl-program "smbcacls" "Name of SMB acls to run." :group 'tramp :type 'string :version "24.4") +;;;###tramp-autoload (defcustom tramp-smb-conf "/dev/null" "Path of the smb.conf file. If it is nil, no smb.conf will be added to the `tramp-smb-program' @@ -280,6 +283,7 @@ See `tramp-actions-before-shell' for more info.") Operations not mentioned here will be handled by the default Emacs primitives.") ;; Options for remote processes via winexe. +;;;###tramp-autoload (defcustom tramp-smb-winexe-program "winexe" "Name of winexe client to run. If it isn't found in the local $PATH, the absolute path of winexe @@ -288,6 +292,7 @@ shall be given. This is needed for remote processes." :type 'string :version "24.3") +;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command "powershell.exe" "Shell to be used for processes on remote machines. This must be Powershell V2 compatible." @@ -295,6 +300,7 @@ This must be Powershell V2 compatible." :type 'string :version "24.3") +;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command-switch "-file -" "Command switch used together with `tramp-smb-winexe-shell-command'. This can be used to disable echo etc." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 953525f..10bb769 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -307,43 +307,6 @@ started on the local host. You should specify a remote host `localhost' or the name of the local host. Another host name is useful only in combination with `tramp-default-proxies-alist'.") -;;;###tramp-autoload -(defconst tramp-ssh-controlmaster-options - (let ((result "") - (case-fold-search t)) - (ignore-errors - (when (executable-find "ssh") - (with-temp-buffer - (call-process "ssh" nil t nil "-o" "ControlMaster") - (goto-char (point-min)) - (when (search-forward-regexp "missing.+argument" nil t) - (setq result "-o ControlMaster=auto"))) - (unless (zerop (length result)) - (with-temp-buffer - (call-process - "ssh" nil t nil "-o" "ControlPath=%C" "host.does.not.exist") - (goto-char (point-min)) - (if (search-forward-regexp "unknown.+key" nil t) - (setq result - (concat result " -o ControlPath='tramp.%%r@%%h:%%p'")) - (setq result (concat result " -o ControlPath='tramp.%%C'")))) - (with-temp-buffer - (call-process "ssh" nil t nil "-o" "ControlPersist") - (goto-char (point-min)) - (when (search-forward-regexp "missing.+argument" nil t) - (setq result (concat result " -o ControlPersist=no"))))))) - result) - "Call ssh to detect whether it supports the Control* arguments. -Return a string to be used in `tramp-methods'.") - -;;;###tramp-autoload -(defcustom tramp-use-ssh-controlmaster-options - (not (zerop (length tramp-ssh-controlmaster-options))) - "Whether to use `tramp-ssh-controlmaster-options'." - :group 'tramp - :version "24.4" - :type 'boolean) - (defcustom tramp-default-method ;; An external copy method seems to be preferred, because it performs ;; much better for large files, and it hasn't too serious delays @@ -374,9 +337,7 @@ Return a string to be used in `tramp-methods'.") (fboundp 'auth-source-search) ;; ssh-agent is running. (getenv "SSH_AUTH_SOCK") - (getenv "SSH_AGENT_PID") - ;; We could reuse the connection. - (> (length tramp-ssh-controlmaster-options) 0)) + (getenv "SSH_AGENT_PID")) "scp" "ssh")) ;; Fallback.