commit 3ec1503374d3115651c130eaeee31181266d0863 (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Thu Dec 22 13:38:06 2016 +0900 ; * test/lisp/buff-menu-tests.el: Fix typo in the header. diff --git a/test/lisp/buff-menu-tests.el b/test/lisp/buff-menu-tests.el index 133a4f67a9..5bfdfba7a2 100644 --- a/test/lisp/buff-menu-tests.el +++ b/test/lisp/buff-menu-tests.el @@ -1,4 +1,4 @@ -;;; buff-menu-tests.el --- Test suite for buff-menu-tests.el -*- lexical-binding: t -*- +;;; buff-menu-tests.el --- Test suite for buff-menu.el -*- lexical-binding: t -*- ;; Copyright (C) 2016 Free Software Foundation, Inc. commit de0671096706bf7404cddce277b918c8d769f17b Author: Noam Postavsky Date: Sat Aug 13 22:13:56 2016 -0400 Use completion-at-point in verilog-mode There were some functions in verilog-mode that implemented in-buffer completion, but this needlessly duplicates completion-at-point functionality, and the popup window management had problems (see Bug #23842). We need to keep them for backwards compatibility with older emacs versions, but use completion-at-point if available. * lisp/progmodes/verilog-mode.el (verilog-toggle-completions): Mark as obsolete if completion-cycle-threshold is available. (verilog-mode-map, verilog-menu): Bind completion-at-point and completion-help-at-point in preference to verilog-complete-word and verilog-show-completions, respectively. (verilog-mode): Add verilog-completion-at-point to completion-at-point-functions. (verilog-completion-at-point): New function. (verilog-show-completions, verilog-complete-word): Use it to avoid code duplication. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 5368b61356..4e9b43ba0d 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -1416,8 +1416,10 @@ If set will become buffer local.") (define-key map "\M-\C-b" 'electric-verilog-backward-sexp) (define-key map "\M-\C-f" 'electric-verilog-forward-sexp) (define-key map "\M-\r" `electric-verilog-terminate-and-indent) - (define-key map "\M-\t" 'verilog-complete-word) - (define-key map "\M-?" 'verilog-show-completions) + (define-key map "\M-\t" (if (fboundp 'completion-at-point) + 'completion-at-point 'verilog-complete-word)) + (define-key map "\M-?" (if (fboundp 'completion-help-at-point) + 'completion-help-at-point 'verilog-show-completions)) ;; Note \C-c and letter are reserved for users (define-key map "\C-c`" 'verilog-lint-off) (define-key map "\C-c*" 'verilog-delete-auto-star-implicit) @@ -1448,7 +1450,7 @@ If set will become buffer local.") (easy-menu-define verilog-menu verilog-mode-map "Menu for Verilog mode" (verilog-easy-menu-filter - '("Verilog" + `("Verilog" ("Choose Compilation Action" ["None" (progn @@ -1540,7 +1542,8 @@ If set will become buffer local.") :help "Take a signal vector on the current line and expand it to multiple lines"] ["Insert begin-end block" verilog-insert-block :help "Insert begin ... end"] - ["Complete word" verilog-complete-word + ["Complete word" ,(if (fboundp 'completion-at-point) + 'completion-at-point 'verilog-complete-word) :help "Complete word at point"] "----" ["Recompute AUTOs" verilog-auto @@ -3806,7 +3809,7 @@ AUTO expansion functions are, in part: Some other functions are: - \\[verilog-complete-word] Complete word with appropriate possibilities. + \\[completion-at-point] Complete word with appropriate possibilities. \\[verilog-mark-defun] Mark function. \\[verilog-beg-of-defun] Move to beginning of current function. \\[verilog-end-of-defun] Move to end of current function. @@ -3920,6 +3923,9 @@ Key bindings specific to `verilog-mode-map' are: verilog-forward-sexp-function) hs-special-modes-alist)))) + (add-hook 'completion-at-point-functions + #'verilog-completion-at-point nil 'local) + ;; Stuff for autos (add-hook 'write-contents-hooks 'verilog-auto-save-check nil 'local) ;; verilog-mode-hook call added by define-derived-mode @@ -7198,6 +7204,9 @@ Region is defined by B and EDPOS." Repeated use of \\[verilog-complete-word] will show you all of them. Normally, when there is more than one possible completion, it displays a list of all possible completions.") +(when (boundp 'completion-cycle-threshold) + (make-obsolete-variable + 'verilog-toggle-completions 'completion-cycle-threshold "26.1")) (defvar verilog-type-keywords @@ -7480,21 +7489,33 @@ exact match, nil otherwise." (defvar verilog-last-word-shown nil) (defvar verilog-last-completions nil) +(defun verilog-completion-at-point () + "Used as an element of `completion-at-point-functions'. +\(See also `verilog-type-keywords' and +`verilog-separator-keywords'.)" + (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point))) + (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point))) + (verilog-str (buffer-substring b e)) + ;; The following variable is used in verilog-completion + (verilog-buffer-to-use (current-buffer)) + (allcomp (if (and verilog-toggle-completions + (string= verilog-last-word-shown verilog-str)) + verilog-last-completions + (all-completions verilog-str 'verilog-completion)))) + (list b e allcomp))) + (defun verilog-complete-word () "Complete word at current point. \(See also `verilog-toggle-completions', `verilog-type-keywords', and `verilog-separator-keywords'.)" - ;; FIXME: Provide completion-at-point-function. + ;; NOTE: This is just a fallback for Emacs versions lacking + ;; `completion-at-point'. (interactive) - (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point))) - (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point))) + (let* ((comp-info (verilog-completion-at-point)) + (b (nth 0 comp-info)) + (e (nth 1 comp-info)) (verilog-str (buffer-substring b e)) - ;; The following variable is used in verilog-completion - (verilog-buffer-to-use (current-buffer)) - (allcomp (if (and verilog-toggle-completions - (string= verilog-last-word-shown verilog-str)) - verilog-last-completions - (all-completions verilog-str 'verilog-completion))) + (allcomp (nth 2 comp-info)) (match (if verilog-toggle-completions "" (try-completion verilog-str (mapcar (lambda (elm) @@ -7542,23 +7563,15 @@ and `verilog-separator-keywords'.)" (defun verilog-show-completions () "Show all possible completions at current point." + ;; NOTE: This is just a fallback for Emacs versions lacking + ;; `completion-help-at-point'. (interactive) - (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point))) - (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point))) - (verilog-str (buffer-substring b e)) - ;; The following variable is used in verilog-completion - (verilog-buffer-to-use (current-buffer)) - (allcomp (if (and verilog-toggle-completions - (string= verilog-last-word-shown verilog-str)) - verilog-last-completions - (all-completions verilog-str 'verilog-completion)))) - ;; Show possible completions in a temporary buffer. - (with-output-to-temp-buffer "*Completions*" - (display-completion-list allcomp)) - ;; Wait for a key press. Then delete *Completion* window - (momentary-string-display "" (point)) - (delete-window (get-buffer-window (get-buffer "*Completions*"))))) - + ;; Show possible completions in a temporary buffer. + (with-output-to-temp-buffer "*Completions*" + (display-completion-list (nth 2 (verilog-completion-at-point)))) + ;; Wait for a key press. Then delete *Completion* window + (momentary-string-display "" (point)) + (delete-window (get-buffer-window (get-buffer "*Completions*")))) (defun verilog-get-default-symbol () "Return symbol around current point as a string." commit acd65a7d948f77701f5bdc99c031ca8fdb1e976e Author: Reuben Thomas Date: Wed Dec 21 17:30:44 2016 +0000 Keep default CASECHARS/NOT-CASECHARS for ispell built-in dictionaries * lisp/textmodes/ispell.el (ispell-set-spellchecker-params): Do not override CASECHARS and NOT-CASECHARS. The ispell dictionaries retain their hardwired values, and all other dictionaries are given sensible defaults. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 23ee412b8c..7551d2fde9 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1290,8 +1290,8 @@ aspell is used along with Emacs).") (cl-pushnew (if (cadr adict) ;; Do not touch hunspell uninitialized entries (list (nth 0 adict) ; dict name - "[[:alpha:]]" ; casechars - "[^[:alpha:]]" ; not-casechars + (nth 1 adict) ; casechars + (nth 2 adict) ; not-casechars (nth 3 adict) ; otherchars (nth 4 adict) ; many-otherchars-p (nth 5 adict) ; ispell-args commit 7ca4396f855799e3c6b3b88eea9181ee7ad602d4 Author: Stefan Monnier Date: Wed Dec 21 15:51:14 2016 -0500 * tex-mode.el (tex-compile-commands): Add luatex and xetex commands diff --git a/etc/NEWS b/etc/NEWS index 8ea9a60ab0..9fbbf5cc42 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -312,6 +312,8 @@ the file's actual content before prompting the user. * Changes in Specialized Modes and Packages in Emacs 26.1 +** TeX: Add luatex and xetex as alternatives to pdftex + ** Electric-Buffer-menu +++ diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 1363efea31..25d674541c 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2113,13 +2113,17 @@ If NOT-ALL is non-nil, save the `.dvi' file." :group 'tex) (defvar tex-compile-commands - '(((concat "pdf" tex-command - " " (if (< 0 (length tex-start-commands)) - (shell-quote-argument tex-start-commands)) " %f") - t "%r.pdf") + `(,@(mapcar (lambda (prefix) + `((concat ,prefix tex-command + " " (if (< 0 (length tex-start-commands)) + (shell-quote-argument tex-start-commands)) + " %f") + t "%r.pdf")) + '("pdf" "xe" "lua")) ((concat tex-command " " (if (< 0 (length tex-start-commands)) - (shell-quote-argument tex-start-commands)) " %f") + (shell-quote-argument tex-start-commands)) + " %f") t "%r.dvi") ("xdvi %r &" "%r.dvi") ("\\doc-view \"%r.pdf\"" "%r.pdf") commit 0a5b6e28f91ff46231a768737170e39172297257 Author: Eli Zaretskii Date: Wed Dec 21 22:16:24 2016 +0200 Fix aborts in GC under GC_CHECK_MARKED_OBJECTS * src/alloc.c (mark_object) [GC_CHECK_MARKED_OBJECTS]: Don't abort for thread objects. They are marked via the all_threads list, and therefore don't need to be inserted into the red-black tree, so mem_find will never find them. Reported by Daniel Colascione in http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00817.html. diff --git a/src/alloc.c b/src/alloc.c index f2b7682b05..e979f3631e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6406,7 +6406,7 @@ mark_object (Lisp_Object arg) #ifdef GC_CHECK_MARKED_OBJECTS m = mem_find (po); - if (m == MEM_NIL && !SUBRP (obj)) + if (m == MEM_NIL && !SUBRP (obj) && !THREADP (obj)) emacs_abort (); #endif /* GC_CHECK_MARKED_OBJECTS */ @@ -6416,7 +6416,9 @@ mark_object (Lisp_Object arg) else pvectype = PVEC_NORMAL_VECTOR; - if (pvectype != PVEC_SUBR && pvectype != PVEC_BUFFER) + if (pvectype != PVEC_SUBR + && pvectype != PVEC_BUFFER + && pvectype != PVEC_THREAD) CHECK_LIVE (live_vector_p); switch (pvectype) commit a6063ffe5ae395655cb55ba5823c83e306b3161b Author: Stefan Monnier Date: Wed Dec 21 15:07:43 2016 -0500 * src/data.c (Fmake_variable_frame_local): Remove * src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'. * src/data.c (swap_in_symval_forwarding, set_internal) (set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Don't pay attention to ->frame_local any more. (syms_of_data): Remove Qtrapping_frame_local and don't defsubr Smake_variable_frame_local. * etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal of make-variable-frame-local. * lisp/help-fns.el (describe-variable): Don't handle the now impossible frame-local case. * lisp/subr.el (make-variable-frame-local): Remove obsolescence data. * src/frame.c (store_frame_param): * src/eval.c (specbind): Don't pay attention to ->frame_local any more. * src/widget.c (first_frame_p): Remove, unused. diff --git a/etc/NEWS b/etc/NEWS index 7338c0c6a7..8ea9a60ab0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -669,6 +669,7 @@ before running. This is controlled by the 'grep-save-buffers' variable. ** Some obsolete functions, variables, and faces have been removed: +*** make-variable-frame-local. Variables cannot be frame-local any more. *** From subr.el: window-dot, set-window-dot, read-input, show-buffer, eval-current-buffer, string-to-int *** All the default-FOO variables that hold the default value of the diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 4f424313ab..71e146880b 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -31,7 +31,7 @@ ;; This library permits the setting of override functions for tasks of ;; that nature, and also provides reasonable defaults. ;; -;; There are buffer local variables, and frame local variables. +;; There are buffer local variables (and there were frame local variables). ;; This library gives the illusion of mode specific variables. ;; ;; You should use a mode-local variable or override to allow extension diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 66117b8331..04a493c826 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -2170,8 +2170,7 @@ The purpose of this function is so you can properly undo subsequent changes to the same binding, by passing the status cons cell to `edebug-restore-status'. The status cons cell has the form (LOCUS . VALUE), where LOCUS can be a buffer -\(for a buffer-local binding), a frame (for a frame-local binding), -or nil (if the default binding is current)." +\(for a buffer-local binding), or nil (if the default binding is current)." (cons (variable-binding-locus var) (symbol-value var))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 23dec896b8..6402f77092 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -863,8 +863,6 @@ it is displayed along with the global value." ((bufferp locus) (princ (format "Local in buffer %s; " (buffer-name buffer)))) - ((framep locus) - (princ (format "It is a frame-local variable; "))) ((terminal-live-p locus) (princ (format "It is a terminal-local variable; "))) (t diff --git a/lisp/subr.el b/lisp/subr.el index 99b142993f..89ceb9ba55 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1310,8 +1310,7 @@ be a list of the form returned by `event-start' and `event-end'." (make-obsolete 'focus-frame "it does nothing." "22.1") (defalias 'unfocus-frame 'ignore "") (make-obsolete 'unfocus-frame "it does nothing." "22.1") -(make-obsolete 'make-variable-frame-local - "explicitly check for a frame-parameter instead." "22.2") + (set-advertised-calling-convention 'all-completions '(string collection &optional predicate) "23.1") (set-advertised-calling-convention 'unintern '(name obarray) "23.3") diff --git a/src/data.c b/src/data.c index 6dd346bf8d..821fc37937 100644 --- a/src/data.c +++ b/src/data.c @@ -1176,9 +1176,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_ tem1 = blv->where; if (NILP (tem1) - || (blv->frame_local - ? !EQ (selected_frame, tem1) - : current_buffer != XBUFFER (tem1))) + || current_buffer != XBUFFER (tem1)) { /* Unload the previously loaded binding. */ @@ -1189,16 +1187,8 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_ { Lisp_Object var; XSETSYMBOL (var, symbol); - if (blv->frame_local) - { - tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); - set_blv_where (blv, selected_frame); - } - else - { - tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist)); - set_blv_where (blv, Fcurrent_buffer ()); - } + tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist)); + set_blv_where (blv, Fcurrent_buffer ()); } if (!(blv->found = !NILP (tem1))) tem1 = blv->defcell; @@ -1266,7 +1256,7 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, } /* Store the value NEWVAL into SYMBOL. - If buffer/frame-locality is an issue, WHERE specifies which context to use. + If buffer-locality is an issue, WHERE specifies which context to use. (nil stands for the current buffer/frame). If BINDFLAG is SET_INTERNAL_SET, then if this symbol is supposed to @@ -1322,15 +1312,10 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, { struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); if (NILP (where)) - { - if (blv->frame_local) - where = selected_frame; - else - XSETBUFFER (where, current_buffer); - } + XSETBUFFER (where, current_buffer); + /* If the current buffer is not the buffer whose binding is - loaded, or if there may be frame-local bindings and the frame - isn't the right one, or if it's a Lisp_Buffer_Local_Value and + loaded, or if it's a Lisp_Buffer_Local_Value and the default binding is loaded, the loaded binding may be the wrong one. */ if (!EQ (blv->where, where) @@ -1347,9 +1332,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, /* Find the new binding. */ XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ tem1 = assq_no_quit (symbol, - (blv->frame_local - ? XFRAME (where)->param_alist - : BVAR (XBUFFER (where), local_var_alist))); + BVAR (XBUFFER (where), local_var_alist)); set_blv_where (blv, where); blv->found = 1; @@ -1376,9 +1359,6 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, and load that binding. */ else { - /* local_if_set is only supported for buffer-local - bindings, not for frame-local bindings. */ - eassert (!blv->frame_local); tem1 = Fcons (symbol, XCDR (blv->defcell)); bset_local_var_alist (XBUFFER (where), @@ -1442,9 +1422,6 @@ set_symbol_trapped_write (Lisp_Object symbol, enum symbol_trapped_write trap) struct Lisp_Symbol* sym = XSYMBOL (symbol); if (sym->trapped_write == SYMBOL_NOWRITE) xsignal1 (Qtrapping_constant, symbol); - else if (sym->redirect == SYMBOL_LOCALIZED - && SYMBOL_BLV (sym)->frame_local) - xsignal1 (Qtrapping_frame_local, symbol); sym->trapped_write = trap; } @@ -1784,7 +1761,6 @@ make_blv (struct Lisp_Symbol *sym, bool forwarded, eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); blv->fwd = forwarded ? valcontents.fwd : NULL; set_blv_where (blv, Qnil); - blv->frame_local = 0; blv->local_if_set = 0; set_blv_defcell (blv, tem); set_blv_valcell (blv, tem); @@ -1831,9 +1807,6 @@ The function `default-value' gets the default value and `set-default' sets it. break; case SYMBOL_LOCALIZED: blv = SYMBOL_BLV (sym); - if (blv->frame_local) - error ("Symbol %s may not be buffer-local", - SDATA (SYMBOL_NAME (variable))); break; case SYMBOL_FORWARDED: forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); @@ -1908,9 +1881,6 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break; case SYMBOL_LOCALIZED: blv = SYMBOL_BLV (sym); - if (blv->frame_local) - error ("Symbol %s may not be buffer-local", - SDATA (SYMBOL_NAME (variable))); break; case SYMBOL_FORWARDED: forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); @@ -2027,8 +1997,6 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) } case SYMBOL_LOCALIZED: blv = SYMBOL_BLV (sym); - if (blv->frame_local) - return variable; break; default: emacs_abort (); } @@ -2062,81 +2030,6 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) /* Lisp functions for creating and removing buffer-local variables. */ -/* Obsolete since 22.2. NB adjust doc of modify-frame-parameters - when/if this is removed. */ - -DEFUN ("make-variable-frame-local", Fmake_variable_frame_local, Smake_variable_frame_local, - 1, 1, "vMake Variable Frame Local: ", - doc: /* Enable VARIABLE to have frame-local bindings. -This does not create any frame-local bindings for VARIABLE, -it just makes them possible. - -A frame-local binding is actually a frame parameter value. -If a frame F has a value for the frame parameter named VARIABLE, -that also acts as a frame-local binding for VARIABLE in F-- -provided this function has been called to enable VARIABLE -to have frame-local bindings at all. - -The only way to create a frame-local binding for VARIABLE in a frame -is to set the VARIABLE frame parameter of that frame. See -`modify-frame-parameters' for how to set frame parameters. - -Note that since Emacs 23.1, variables cannot be both buffer-local and -frame-local any more (buffer-local bindings used to take precedence over -frame-local bindings). */) - (Lisp_Object variable) -{ - bool forwarded; - union Lisp_Val_Fwd valcontents; - struct Lisp_Symbol *sym; - struct Lisp_Buffer_Local_Value *blv = NULL; - - CHECK_SYMBOL (variable); - sym = XSYMBOL (variable); - - start: - switch (sym->redirect) - { - case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; - case SYMBOL_PLAINVAL: - forwarded = 0; valcontents.value = SYMBOL_VAL (sym); - if (EQ (valcontents.value, Qunbound)) - valcontents.value = Qnil; - break; - case SYMBOL_LOCALIZED: - if (SYMBOL_BLV (sym)->frame_local) - return variable; - else - error ("Symbol %s may not be frame-local", - SDATA (SYMBOL_NAME (variable))); - case SYMBOL_FORWARDED: - forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); - if (KBOARD_OBJFWDP (valcontents.fwd) || BUFFER_OBJFWDP (valcontents.fwd)) - error ("Symbol %s may not be frame-local", - SDATA (SYMBOL_NAME (variable))); - break; - default: emacs_abort (); - } - - if (SYMBOL_TRAPPED_WRITE_P (variable)) - error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); - - blv = make_blv (sym, forwarded, valcontents); - blv->frame_local = 1; - sym->redirect = SYMBOL_LOCALIZED; - SET_SYMBOL_BLV (sym, blv); - { - Lisp_Object symbol; - XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ - if (let_shadows_global_binding_p (symbol)) - { - AUTO_STRING (format, "Making %s frame-local while let-bound!"); - CALLN (Fmessage, format, SYMBOL_NAME (variable)); - } - } - return variable; -} - DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p, 1, 2, 0, doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER. @@ -2168,10 +2061,7 @@ BUFFER defaults to the current buffer. */) { elt = XCAR (tail); if (EQ (variable, XCAR (elt))) - { - eassert (!blv->frame_local); - return Qt; - } + return Qt; } return Qnil; } @@ -2230,7 +2120,6 @@ DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locu 1, 1, 0, doc: /* Return a value indicating where VARIABLE's current binding comes from. If the current binding is buffer-local, the value is the current buffer. -If the current binding is frame-local, the value is the selected frame. If the current binding is global (the default), the value is nil. */) (register Lisp_Object variable) { @@ -3664,7 +3553,6 @@ syms_of_data (void) DEFSYM (Qvoid_variable, "void-variable"); DEFSYM (Qsetting_constant, "setting-constant"); DEFSYM (Qtrapping_constant, "trapping-constant"); - DEFSYM (Qtrapping_frame_local, "trapping-frame-local"); DEFSYM (Qinvalid_read_syntax, "invalid-read-syntax"); DEFSYM (Qinvalid_function, "invalid-function"); @@ -3745,8 +3633,6 @@ syms_of_data (void) "Attempt to set a constant symbol"); PUT_ERROR (Qtrapping_constant, error_tail, "Attempt to trap writes to a constant symbol"); - PUT_ERROR (Qtrapping_frame_local, error_tail, - "Attempt to trap writes to a frame local variable"); PUT_ERROR (Qinvalid_read_syntax, error_tail, "Invalid read syntax"); PUT_ERROR (Qinvalid_function, error_tail, "Invalid function"); PUT_ERROR (Qwrong_number_of_arguments, error_tail, @@ -3876,7 +3762,6 @@ syms_of_data (void) defsubr (&Smake_variable_buffer_local); defsubr (&Smake_local_variable); defsubr (&Skill_local_variable); - defsubr (&Smake_variable_frame_local); defsubr (&Slocal_variable_p); defsubr (&Slocal_variable_if_set_p); defsubr (&Svariable_binding_locus); diff --git a/src/eval.c b/src/eval.c index 1d39730339..1313093a53 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3283,8 +3283,6 @@ specbind (Lisp_Object symbol, Lisp_Object value) do_specbind (sym, specpdl_ptr - 1, value, SET_INTERNAL_BIND); break; case SYMBOL_LOCALIZED: - if (SYMBOL_BLV (sym)->frame_local) - error ("Frame-local vars cannot be let-bound"); case SYMBOL_FORWARDED: { Lisp_Object ovalue = find_symbol_value (symbol); diff --git a/src/frame.c b/src/frame.c index b1d89f396e..652d58440f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2478,28 +2478,6 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) return; } - /* If PROP is a symbol which is supposed to have frame-local values, - and it is set up based on this frame, switch to the global - binding. That way, we can create or alter the frame-local binding - without messing up the symbol's status. */ - if (SYMBOLP (prop)) - { - struct Lisp_Symbol *sym = XSYMBOL (prop); - start: - switch (sym->redirect) - { - case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; - case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break; - case SYMBOL_LOCALIZED: - { struct Lisp_Buffer_Local_Value *blv = sym->val.blv; - if (blv->frame_local && blv_found (blv) && XFRAME (blv->where) == f) - swap_in_global_binding (sym); - break; - } - default: emacs_abort (); - } - } - /* The tty color needed to be set before the frame's parameter alist was updated with the new value. This is not true any more, but we still do this test early on. */ @@ -2709,13 +2687,7 @@ The meaningful parameters are acted upon, i.e. the frame is changed according to their new values, and are also stored in the frame's parameter list so that `frame-parameters' will return them. PARMs that are not meaningful are still stored in the frame's parameter -list, but are otherwise ignored. - -The value of frame parameter FOO can also be accessed -as a frame-local binding for the variable FOO, if you have -enabled such bindings for that variable with `make-variable-frame-local'. -Note that this functionality is obsolete as of Emacs 22.2, and its -use is not recommended. Explicitly check for a frame-parameter instead. */) +list, but are otherwise ignored. */) (Lisp_Object frame, Lisp_Object alist) { struct frame *f = decode_live_frame (frame); diff --git a/src/lisp.h b/src/lisp.h index 66e9bd5641..061cf179f9 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2466,7 +2466,7 @@ struct Lisp_Buffer_Objfwd }; /* struct Lisp_Buffer_Local_Value is used in a symbol value cell when - the symbol has buffer-local or frame-local bindings. (Exception: + the symbol has buffer-local bindings. (Exception: some buffer-local variables are built-in, with their values stored in the buffer structure itself. They are handled differently, using struct Lisp_Buffer_Objfwd.) @@ -2494,9 +2494,6 @@ struct Lisp_Buffer_Local_Value /* True means that merely setting the variable creates a local binding for the current buffer. */ bool_bf local_if_set : 1; - /* True means this variable can have frame-local bindings, otherwise, it is - can have buffer-local bindings. The two cannot be combined. */ - bool_bf frame_local : 1; /* True means that the binding now loaded was found. Presumably equivalent to (defcell!=valcell). */ bool_bf found : 1; @@ -3384,7 +3381,7 @@ make_symbol_constant (Lisp_Object sym) XSYMBOL (sym)->trapped_write = SYMBOL_NOWRITE; } -/* Buffer-local (also frame-local) variable access functions. */ +/* Buffer-local variable access functions. */ INLINE int blv_found (struct Lisp_Buffer_Local_Value *blv) diff --git a/src/widget.c b/src/widget.c index 59ed431e23..97b4196f68 100644 --- a/src/widget.c +++ b/src/widget.c @@ -212,16 +212,6 @@ mark_shell_size_user_specified (Widget wmshell) #endif -/* Can't have static frame locals because of some broken compilers. - Normally, initializing a variable like this doesn't work in emacs, - but it's ok in this file because it must come after lastfile (and - thus have its data not go into text space) because Xt needs to - write to initialized data objects too. - */ -#if 0 -static Boolean first_frame_p = True; -#endif - static void set_frame_size (EmacsFrame ew) { diff --git a/test/src/data-tests.el b/test/src/data-tests.el index de0b8e6832..757522e399 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -332,7 +332,6 @@ comparing the subr with a much slower lisp implementation." ;; defvar and defconst modify the local binding [ doesn't matter for us ] ;; various kinds of special internal forwarding objects ;; a couple examples in manual, not enough -;; frame-local vars ;; variable aliases ;; Tests for watchpoints commit cf6ce9a1fe320ebe5b238af5f7af9416ac954855 Author: Paul Eggert Date: Wed Dec 21 09:52:28 2016 -0800 Port dumping better to WSL Problem reported by Angelo Graziosi in: http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00822.html * src/sysdep.c (disable_address_randomization): Detect buggy platforms where 'personality' always returns 0. diff --git a/src/sysdep.c b/src/sysdep.c index 96c9e53840..86d420f66c 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -144,11 +144,16 @@ static const int baud_convert[] = bool disable_address_randomization (void) { - bool disabled = false; int pers = personality (0xffffffff); - disabled = (! (pers & ADDR_NO_RANDOMIZE) - && 0 <= personality (pers | ADDR_NO_RANDOMIZE)); - return disabled; + if (pers < 0) + return false; + int desired_pers = pers | ADDR_NO_RANDOMIZE; + + /* Call 'personality' twice, to detect buggy platforms like WSL + where 'personality' always returns 0. */ + return (pers != desired_pers + && personality (desired_pers) == pers + && personality (0xffffffff) == desired_pers); } #endif commit 8661313efd5fd5b0a27fe82f276a1ff862646424 Author: Michael Albinus Date: Wed Dec 21 12:42:22 2016 +0100 Remove gateway methods in Tramp * doc/misc/tramp.texi (Top, Configuration): Remove section `Gateway methods', insert section `Firewalls' in menu. (History): Gateways are removed now. (Gateway methods): Remove section. (Multi-hops, Traces and Profiles): Don't reference to gateways anymore. (Firewalls): New section. * etc/NEWS: Gateway methods in Tramp have been removed. * lisp/net/tramp.el (tramp-methods): Adapt docstring. (tramp-file-name-port, tramp-accept-process-output): Simplify. * lisp/net/tramp-gw.el: Remove. * lisp/net/tramp-sh.el (tramp-gw-tunnel-method) (tramp-gw-socks-method): Remove declarations. (tramp-methods) : Remove `tramp-gw-args' and `tramp-default-port'. (Bug#18967) (tramp-do-copy-or-rename-file-out-of-band) (tramp-compute-multi-hops, tramp-maybe-open-connection): Remove gateway support. * test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults): Remove gateway tests. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 955a13e477..1ba22e0b59 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -143,11 +143,11 @@ Configuring @value{tramp} for use * Inline methods:: Inline methods. * External methods:: External methods. * GVFS based methods:: GVFS based external methods. -* Gateway methods:: Gateway methods. * Default Method:: Selecting a default method. * Default User:: Selecting a default user. * Default Host:: Selecting a default host. * Multi-hops:: Connecting to a remote host using multiple hops. +* Firewalls:: Passing firewalls. * Customizing Methods:: Using Non-Standard Methods. * Customizing Completion:: Selecting config files for user/host name completion. * Password handling:: Reusing passwords for several connections. @@ -406,10 +406,11 @@ April 2000 was the first time when multi-hop methods were added. In July 2002, @value{tramp} unified file names with Ange-FTP@. In July 2004, proxy hosts replaced multi-hop methods. Running commands on remote hosts was introduced in December 2005. Support for gateways -since April 2007. GVFS integration started in February 2009. Remote -commands on Windows hosts since September 2011. Ad-hoc multi-hop -methods (with a changed syntax) re-enabled in November 2011. In -November 2012, added Juergen Hoetzel's @file{tramp-adb.el}. +since April 2007 (and removed in December 2016). GVFS integration +started in February 2009. Remote commands on Windows hosts since +September 2011. Ad-hoc multi-hop methods (with a changed syntax) +re-enabled in November 2011. In November 2012, added Juergen +Hoetzel's @file{tramp-adb.el}. XEmacs support has been stopped in January 2016. @@ -453,7 +454,6 @@ installed and loaded: * Inline methods:: Inline methods. * External methods:: External methods. * GVFS based methods:: GVFS based external methods. -* Gateway methods:: Gateway methods. * Default Method:: Selecting a default method. Here we also try to help those who don't have the foggiest which method @@ -461,6 +461,7 @@ installed and loaded: * Default User:: Selecting a default user. * Default Host:: Selecting a default host. * Multi-hops:: Connecting to a remote host using multiple hops. +* Firewalls:: Passing firewalls. * Customizing Methods:: Using Non-Standard Methods. * Customizing Completion:: Selecting config files for user/host name completion. * Password handling:: Reusing passwords for several connections. @@ -997,51 +998,6 @@ Other methods to include are: @option{ftp} and @option{smb}. @end defopt -@node Gateway methods -@section Gateway methods -@cindex methods, gateway -@cindex gateway methods - -Gateway methods are for proxy host declarations (@pxref{Multi-hops}) -so as to pass through firewalls and proxy servers. They are not like -the other methods that declare direct connections to a remote host. - -A gateway method always comes with a port setting. @value{tramp} -targets the port number with the gateway method -@file{localhost#random_port} from where the firewall or proxy server -is accessed. - -Gateway methods support user name and password declarations for -authenticating the corresponding firewall or proxy server. Such -authentication can be passed through only if granted access by system -administrators. - -@table @asis -@item @option{tunnel} -@cindex method tunnel -@cindex tunnel method - -This method implements an HTTP tunnel via the @command{CONNECT} -command (conforming to RFC 2616, 2817 specifications). Proxy servers -using HTTP version 1.1 or later protocol support this command. - -For authentication, this protocol uses only @option{Basic -Authentication} (see RFC 2617). When no port number is specified, this -protocol defaults to @option{8080}. - -@item @option{socks} -@cindex method socks -@cindex socks method - -The @option{socks} method connects to SOCKSv5 servers (see RFC 1928) -and supports @option{Username/Password Authentication}. - -The default port number for the socks server is @option{1080}, if not -specified otherwise. - -@end table - - @node Default Method @section Selecting a default method @cindex default method @@ -1244,9 +1200,8 @@ regular expression which always matches. @var{proxy} is a literal @value{tramp} file name whose local name part is ignored, and the method and user name parts are optional. -The method must be an inline or gateway method (@pxref{Inline -methods}, @pxref{Gateway methods}). -If @var{proxy} is @code{nil}, no additional hop is required reaching +The method must be an inline method (@pxref{Inline methods}). If +@var{proxy} is @code{nil}, no additional hop is required reaching @var{user}@@@var{host}. For example, to pass through the host @samp{bastion.your.domain} as @@ -1313,32 +1268,6 @@ local one, first connect via @command{ssh}, and then apply '((regexp-quote (system-name)) nil nil)) @end group @end lisp - -The above configuration allows @value{tramp} connection as @samp{root} -to remote Ubuntu hosts. - -@option{tramp-default-proxies-alist} is also used for passing through -firewalls or proxy servers. - -For example, the local host @samp{proxy.your.domain} on port 3128 -serves as HTTP proxy to the outer world. User has access rights to -another proxy server on @samp{host.other.domain}.@footnote{HTTP tunnels -are intended for secure SSL/TLS communication. Therefore, many proxy -servers restrict the tunnels to related target ports. You might need -to run your ssh server on your target host @samp{host.other.domain} on -such a port, like 443 (https). See -@uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall} for -discussion of ethical issues.} Then the configuration is: - -@lisp -@group -(add-to-list 'tramp-default-proxies-alist - '("\\`host\\.other\\.domain\\'" nil - "@trampfn{tunnel,proxy.your.domain#3128,}")) -@end group -@end lisp - -Gateway methods in a multiple hop chain can be declared only as the first hop. @end defopt Passing through hops involves dealing with restricted shells, such as @@ -1362,6 +1291,50 @@ restricted shell: @end defopt +@node Firewalls +@section Passing firewalls +@cindex HTTP tunnel +@cindex proxy hosts, HTTP tunnel + +Sometimes, it is not possible to reach a remote host directly. A +firewall might be in the way, which could be passed via a proxy +server. + +Both ssh and PuTTY support such proxy settings, using an HTTP tunnel +via the @command{CONNECT} command (conforming to RFC 2616, 2817 +specifications). Proxy servers using HTTP version 1.1 or later +protocol support this command. + +@subsection Tunneling with ssh + +With ssh, you could use the @code{ProxyCommand} entry in the +@file{~/.ssh/config}: + +@example +@group +Host host.other.domain + ProxyCommand nc -X connect -x proxy.your.domain:3128 %h %p +@end group +@end example + +@code{nc} is BSD's netcat program, which establishes HTTP tunnels. Any +other program with such a feature could be used as well. + +In the example, opening @file{@trampfn{ssh,host.your.domain,}} passes +the HTTP proxy server @samp{proxy.your.domain} on port 3128. + +@subsection Tunneling with PuTTY + +PuTTY does not need an external program, HTTP tunnel support is +built-in. In the PuTTY config program, create a session for +@samp{host.your.domain}. In the @option{Connection/Data} entry, +select the @option{HTTP} option, and add @samp{proxy.your.domain} as +@option{Proxy hostname}, and 3128 as @option{Port}. + +Opening @file{@trampfn{plinkx,host.your.domain,}} passes the HTTP +proxy server @samp{proxy.your.domain} on port 3128. + + @node Customizing Methods @section Using Non-Standard Methods @cindex customizing methods @@ -3618,14 +3591,12 @@ have to be specifically enabled as shown in this code: (dolist (elt (all-completions "tramp-" obarray 'functionp)) (trace-function-background (intern elt))) (untrace-function 'tramp-read-passwd) -(untrace-function 'tramp-gw-basic-authentication) @end group @end lisp The buffer @file{*trace-output*} contains the output from the function -call traces. Disable @code{tramp-read-passwd} and -@code{tramp-gw-basic-authentication} to stop password strings from -being written to @file{*trace-output*}. +call traces. Disable @code{tramp-read-passwd} to stop password +strings from being written to @file{*trace-output*}. @node GNU Free Documentation License diff --git a/etc/NEWS b/etc/NEWS index ee74236a52..7338c0c6a7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -567,6 +567,10 @@ different group ID. Drive onsite repositories. +++ +*** Gateway methods in Tramp have been removed. Instead, the Tramp +manual documents how to configure ssh and PuTTY accordingly. + ++++ Setting the "ENV" environment variable in 'tramp-remote-process-environment' enables reading of shell initialization files. diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el deleted file mode 100644 index 8f8f107ec1..0000000000 --- a/lisp/net/tramp-gw.el +++ /dev/null @@ -1,339 +0,0 @@ -;;; tramp-gw.el --- Tramp utility functions for HTTP tunnels and SOCKS gateways - -;; Copyright (C) 2007-2016 Free Software Foundation, Inc. - -;; Author: Michael Albinus -;; Keywords: comm, processes -;; Package: tramp - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; Access functions for HTTP tunnels and SOCKS gateways from Tramp. -;; SOCKS functionality is implemented by socks.el from the w3 package. -;; HTTP tunnels are partly implemented in socks.el and url-http.el; -;; both implementations are not complete. Therefore, it is -;; implemented in this package. - -;;; Code: - -(require 'tramp) - -;; Pacify byte-compiler. -(eval-when-compile - (require 'cl) - (require 'custom)) -(defvar socks-noproxy) - -;; We don't add the following methods to `tramp-methods', in order to -;; exclude them from file name completion. - -;; Define HTTP tunnel method ... -;;;###tramp-autoload -(defconst tramp-gw-tunnel-method "tunnel" - "Method to connect HTTP gateways.") - -;; ... and port. -(defconst tramp-gw-default-tunnel-port 8080 - "Default port for HTTP gateways.") - -;; Define SOCKS method ... -;;;###tramp-autoload -(defconst tramp-gw-socks-method "socks" - "Method to connect SOCKS servers.") - -;; ... and port. -(defconst tramp-gw-default-socks-port 1080 - "Default port for SOCKS servers.") - -;; Autoload the socks library. It is used only when we access a SOCKS server. -(autoload 'socks-open-network-stream "socks") -(defvar socks-username (user-login-name)) -(defvar socks-server - (list "Default server" "socks" tramp-gw-default-socks-port 5)) - -;; Add a default for `tramp-default-user-alist'. Default is the local user. -;;;###tramp-autoload -(add-to-list - 'tramp-default-user-alist - (list (concat "\\`" - (regexp-opt (list tramp-gw-tunnel-method tramp-gw-socks-method)) - "\\'") - nil (user-login-name))) - -;; Internal file name functions and variables. - -(defvar tramp-gw-vector nil - "Keeps the remote host identification. Needed for Tramp messages.") - -(defvar tramp-gw-gw-vector nil - "Current gateway identification vector.") - -(defvar tramp-gw-gw-proc nil - "Current gateway process.") - -;; This variable keeps the listening process, in order to reuse it for -;; new processes. -(defvar tramp-gw-aux-proc nil - "Process listening on local port, as mediation between SSH and the gateway.") - -(defun tramp-gw-gw-proc-sentinel (proc _event) - "Delete auxiliary process when we are deleted." - (unless (tramp-compat-process-live-p proc) - (tramp-message - tramp-gw-vector 4 "Deleting auxiliary process `%s'" tramp-gw-gw-proc) - (let* ((tramp-verbose 0) - (p (tramp-get-connection-property proc "process" nil))) - (when (processp p) (delete-process p))))) - -(defun tramp-gw-aux-proc-sentinel (proc _event) - "Activate the different filters for involved gateway and auxiliary processes." - (when (tramp-compat-process-live-p proc) - ;; A new process has been spawned from `tramp-gw-aux-proc'. - (tramp-message - tramp-gw-vector 4 - "Opening auxiliary process `%s', speaking with process `%s'" - proc tramp-gw-gw-proc) - (set-process-query-on-exit-flag proc nil) - ;; We don't want debug messages, because the corresponding debug - ;; buffer might be undecided. - (let ((tramp-verbose 0)) - (tramp-set-connection-property tramp-gw-gw-proc "process" proc) - (tramp-set-connection-property proc "process" tramp-gw-gw-proc)) - ;; Set the process-filter functions for both processes. - (set-process-filter proc 'tramp-gw-process-filter) - (set-process-filter tramp-gw-gw-proc 'tramp-gw-process-filter) - ;; There might be already some output from the gateway process. - (with-current-buffer (process-buffer tramp-gw-gw-proc) - (unless (= (point-min) (point-max)) - (let ((s (buffer-string))) - (delete-region (point) (point-max)) - (tramp-gw-process-filter tramp-gw-gw-proc s)))))) - -(defun tramp-gw-process-filter (proc string) - "Resend the string to the other process." - (let ((tramp-verbose 0)) - ;; The other process might have been stopped already. We don't - ;; want to be interrupted then. - (ignore-errors - (process-send-string - (tramp-get-connection-property proc "process" nil) string)))) - -;;;###tramp-autoload -(defun tramp-gw-open-connection (vec gw-vec target-vec) - "Open a remote connection to VEC (see `tramp-file-name' structure). -Take GW-VEC as SOCKS or HTTP gateway, i.e. its method must be a -gateway method. TARGET-VEC identifies where to connect to via -the gateway, it can be different from VEC when there are more -hops to be applied. - -It returns a string like \"localhost#port\", which must be used -instead of the host name declared in TARGET-VEC." - - ;; Remember vectors for property retrieval. - (setq tramp-gw-vector vec - tramp-gw-gw-vector gw-vec) - - ;; Start listening auxiliary process. - (unless (tramp-compat-process-live-p tramp-gw-aux-proc) - (let ((aux-vec - (vector "aux" (tramp-file-name-user gw-vec) - (tramp-file-name-host gw-vec) nil nil))) - (setq tramp-gw-aux-proc - (make-network-process - :name (tramp-buffer-name aux-vec) :buffer nil :host 'local - :server t :noquery t :service t :coding 'binary)) - (set-process-sentinel tramp-gw-aux-proc 'tramp-gw-aux-proc-sentinel) - (set-process-query-on-exit-flag tramp-gw-aux-proc nil) - (tramp-message - vec 4 "Opening auxiliary process `%s', listening on port %d" - tramp-gw-aux-proc (process-contact tramp-gw-aux-proc :service)))) - - (let* ((gw-method - (intern - (tramp-find-method - (tramp-file-name-method gw-vec) - (tramp-file-name-user gw-vec) - (tramp-file-name-host gw-vec)))) - (socks-username - (tramp-find-user - (tramp-file-name-method gw-vec) - (tramp-file-name-user gw-vec) - (tramp-file-name-host gw-vec))) - ;; Declare the SOCKS server to be used. - (socks-server - (list "Tramp temporary socks server list" - ;; Host name. - (tramp-file-name-real-host gw-vec) - ;; Port number. - (or (tramp-file-name-port gw-vec) - (case gw-method - (tunnel tramp-gw-default-tunnel-port) - (socks tramp-gw-default-socks-port))) - ;; Type. We support only http and socks5, NO socks4. - ;; 'http could be used when HTTP tunnel works in socks.el. - 5)) - ;; The function to be called. - (socks-function - (case gw-method - (tunnel 'tramp-gw-open-network-stream) - (socks 'socks-open-network-stream))) - socks-noproxy) - - ;; Open SOCKS process. - (setq tramp-gw-gw-proc - (funcall - socks-function - (let ((tramp-verbose 0)) (tramp-get-connection-name gw-vec)) - (let ((tramp-verbose 0)) (tramp-get-connection-buffer gw-vec)) - (tramp-file-name-real-host target-vec) - (tramp-file-name-port target-vec))) - (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel) - (set-process-coding-system tramp-gw-gw-proc 'binary 'binary) - (set-process-query-on-exit-flag tramp-gw-gw-proc nil) - (tramp-message - vec 4 "Opened %s process `%s'" - (case gw-method ('tunnel "HTTP tunnel") ('socks "SOCKS")) - tramp-gw-gw-proc) - - ;; Return the new host for gateway access. - (format "localhost#%d" (process-contact tramp-gw-aux-proc :service)))) - -(defun tramp-gw-open-network-stream (name buffer host service) - "Open stream to proxy server HOST:SERVICE. -Resulting process has name NAME and buffer BUFFER. If -authentication is requested from proxy server, provide it." - (let ((command (format (concat - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: %s:%d\r\n" - "Connection: keep-alive\r\n" - "User-Agent: Tramp/%s\r\n") - host service host service tramp-version)) - (authentication "") - (first t) - found proc) - - (while (not found) - ;; Clean up. - (when (processp proc) (delete-process proc)) - (with-current-buffer buffer (erase-buffer)) - ;; Open network stream. - (setq proc (open-network-stream - name buffer (nth 1 socks-server) (nth 2 socks-server))) - (set-process-coding-system proc 'binary 'binary) - (set-process-query-on-exit-flag proc nil) - ;; Send CONNECT command. - (process-send-string proc (format "%s%s\r\n" command authentication)) - (tramp-message - tramp-gw-vector 6 "\n%s" - (format - "%s%s\r\n" command - (replace-regexp-in-string ;; no password in trace! - "Basic [^\r\n]+" "Basic xxxxx" authentication t))) - (with-current-buffer buffer - ;; Trap errors to be traced in the right trace buffer. Often, - ;; proxies have a timeout of 60". We wait 65" in order to - ;; receive an answer this case. - (ignore-errors - (let ((tramp-verbose 0)) - (tramp-wait-for-regexp proc 65 "\r?\n\r?\n"))) - ;; Check return code. - (goto-char (point-min)) - (narrow-to-region - (point-min) - (or (search-forward-regexp "\r?\n\r?\n" nil t) (point-max))) - (tramp-message tramp-gw-vector 6 "\n%s" (buffer-string)) - (goto-char (point-min)) - (search-forward-regexp "^HTTP/[1-9]\\.[0-9]" nil t) - (case (condition-case nil (read (current-buffer)) (error)) - ;; Connected. - (200 (setq found t)) - ;; We need basic authentication. - (401 (setq authentication (tramp-gw-basic-authentication nil first))) - ;; Access forbidden. - (403 (tramp-error-with-buffer - (current-buffer) tramp-gw-vector 'file-error - "Connection to %s:%d forbidden." host service)) - ;; Target host not found. - (404 (tramp-error-with-buffer - (current-buffer) tramp-gw-vector 'file-error - "Host %s not found." host)) - ;; We need basic proxy authentication. - (407 (setq authentication (tramp-gw-basic-authentication t first))) - ;; Connection failed. - (503 (tramp-error-with-buffer - (current-buffer) tramp-gw-vector 'file-error - "Connection to %s:%d failed." host service)) - ;; That doesn't work at all. - (t (tramp-error-with-buffer - (current-buffer) tramp-gw-vector 'file-error - "Access to HTTP server %s:%d failed." - (nth 1 socks-server) (nth 2 socks-server)))) - ;; Remove HTTP headers. - (delete-region (point-min) (point-max)) - (widen) - (setq first nil))) - ;; Return the process. - proc)) - -(defun tramp-gw-basic-authentication (proxy pw-cache) - "Return authentication header for CONNECT, based on server request. -PROXY is an indication whether we need a Proxy-Authorization header -or an Authorization header. If PW-CACHE is non-nil, check for -password in password cache. This is done for the first try only." - - ;; `tramp-current-*' must be set for `tramp-read-passwd'. - (let ((tramp-current-method (tramp-file-name-method tramp-gw-gw-vector)) - (tramp-current-user (tramp-file-name-user tramp-gw-gw-vector)) - (tramp-current-host (tramp-file-name-host tramp-gw-gw-vector))) - (unless pw-cache (tramp-clear-passwd tramp-gw-gw-vector)) - ;; We are already in the right buffer. - (tramp-message - tramp-gw-vector 5 "%s required" - (if proxy "Proxy authentication" "Authentication")) - ;; Search for request header. We accept only basic authentication. - (goto-char (point-min)) - (search-forward-regexp - "^\\(Proxy\\|WWW\\)-Authenticate:\\s-*Basic\\s-+realm=") - ;; Return authentication string. - (format - "%s: Basic %s\r\n" - (if proxy "Proxy-Authorization" "Authorization") - (base64-encode-string - (format - "%s:%s" - socks-username - (tramp-read-passwd - nil - (format - "Password for %s@[%s]: " socks-username (read (current-buffer))))))))) - -(add-hook 'tramp-unload-hook - (lambda () - (unload-feature 'tramp-gw 'force))) - -(provide 'tramp-gw) - -;;; TODO: - -;; * Provide descriptive Commentary. -;; -;; * Enable it for several gateway processes in parallel. -;; -;; * Use `url-https-proxy-connect' as of Emacs 26. - -;;; tramp-gw.el ends here diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index fbf44b77a1..57cb6e11d2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -32,8 +32,6 @@ (eval-when-compile (require 'cl) (require 'dired)) -(defvar tramp-gw-tunnel-method) -(defvar tramp-gw-socks-method) (defvar vc-handled-backends) (defvar vc-bzr-program) (defvar vc-git-program) @@ -172,11 +170,7 @@ The string is used in `tramp-methods'.") (tramp-copy-program "scp") (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c"))) (tramp-copy-keep-date t) - (tramp-copy-recursive t) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) + (tramp-copy-recursive t))) ;;;###tramp-autoload (add-to-list 'tramp-methods '("scpx" @@ -191,11 +185,7 @@ The string is used in `tramp-methods'.") (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c"))) (tramp-copy-keep-date t) - (tramp-copy-recursive t) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) + (tramp-copy-recursive t))) ;;;###tramp-autoload (add-to-list 'tramp-methods '("rsync" @@ -237,11 +227,7 @@ The string is used in `tramp-methods'.") (tramp-async-args (("-q"))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) - (tramp-remote-shell-args ("-c")) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) + (tramp-remote-shell-args ("-c")))) ;;;###tramp-autoload (add-to-list 'tramp-methods '("sshx" @@ -251,11 +237,7 @@ The string is used in `tramp-methods'.") (tramp-async-args (("-q"))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) - (tramp-remote-shell-args ("-c")) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) + (tramp-remote-shell-args ("-c")))) ;;;###tramp-autoload (add-to-list 'tramp-methods '("telnet" @@ -263,8 +245,7 @@ The string is used in `tramp-methods'.") (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) - (tramp-remote-shell-args ("-c")) - (tramp-default-port 23))) + (tramp-remote-shell-args ("-c")))) ;;;###tramp-autoload (add-to-list 'tramp-methods '("nc" @@ -280,8 +261,7 @@ The string is used in `tramp-methods'.") ;; We use "-p" as required for newer busyboxes. For older ;; busybox/nc versions, the value must be (("-l") ("%r")). This ;; can be achieved by tweaking `tramp-connection-properties'. - (tramp-remote-copy-args (("-l") ("-p" "%r") ("2>/dev/null"))) - (tramp-default-port 23))) + (tramp-remote-copy-args (("-l") ("-p" "%r") ("2>/dev/null"))))) ;;;###tramp-autoload (add-to-list 'tramp-methods '("su" @@ -353,8 +333,7 @@ The string is used in `tramp-methods'.") ("/bin/sh") ("\""))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) - (tramp-remote-shell-args ("-c")) - (tramp-default-port 22))) + (tramp-remote-shell-args ("-c")))) ;;;###tramp-autoload (add-to-list 'tramp-methods `("plinkx" @@ -386,8 +365,7 @@ The string is used in `tramp-methods'.") (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k") ("-q") ("-r"))) (tramp-copy-keep-date t) - (tramp-copy-recursive t) - (tramp-default-port 22))) + (tramp-copy-recursive t))) ;;;###tramp-autoload (add-to-list 'tramp-methods `("psftp" @@ -2395,10 +2373,6 @@ The method used must be an out-of-band method." v "login-as" nil)) tramp-current-host (tramp-file-name-real-host v)) - ;; Expand hops. Might be necessary for gateway methods. - (setq v (car (tramp-compute-multi-hops v))) - (aset v 3 localname) - ;; Check which ones of source and target are Tramp files. (setq source (funcall (if (and (file-directory-p filename) @@ -2412,15 +2386,9 @@ The method used must be an out-of-band method." (tramp-make-copy-program-file-name v) (tramp-unquote-shell-quote-argument newname))) - ;; Check for host and port number. We cannot use - ;; `tramp-file-name-port', because this returns also - ;; `tramp-default-port', which might clash with settings in - ;; "~/.ssh/config". - (setq host (tramp-file-name-host v) - port "") - (when (string-match tramp-host-with-port-regexp host) - (setq port (string-to-number (match-string 2 host)) - host (string-to-number (match-string 1 host)))) + ;; Check for host and port number. + (setq host (tramp-file-name-real-host v) + port (tramp-file-name-port v)) ;; Check for user. There might be an interactive setting. (setq user (or (tramp-file-name-user v) @@ -4504,8 +4472,7 @@ Goes through the list `tramp-inline-compress-commands'." vec 2 "Couldn't find an inline transfer compress command"))))) (defun tramp-compute-multi-hops (vec) - "Expands VEC according to `tramp-default-proxies-alist'. -Gateway hops are already opened." + "Expands VEC according to `tramp-default-proxies-alist'." (let ((target-alist `(,vec)) (hops (or (tramp-file-name-hop vec) "")) (item vec) @@ -4562,32 +4529,6 @@ Gateway hops are already opened." ;; Start next search. (setq choices tramp-default-proxies-alist))))) - ;; Handle gateways. - (when (and (boundp 'tramp-gw-tunnel-method) (boundp 'tramp-gw-socks-method) - (string-match - (format - "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method) - (tramp-file-name-method (car target-alist)))) - (let ((gw (pop target-alist)) - (hop (pop target-alist))) - ;; Is the method prepared for gateways? - (unless (tramp-file-name-port hop) - (tramp-error - vec 'file-error - "Connection `%s' is not supported for gateway access." hop)) - ;; Open the gateway connection. - (push - (vector - (tramp-file-name-method hop) (tramp-file-name-user hop) - (tramp-gw-open-connection vec gw hop) nil nil) - target-alist) - ;; For the password prompt, we need the correct values. - ;; Therefore, we must remember the gateway vector. But we - ;; cannot do it as connection property, because it shouldn't - ;; be persistent. And we have no started process yet either. - (let ((tramp-verbose 0)) - (tramp-set-file-property (car target-alist) "" "gateway" hop)))) - ;; Foreign and out-of-band methods are not supported for multi-hops. (when (cdr target-alist) (setq choices target-alist) @@ -4802,13 +4743,6 @@ connection if a previous connection has died for some reason." (connection-timeout (tramp-get-method-parameter hop 'tramp-connection-timeout)) - (gw-args - (tramp-get-method-parameter hop 'tramp-gw-args)) - (gw (let ((tramp-verbose 0)) - (tramp-get-file-property hop "" "gateway" nil))) - (g-method (and gw (tramp-file-name-method gw))) - (g-user (and gw (tramp-file-name-user gw))) - (g-host (and gw (tramp-file-name-real-host gw))) (command login-program) ;; We don't create the temporary file. In ;; fact, it is just a prefix for the @@ -4832,12 +4766,6 @@ connection if a previous connection has died for some reason." (when (and process-name async-args) (setq login-args (append async-args login-args))) - ;; Add gateway arguments if necessary. - (when gw - (tramp-set-connection-property p "gateway" t) - (when gw-args - (setq login-args (append gw-args login-args)))) - ;; Check for port number. Until now, there's no ;; need for handling like method, user, host. (when (string-match tramp-host-with-port-regexp l-host) @@ -4850,11 +4778,10 @@ connection if a previous connection has died for some reason." (setq r-shell t))) ;; Set variables for computing the prompt for - ;; reading password. They can also be derived - ;; from a gateway. - (setq tramp-current-method (or g-method l-method) - tramp-current-user (or g-user l-user) - tramp-current-host (or g-host l-host)) + ;; reading password. + (setq tramp-current-method l-method + tramp-current-user l-user + tramp-current-host l-host) ;; Add login environment. (when login-env diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index da745524a1..4103a6e76a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -241,12 +241,7 @@ pair of the form (KEY VALUE). The following KEYs are defined: * `tramp-copy-recursive' Whether the operation copies directories recursively. * `tramp-default-port' - The default port of a method is needed in case of gateway connections. - Additionally, it is used as indication which method is prepared for - passing gateways. - * `tramp-gw-args' - As the attribute name says, additional arguments are specified here - when a method is applied via a gateway. + The default port of a method. * `tramp-tmpdir' A directory on the remote host for temporary files. If not specified, \"/tmp\" is taken as default. @@ -277,8 +272,7 @@ See the variables `tramp-local-coding-commands' and So, to summarize: if the method is an out-of-band method, then you must specify `tramp-copy-program' and `tramp-copy-args'. If it is an -inline method, then these two parameters should be nil. Methods which -are fit for gateways must have `tramp-default-port' at least. +inline method, then these two parameters should be nil. Notes: @@ -1139,8 +1133,7 @@ entry does not exist, return nil." (defun tramp-file-name-port (vec) "Return the port number of VEC." (save-match-data - (let ((method (tramp-file-name-method vec)) - (host (tramp-file-name-host vec))) + (let ((host (tramp-file-name-host vec))) (or (and (stringp host) (string-match tramp-host-with-port-regexp host) (string-to-number (match-string 2 host))) @@ -1267,9 +1260,6 @@ values." (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))) @@ -1359,9 +1349,6 @@ version, the function does nothing." (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))) @@ -3632,17 +3619,13 @@ connection buffer." This is needed in order to hide `last-coding-system-used', which is set for process communication also." (with-current-buffer (process-buffer proc) - ;; FIXME: If there is a gateway process, we need communication - ;; between several processes. Too complicate to implement, so we - ;; read output from all processes. - (let ((p (if (tramp-get-connection-property proc "gateway" nil) nil proc)) - buffer-read-only last-coding-system-used) + (let (buffer-read-only last-coding-system-used) ;; Under Windows XP, accept-process-output doesn't return ;; sometimes. So we add an additional timeout. (with-timeout ((or timeout 1)) - (accept-process-output p timeout timeout-msecs (and proc t))) - (tramp-message proc 10 "%s %s %s\n%s" - proc (process-status proc) p (buffer-string))))) + (accept-process-output proc timeout timeout-msecs (and proc t))) + (tramp-message proc 10 "%s %s\n%s" + proc (process-status proc) (buffer-string))))) (defun tramp-check-for-regexp (proc regexp) "Check, whether REGEXP is contained in process buffer of PROC. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ee8a95e7bd..2884187fa0 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -583,10 +583,6 @@ handled properly. BODY shall not contain a timeout." (when (and (load "tramp-gvfs" 'noerror 'nomessage) (symbol-value 'tramp-gvfs-enabled)) (should (string-equal (file-remote-p "/synce::" 'user) nil))) - ;; Default values in tramp-gw.el. - (dolist (m '("tunnel" "socks")) - (should - (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) ;; Default values in tramp-sh.el. (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) (should (string-equal (file-remote-p (format "/root@%s:" h) 'method) "su")))