From: Stefan Monnier Date: Mon, 13 Dec 2010 15:27:36 +0000 (-0500) Subject: Merge from emacs-23 X-Git-Tag: emacs-pretest-24.0.90~104^2~618^2~1322^2~278^2~129 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f49d1f52b2e368ef67dcfececd426de958548f4e;p=emacs.git Merge from emacs-23 --- f49d1f52b2e368ef67dcfececd426de958548f4e diff --cc doc/emacs/ChangeLog index e390c6cbc16,e16e41964c1..d300ed84062 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@@ -1,4 -1,32 +1,33 @@@ -2010-12-11 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * custom.texi (Init Syntax): Add index entries for "character syntax". + (Bug#7576) + -2010-12-11 Karel Klíč ++2010-12-13 Karel Klíč + + * text.texi (HTML Mode): Small fixes. (Bug#7607) + -2010-12-10 Glenn Morris ++2010-12-13 Glenn Morris + + * trouble.texi (Checklist): Fix typo in newsgroup name. + -2010-12-05 Chong Yidong ++2010-12-13 Chong Yidong + + * search.texi (Word Search): Note that the lazy highlight always + matches to whole words (Bug#7470). + -2010-12-04 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * display.texi (Optional Mode Line): Make the description of + load-average more accurate. + + * msdog.texi (Windows HOME): Mention that HOME can also be set in the + registry, with a cross-reference. + (Windows Startup): New node. Move the stuff about the current + directory from "Windows HOME". + -2010-11-23 Bob Rogers ++2010-12-13 Bob Rogers +2010-11-27 Bob Rogers * maintaining.texi (VC With A Locking VCS, VC Directory Commands): * vc1-xtra.texi (Customizing VC, General VC Options): Small fixes. diff --cc doc/lispref/ChangeLog index 36d85bc98ba,970da3f5ff2..2b2cc6251c4 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@@ -1,11 -1,36 +1,44 @@@ -2010-12-11 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * processes.texi (Shell Arguments): + * strings.texi (Creating Strings): Don't mention "shell commands"; + make it explicit that `split-string-and-unquote' and + `combine-and-quote-strings' are mainly for working with arguments + to call-process and start-process. + + * processes.texi (Shell Arguments): Fix documentation of + `split-string-and-unquote'. Add indexing. (Bug#7563) + -2010-12-07 Stefan Monnier ++2010-12-13 Stefan Monnier + + * modes.texi (Auto-Indentation): New section to document SMIE. + (Major Mode Conventions): + * text.texi (Mode-Specific Indent): Refer to it. + -2010-12-04 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * display.texi (Other Display Specs): Document left-fringe and + right-fringe display specs. + -2010-12-01 Stefan Monnier ++2010-12-13 Stefan Monnier + + * backups.texi (Making Backups): + * modes.texi (Example Major Modes): Use recommended coding style. + (Major Mode Basics, Derived Modes): Encourge more strongly use of + define-derived-mode. Mention completion-at-point-functions. + -2010-11-21 Chong Yidong ++2010-12-13 Chong Yidong + + * nonascii.texi (Converting Representations): + Document byte-to-string. +2010-12-08 Glenn Morris + + * buffers.texi (Modification Time): + verify-visited-file-modtime now defaults to the current buffer. + +2010-11-27 Chong Yidong + + * nonascii.texi (Converting Representations): Document byte-to-string. * strings.texi (Creating Strings): Don't mention semi-obsolete function char-to-string. @@@ -42,10 -61,10 +75,10 @@@ * customize.texi (Composite Types): Lower-case index entry. - * loading.texi (How Programs Do Loading): Document - load-file-name. (Bug#7346) + * loading.texi (How Programs Do Loading): + Document load-file-name. (Bug#7346) -2010-11-10 Glenn Morris +2010-11-17 Glenn Morris * text.texi (Kill Functions, Low-Level Kill Ring): Small fixes. diff --cc doc/lispref/modes.texi index 12f16b67663,0b6547177e0..5f59d4c4b62 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@@ -3223,6 -3215,665 +3215,659 @@@ Since this function is called after eve reasonably fast. @end defvar + @node Auto-Indentation + @section Auto-indention of code + + For programming languages, an important feature of a major mode is to + provide automatic indentation. This is controlled in Emacs by + @code{indent-line-function} (@pxref{Mode-Specific Indent}). + Writing a good indentation function can be difficult and to a large + extent it is still a black art. + + Many major mode authors will start by writing a simple indentation + function that works for simple cases, for example by comparing with the + indentation of the previous text line. For most programming languages + that are not really line-based, this tends to scale very poorly: + improving such a function to let it handle more diverse situations tends + to become more and more difficult, resulting in the end with a large, + complex, unmaintainable indentation function which nobody dares to touch. + + A good indentation function will usually need to actually parse the + text, according to the syntax of the language. Luckily, it is not + necessary to parse the text in as much detail as would be needed + for a compiler, but on the other hand, the parser embedded in the + indentation code will want to be somewhat friendly to syntactically + incorrect code. + + Good maintainable indentation functions usually fall into 2 categories: + either parsing forward from some ``safe'' starting point until the + position of interest, or parsing backward from the position of interest. + Neither of the two is a clearly better choice than the other: parsing + backward is often more difficult than parsing forward because + programming languages are designed to be parsed forward, but for the + purpose of indentation it has the advantage of not needing to + guess a ``safe'' starting point, and it generally enjoys the property + that only a minimum of text will be analyzed to decide the indentation + of a line, so indentation will tend to be unaffected by syntax errors in + some earlier unrelated piece of code. Parsing forward on the other hand + is usually easier and has the advantage of making it possible to + reindent efficiently a whole region at a time, with a single parse. + + Rather than write your own indentation function from scratch, it is + often preferable to try and reuse some existing ones or to rely + on a generic indentation engine. There are sadly few such + engines. The CC-mode indentation code (used with C, C++, Java, Awk + and a few other such modes) has been made more generic over the years, + so if your language seems somewhat similar to one of those languages, + you might try to use that engine. @c FIXME: documentation? + Another one is SMIE which takes an approach in the spirit + of Lisp sexps and adapts it to non-Lisp languages. + + @menu + * SMIE:: A simple minded indentation engine + @end menu + + @node SMIE + @subsection Simple Minded Indentation Engine + + SMIE is a package that provides a generic navigation and indentation + engine. Based on a very simple parser using an ``operator precedence + grammar'', it lets major modes extend the sexp-based navigation of Lisp + to non-Lisp languages as well as provide a simple to use but reliable + auto-indentation. + + Operator precedence grammar is a very primitive technology for parsing + compared to some of the more common techniques used in compilers. + It has the following characteristics: its parsing power is very limited, + and it is largely unable to detect syntax errors, but it has the + advantage of being algorithmically efficient and able to parse forward + just as well as backward. In practice that means that SMIE can use it + for indentation based on backward parsing, that it can provide both + @code{forward-sexp} and @code{backward-sexp} functionality, and that it + will naturally work on syntactically incorrect code without any extra + effort. The downside is that it also means that most programming + languages cannot be parsed correctly using SMIE, at least not without + resorting to some special tricks (@pxref{SMIE Tricks}). + + @menu + * SMIE setup:: SMIE setup and features + * Operator Precedence Grammars:: A very simple parsing technique + * SMIE Grammar:: Defining the grammar of a language + * SMIE Lexer:: Defining tokens + * SMIE Tricks:: Working around the parser's limitations + * SMIE Indentation:: Specifying indentation rules + * SMIE Indentation Helpers:: Helper functions for indentation rules + * SMIE Indentation Example:: Sample indentation rules + @end menu + + @node SMIE setup + @subsubsection SMIE Setup and Features + + SMIE is meant to be a one-stop shop for structural navigation and + various other features which rely on the syntactic structure of code, in + particular automatic indentation. The main entry point is + @code{smie-setup} which is a function typically called while setting + up a major mode. + + @defun smie-setup grammar rules-function &rest keywords + Setup SMIE navigation and indentation. + @var{grammar} is a grammar table generated by @code{smie-prec2->grammar}. + @var{rules-function} is a set of indentation rules for use on + @code{smie-rules-function}. + @var{keywords} are additional arguments, which can include the following + keywords: + @itemize + @item + @code{:forward-token} @var{fun}: Specify the forward lexer to use. + @item + @code{:backward-token} @var{fun}: Specify the backward lexer to use. + @end itemize + @end defun + + Calling this function is sufficient to make commands such as + @code{forward-sexp}, @code{backward-sexp}, and @code{transpose-sexps} be + able to properly handle structural elements other than just the paired + parentheses already handled by syntax tables. For example, if the + provided grammar is precise enough, @code{transpose-sexps} can correctly + transpose the two arguments of a @code{+} operator, taking into account + the precedence rules of the language. + + Calling `smie-setup' is also sufficient to make TAB indentation work in -the expected way, and provides some commands that you can bind in the -major mode keymap. ++the expected way, extends @code{blink-matching-paren} to apply to ++elements like @code{begin...end}, and provides some commands that you ++can bind in the major mode keymap. + + @deffn Command smie-close-block + This command closes the most recently opened (and not yet closed) block. + @end deffn + + @deffn Command smie-down-list &optional arg + This command is like @code{down-list} but it also pays attention to + nesting of tokens other than parentheses, such as @code{begin...end}. + @end deffn + + @node Operator Precedence Grammars + @subsubsection Operator Precedence Grammars + + SMIE's precedence grammars simply give to each token a pair of + precedences: the left-precedence and the right-precedence. We say + @code{T1 < T2} if the right-precedence of token @code{T1} is less than + the left-precedence of token @code{T2}. A good way to read this + @code{<} is as a kind of parenthesis: if we find @code{... T1 something + T2 ...} then that should be parsed as @code{... T1 (something T2 ...} + rather than as @code{... T1 something) T2 ...}. The latter + interpretation would be the case if we had @code{T1 > T2}. If we have + @code{T1 = T2}, it means that token T2 follows token T1 in the same + syntactic construction, so typically we have @code{"begin" = "end"}. + Such pairs of precedences are sufficient to express left-associativity + or right-associativity of infix operators, nesting of tokens like + parentheses and many other cases. + + @c ¡Let's leave this undocumented to leave it more open for change! + @c @defvar smie-grammar + @c The value of this variable is an alist specifying the left and right + @c precedence of each token. It is meant to be initialized by using one of + @c the functions below. + @c @end defvar + + @defun smie-prec2->grammar table + This function takes a @emph{prec2} grammar @var{table} and returns an + alist suitable for use in @code{smie-setup}. The @emph{prec2} + @var{table} is itself meant to be built by one of the functions below. + @end defun + + @defun smie-merge-prec2s &rest tables + This function takes several @emph{prec2} @var{tables} and merges them + into a new @emph{prec2} table. + @end defun + + @defun smie-precs->prec2 precs + This function builds a @emph{prec2} table from a table of precedences + @var{precs}. @var{precs} should be a list, sorted by precedence (for + example @code{"+"} will come before @code{"*"}), of elements of the form + @code{(@var{assoc} @var{op} ...)}, where each @var{op} is a token that + acts as an operator; @var{assoc} is their associativity, which can be + either @code{left}, @code{right}, @code{assoc}, or @code{nonassoc}. + All operators in a given element share the same precedence level + and associativity. + @end defun + + @defun smie-bnf->prec2 bnf &rest resolvers + This function lets you specify the grammar using a BNF notation. + It accepts a @var{bnf} description of the grammar along with a set of + conflict resolution rules @var{resolvers}, and + returns a @emph{prec2} table. + + @var{bnf} is a list of nonterminal definitions of the form + @code{(@var{nonterm} @var{rhs1} @var{rhs2} ...)} where each @var{rhs} + is a (non-empty) list of terminals (aka tokens) or non-terminals. + + Not all grammars are accepted: + @itemize + @item + An @var{rhs} cannot be an empty list (an empty list is never needed, + since SMIE allows all non-terminals to match the empty string anyway). + @item + An @var{rhs} cannot have 2 consecutive non-terminals: each pair of + non-terminals needs to be separated by a terminal (aka token). + This is a fundamental limitation of operator precedence grammars. + @end itemize + + Additionally, conflicts can occur: + @itemize + @item + The returned @emph{prec2} table holds constraints between pairs of tokens, and + for any given pair only one constraint can be present: T1 < T2, + T1 = T2, or T1 > T2. + @item + A token can be an @code{opener} (something similar to an open-paren), + a @code{closer} (like a close-paren), or @code{neither} of the two + (e.g. an infix operator, or an inner token like @code{"else"}). + @end itemize + + Precedence conflicts can be resolved via @var{resolvers}, which + is a list of @emph{precs} tables (see @code{smie-precs->prec2}): for + each precedence conflict, if those @code{precs} tables + specify a particular constraint, then the conflict is resolved by using + this constraint instead, else a conflict is reported and one of the + conflicting constraints is picked arbitrarily and the others are + simply ignored. + @end defun + + @node SMIE Grammar + @subsubsection Defining the Grammar of a Language + + The usual way to define the SMIE grammar of a language is by + defining a new global variable that holds the precedence table by + giving a set of BNF rules. + For example, the grammar definition for a small Pascal-like language + could look like: + @example + @group + (require 'smie) + (defvar sample-smie-grammar + (smie-prec2->grammar + (smie-bnf->prec2 + @end group + @group + '((id) + (inst ("begin" insts "end") + ("if" exp "then" inst "else" inst) + (id ":=" exp) + (exp)) + (insts (insts ";" insts) (inst)) + (exp (exp "+" exp) + (exp "*" exp) + ("(" exps ")")) + (exps (exps "," exps) (exp))) + @end group + @group + '((assoc ";")) + '((assoc ",")) + '((assoc "+") (assoc "*"))))) + @end group + @end example + + @noindent + A few things to note: + + @itemize + @item + The above grammar does not explicitly mention the syntax of function + calls: SMIE will automatically allow any sequence of sexps, such as + identifiers, balanced parentheses, or @code{begin ... end} blocks + to appear anywhere anyway. + @item + The grammar category @code{id} has no right hand side: this does not + mean that it can match only the empty string, since as mentioned any + sequence of sexps can appear anywhere anyway. + @item + Because non terminals cannot appear consecutively in the BNF grammar, it + is difficult to correctly handle tokens that act as terminators, so the + above grammar treats @code{";"} as a statement @emph{separator} instead, + which SMIE can handle very well. + @item + Separators used in sequences (such as @code{","} and @code{";"} above) + are best defined with BNF rules such as @code{(foo (foo "separator" foo) ...)} + which generate precedence conflicts which are then resolved by giving + them an explicit @code{(assoc "separator")}. + @item + The @code{("(" exps ")")} rule was not needed to pair up parens, since + SMIE will pair up any characters that are marked as having paren syntax + in the syntax table. What this rule does instead (together with the + definition of @code{exps}) is to make it clear that @code{","} should + not appear outside of parentheses. + @item + Rather than have a single @emph{precs} table to resolve conflicts, it is + preferable to have several tables, so as to let the BNF part of the + grammar specify relative precedences where possible. + @item + Unless there is a very good reason to prefer @code{left} or + @code{right}, it is usually preferable to mark operators as associative, + using @code{assoc}. For that reason @code{"+"} and @code{"*"} are + defined above as @code{assoc}, although the language defines them + formally as left associative. + @end itemize + + @node SMIE Lexer + @subsubsection Defining Tokens + + SMIE comes with a predefined lexical analyzer which uses syntax tables + in the following way: any sequence of characters that have word or + symbol syntax is considered a token, and so is any sequence of + characters that have punctuation syntax. This default lexer is + often a good starting point but is rarely actually correct for any given + language. For example, it will consider @code{"2,+3"} to be composed + of 3 tokens: @code{"2"}, @code{",+"}, and @code{"3"}. + + To describe the lexing rules of your language to SMIE, you need + 2 functions, one to fetch the next token, and another to fetch the + previous token. Those functions will usually first skip whitespace and + comments and then look at the next chunk of text to see if it + is a special token. If so it should skip the token and + return a description of this token. Usually this is simply the string + extracted from the buffer, but it can be anything you want. + For example: + @example + @group + (defvar sample-keywords-regexp + (regexp-opt '("+" "*" "," ";" ">" ">=" "<" "<=" ":=" "="))) + @end group + @group + (defun sample-smie-forward-token () + (forward-comment (point-max)) + (cond + ((looking-at sample-keywords-regexp) + (goto-char (match-end 0)) + (match-string-no-properties 0)) + (t (buffer-substring-no-properties + (point) + (progn (skip-syntax-forward "w_") + (point)))))) + @end group + @group + (defun sample-smie-backward-token () + (forward-comment (- (point))) + (cond + ((looking-back sample-keywords-regexp (- (point) 2) t) + (goto-char (match-beginning 0)) + (match-string-no-properties 0)) + (t (buffer-substring-no-properties + (point) + (progn (skip-syntax-backward "w_") + (point)))))) + @end group + @end example + + Notice how those lexers return the empty string when in front of + parentheses. This is because SMIE automatically takes care of the + parentheses defined in the syntax table. More specifically if the lexer + returns nil or an empty string, SMIE tries to handle the corresponding + text as a sexp according to syntax tables. + + @node SMIE Tricks + @subsubsection Living With a Weak Parser + + The parsing technique used by SMIE does not allow tokens to behave + differently in different contexts. For most programming languages, this + manifests itself by precedence conflicts when converting the + BNF grammar. + + Sometimes, those conflicts can be worked around by expressing the + grammar slightly differently. For example, for Modula-2 it might seem + natural to have a BNF grammar that looks like this: + + @example + ... + (inst ("IF" exp "THEN" insts "ELSE" insts "END") + ("CASE" exp "OF" cases "END") + ...) + (cases (cases "|" cases) (caselabel ":" insts) ("ELSE" insts)) + ... + @end example + + But this will create conflicts for @code{"ELSE"}: on the one hand, the + IF rule implies (among many other things) that @code{"ELSE" = "END"}; + but on the other hand, since @code{"ELSE"} appears within @code{cases}, + which appears left of @code{"END"}, we also have @code{"ELSE" > "END"}. + We can solve the conflict either by using: + @example + ... + (inst ("IF" exp "THEN" insts "ELSE" insts "END") + ("CASE" exp "OF" cases "END") + ("CASE" exp "OF" cases "ELSE" insts "END") + ...) + (cases (cases "|" cases) (caselabel ":" insts)) + ... + @end example + or + @example + ... + (inst ("IF" exp "THEN" else "END") + ("CASE" exp "OF" cases "END") + ...) + (else (insts "ELSE" insts)) + (cases (cases "|" cases) (caselabel ":" insts) (else)) + ... + @end example + + Reworking the grammar to try and solve conflicts has its downsides, tho, + because SMIE assumes that the grammar reflects the logical structure of + the code, so it is preferable to keep the BNF closer to the intended + abstract syntax tree. + + Other times, after careful consideration you may conclude that those + conflicts are not serious and simply resolve them via the + @var{resolvers} argument of @code{smie-bnf->prec2}. Usually this is + because the grammar is simply ambiguous: the conflict does not affect + the set of programs described by the grammar, but only the way those + programs are parsed. This is typically the case for separators and + associative infix operators, where you want to add a resolver like + @code{'((assoc "|"))}. Another case where this can happen is for the + classic @emph{dangling else} problem, where you will use @code{'((assoc + "else" "then"))}. It can also happen for cases where the conflict is + real and cannot really be resolved, but it is unlikely to pose a problem + in practice. + + Finally, in many cases some conflicts will remain despite all efforts to + restructure the grammar. Do not despair: while the parser cannot be + made more clever, you can make the lexer as smart as you want. So, the + solution is then to look at the tokens involved in the conflict and to + split one of those tokens into 2 (or more) different tokens. E.g. if + the grammar needs to distinguish between two incompatible uses of the + token @code{"begin"}, make the lexer return different tokens (say + @code{"begin-fun"} and @code{"begin-plain"}) depending on which kind of + @code{"begin"} it finds. This pushes the work of distinguishing the + different cases to the lexer, which will thus have to look at the + surrounding text to find ad-hoc clues. + + @node SMIE Indentation + @subsubsection Specifying Indentation Rules + + Based on the provided grammar, SMIE will be able to provide automatic + indentation without any extra effort. But in practice, this default + indentation style will probably not be good enough. You will want to + tweak it in many different cases. + + SMIE indentation is based on the idea that indentation rules should be + as local as possible. To this end, it relies on the idea of + @emph{virtual} indentation, which is the indentation that a particular + program point would have if it were at the beginning of a line. + Of course, if that program point is indeed at the beginning of a line, + its virtual indentation is its current indentation. But if not, then + SMIE uses the indentation algorithm to compute the virtual indentation + of that point. Now in practice, the virtual indentation of a program + point does not have to be identical to the indentation it would have if + we inserted a newline before it. To see how this works, the SMIE rule + for indentation after a @code{@{} in C does not care whether the + @code{@{} is standing on a line of its own or is at the end of the + preceding line. Instead, these different cases are handled in the + indentation rule that decides how to indent before a @code{@{}. + + Another important concept is the notion of @emph{parent}: The + @emph{parent} of a token, is the head token of the nearest enclosing + syntactic construct. For example, the parent of an @code{else} is the + @code{if} to which it belongs, and the parent of an @code{if}, in turn, + is the lead token of the surrounding construct. The command + @code{backward-sexp} jumps from a token to its parent, but there are + some caveats: for @emph{openers} (tokens which start a construct, like + @code{if}), you need to start with point before the token, while for + others you need to start with point after the token. + @code{backward-sexp} stops with point before the parent token if that is + the @emph{opener} of the token of interest, and otherwise it stops with + point after the parent token. + + SMIE indentation rules are specified using a function that takes two + arguments @var{method} and @var{arg} where the meaning of @var{arg} and the + expected return value depend on @var{method}. + + @var{method} can be: + @itemize + @item + @code{:after}, in which case @var{arg} is a token and the function + should return the @var{offset} to use for indentation after @var{arg}. + @item + @code{:before}, in which case @var{arg} is a token and the function + should return the @var{offset} to use to indent @var{arg} itself. + @item + @code{:elem}, in which case the function should return either the offset + to use to indent function arguments (if @var{arg} is the symbol + @code{arg}) or the basic indentation step (if @var{arg} is the symbol + @code{basic}). + @item + @code{:list-intro}, in which case @var{arg} is a token and the function + should return non-@code{nil} if the token is followed by a list of + expressions (not separated by any token) rather than an expression. + @end itemize + + When @var{arg} is a token, the function is called with point just before + that token. A return value of nil always means to fallback on the + default behavior, so the function should return nil for arguments it + does not expect. + + @var{offset} can be: + @itemize + @item + @code{nil}: use the default indentation rule. + @item + @code{(column . @var{column})}: indent to column @var{column}. + @item + @var{number}: offset by @var{number}, relative to a base token which is + the current token for @code{:after} and its parent for @code{:before}. + @end itemize + + @node SMIE Indentation Helpers + @subsubsection Helper Functions for Indentation Rules + + SMIE provides various functions designed specifically for use in the + indentation rules function (several of those functions break if used in + another context). These functions all start with the prefix + @code{smie-rule-}. + + @defun smie-rule-bolp + Return non-@code{nil} if the current token is the first on the line. + @end defun + + @defun smie-rule-hanging-p + Return non-@code{nil} if the current token is @emph{hanging}. + A token is @emph{hanging} if it is the last token on the line + and if it is preceded by other tokens: a lone token on a line is not + hanging. + @end defun + + @defun smie-rule-next-p &rest tokens + Return non-@code{nil} if the next token is among @var{tokens}. + @end defun + + @defun smie-rule-prev-p &rest tokens + Return non-@code{nil} if the previous token is among @var{tokens}. + @end defun + + @defun smie-rule-parent-p &rest parents + Return non-@code{nil} if the current token's parent is among @var{parents}. + @end defun + + @defun smie-rule-sibling-p + Return non-nil if the current token's parent is actually a sibling. + This is the case for example when the parent of a @code{","} is just the + previous @code{","}. + @end defun + + @defun smie-rule-parent &optional offset + Return the proper offset to align the current token with the parent. + If non-@code{nil}, @var{offset} should be an integer giving an + additional offset to apply. + @end defun + + @defun smie-rule-separator method + Indent current token as a @emph{separator}. + + By @emph{separator}, we mean here a token whose sole purpose is to + separate various elements within some enclosing syntactic construct, and + which does not have any semantic significance in itself (i.e. it would + typically not exist as a node in an abstract syntax tree). + + Such a token is expected to have an associative syntax and be closely + tied to its syntactic parent. Typical examples are @code{","} in lists + of arguments (enclosed inside parentheses), or @code{";"} in sequences + of instructions (enclosed in a @code{@{...@}} or @code{begin...end} + block). + + @var{method} should be the method name that was passed to + `smie-rules-function'. + @end defun + + @node SMIE Indentation Example + @subsubsection Sample Indentation Rules + + Here is an example of an indentation function: + + @example -(eval-when-compile (require 'cl)) ;For the `case' macro. + (defun sample-smie-rules (kind token) - (case kind - (:elem (case token - (basic sample-indent-basic))) - (:after - (cond - ((equal token ",") (smie-rule-separator kind)) - ((equal token ":=") sample-indent-basic))) - (:before - (cond - ((equal token ",") (smie-rule-separator kind)) - ((member token '("begin" "(" "@{")) - (if (smie-rule-hanging-p) (smie-rule-parent))) - ((equal token "if") - (and (not (smie-rule-bolp)) (smie-rule-prev-p "else") - (smie-rule-parent))))))) ++ (pcase (cons kind token) ++ (`(:elem . basic) sample-indent-basic) ++ (`(,_ . ",") (smie-rule-separator kind)) ++ (`(:after . ":=") sample-indent-basic) ++ (`(:before . ,(or `"begin" `"(" `"@{"))) ++ (if (smie-rule-hanging-p) (smie-rule-parent))) ++ (`(:before . "if") ++ (and (not (smie-rule-bolp)) (smie-rule-prev-p "else") ++ (smie-rule-parent))))) + @end example + + @noindent + A few things to note: + + @itemize + @item + The first case indicates the basic indentation increment to use. + If @code{sample-indent-basic} is nil, then SMIE uses the global + setting @code{smie-indent-basic}. The major mode could have set + @code{smie-indent-basic} buffer-locally instead, but that + is discouraged. + + @item -The two (identical) rules for the token @code{","} make SMIE try to be -more clever when the comma separator is placed at the beginning of -lines. It tries to outdent the separator so as to align the code after -the comma; for example: ++The rule for the token @code{","} make SMIE try to be more clever when ++the comma separator is placed at the beginning of lines. It tries to ++outdent the separator so as to align the code after the comma; for ++example: + + @example + x = longfunctionname ( + arg1 + , arg2 + ); + @end example + + @item + The rule for indentation after @code{":="} exists because otherwise + SMIE would treat @code{":="} as an infix operator and would align the + right argument with the left one. + + @item + The rule for indentation before @code{"begin"} is an example of the use + of virtual indentation: This rule is used only when @code{"begin"} is + hanging, which can happen only when @code{"begin"} is not at the + beginning of a line. So this is not used when indenting + @code{"begin"} itself but only when indenting something relative to this + @code{"begin"}. Concretely, this rule changes the indentation from: + + @example + if x > 0 then begin + dosomething(x); + end + @end example + to + @example + if x > 0 then begin + dosomething(x); + end + @end example + + @item + The rule for indentation before @code{"if"} is similar to the one for + @code{"begin"}, but where the purpose is to treat @code{"else if"} + as a single unit, so as to align a sequence of tests rather than indent + each test further to the right. This function does this only in the + case where the @code{"if"} is not placed on a separate line, hence the + @code{smie-rule-bolp} test. + + If we know that the @code{"else"} is always aligned with its @code{"if"} + and is always at the beginning of a line, we can use a more efficient + rule: + @example + ((equal token "if") + (and (not (smie-rule-bolp)) (smie-rule-prev-p "else") + (save-excursion + (sample-smie-backward-token) ;Jump before the "else". + (cons 'column (current-column))))) + @end example + + The advantage of this formulation is that it reuses the indentation of + the previous @code{"else"}, rather than going all the way back to the + first @code{"if"} of the sequence. + @end itemize + @node Desktop Save Mode @section Desktop Save Mode @cindex desktop save mode diff --cc doc/misc/ChangeLog index 174d3015291,89cc21c31de..d7d5618ae8d --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@@ -1,45 -1,8 +1,50 @@@ -2010-12-02 Glenn Morris ++2010-12-13 Glenn Morris + + * cl.texi (For Clauses): Small fixes for frames and windows. + -2010-11-23 Glenn Morris ++2010-12-13 Glenn Morris +2010-12-11 Carsten Dominik + + * org.texi (Using capture): Document using prefix arguments for + finalizing capture. + (Agenda commands): Document prefix argument for the bulk scatter + command. + (Beamer class export): Document that also overlay arguments can be + passed to the column environment. + (Template elements): Document the new entry type. + +2010-12-11 Puneeth Chaganti + + * org.texi (Include files): Document :minlevel. + +2010-12-11 Julien Danjou + + * org.texi (Categories): Document category icons. + +2010-12-11 Eric Schulte + + * org.texi (noweb): Fix typo. + +2010-12-06 Tassilo Horn + + * gnus.texi (Server Commands): Point to the rest of the server + commands. + +2010-12-04 Lars Magne Ingebrigtsen + + * gnus.texi (Paging the Article): Note the reverse meanings of `C-u C-u + g'. + +2010-12-02 Julien Danjou + + * gnus.texi (Archived Messages): Remove gnus-outgoing-message-group. + +2010-11-28 Lars Magne Ingebrigtsen + + * gnus.texi (Customizing the IMAP Connection): Note the new defaults. + (Direct Functions): Note the STARTTLS upgrade. + +2010-11-27 Glenn Morris James Clark * nxml-mode.texi (Introduction): New section. diff --cc etc/ChangeLog index eba8529f63d,738c63828fe..6fd4b35b810 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@@ -1,8 -1,8 +1,13 @@@ -2010-12-04 W. Martin Borgert (tiny change) ++2010-12-13 W. Martin Borgert (tiny change) + + * schema/schemas.xml: Add DocBook (Bug#7491). + -2010-11-21 Ulrich Mueller ++2010-12-13 Ulrich Mueller +2010-12-11 Carsten Dominik + + * refcards/orgcard.tex: Cleanup. + +2010-11-27 Ulrich Mueller * HELLO: Add ancient Greek (Bug#7418). diff --cc lisp/ChangeLog index 5b0fab21cc9,bd5d5576867..e4310dd5fe8 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@@ -1,403 -1,148 +1,537 @@@ -2010-12-12 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * subr.el (posn-col-row): Evaluate header-line-format in the + context of the POSITION window's buffer. + -2010-12-11 Glenn Morris ++2010-12-13 Glenn Morris + + * subr.el (member-ignore-case, run-mode-hooks, insert-for-yank-1) + (with-silent-modifications): Doc fixes. + -2010-12-10 Michael Albinus ++2010-12-13 Michael Albinus + + * net/tramp.el (tramp-action-password, tramp-process-actions): + Revert patch from 2010-12-08. Use `save-restriction'. + -2010-12-09 Eli Zaretskii - - * menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p): - New functions. - (menu-bar-showhide-menu) : Use - them instead of `nil' and `>', respectively. (Bug#1077) - -2010-12-09 Stephen Berman ++2010-12-13 Stephen Berman + + * calendar/diary-lib.el (diary-list-sexp-entries): + Handle case of no newline at end of file. (Bug#7536) + -2010-12-09 Glenn Morris ++2010-12-13 Glenn Morris + + * mail/smtpmail.el (smtpmail-send-it): Revert previous change. + -2010-12-08 Michael Albinus ++2010-12-13 Michael Albinus + - * net/tramp.el (tramp-handle-start-file-process): Protect - buffer-modified value. (Bug#7557) - (tramp-action-password): Delete region, do not narrow. ++ * net/tramp.el (tramp-action-password): Delete region, do not narrow. + (tramp-process-actions): Do not widen. ++ * net/tramp-sh.el (tramp-sh-handle-start-file-process): ++ Protect buffer-modified value. (Bug#7557) + -2010-12-08 Jan Moringen ++2010-12-13 Jan Moringen + + * log-edit.el (log-edit-changelog-entries): + Regexp quote filename. (Bug#7505) + -2010-12-08 Tom Breton ++2010-12-13 Tom Breton + + * cus-edit.el (custom-save-all): + Bind print-length and print-level to nil. (Bug#7581) + -2010-12-08 Glenn Morris ++2010-12-13 Glenn Morris + + * mouse.el (mouse-menu-major-mode-map, mouse-menu-bar-map): + Run hooks to update menu contents. (Bug#7586) + + * mail/smtpmail.el (smtpmail-send-it): Avoid colons in the queued + file names, for the sake of MS Windows. (Bug#7588) + -2010-12-07 Stefan Monnier ++2010-12-13 Stefan Monnier + + * diff-mode.el (diff-refine-hunk): Make it work when the hunk contains + empty lines without a leading space. + -2010-12-06 Leo ++2010-12-13 Leo + + * dired-aux.el (dired-do-redisplay): Postpone dired-after-readin-hook + while mapping over marks (Bug#6810). + -2010-12-06 Chong Yidong ++2010-12-13 Chong Yidong + + * image-dired.el (image-dired-db-file) + (image-dired-temp-image-file, image-dired-gallery-dir) + (image-dired-temp-rotate-image-file): Set default values relative + to image-dired-dir (Bug#7518). + -2010-12-06 Lawrence Mitchell ++2010-12-13 Lawrence Mitchell + + * format.el (format-decode-run-method): Pass args FROM and TO, not + point-min and point-max, to shell-command-on-region (Bug#7488). + -2010-12-06 Jan Djärv ++2010-12-13 Jan Djärv + + * frame.el (blink-cursor-mode): Make default t for ns. + -2010-12-05 Bob Rogers ++2010-12-13 Bob Rogers + + * vc-dir.el (vc-dir-query-replace-regexp): Doc fix (Bug#7501). + -2010-12-05 Chong Yidong ++2010-12-13 Chong Yidong + + * comint.el (comint-dynamic-list-input-ring) + (comint-dynamic-complete-filename) + (comint-replace-by-expanded-filename) + (comint-dynamic-simple-complete) + (comint-dynamic-list-filename-completions) + (comint-dynamic-list-completions): Doc fix (Bug#7499). + + * subr.el (posn-x-y, posn-object-x-y, posn-object-width-height): + Doc fix (Bug#7471). + -2010-12-04 Martin Rudalics ++2010-12-13 Martin Rudalics + + * dired.el (dired-pop-to-buffer): Bind pop-up-frames to nil + (Bug#7533). + -2010-12-04 W. Martin Borgert (tiny change) ++2010-12-13 W. Martin Borgert (tiny change) + + * files.el (auto-mode-alist): Handle .dbk (DocBook) with xml-mode. + (Bug#7491). + -2010-12-04 Chong Yidong - - * simple.el (transient-mark-mode): Doc fix (Bug#7465). - -2010-12-04 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * files.el (file-relative-name): Handle UNC file names on + DOS/Windows. (Bug#4674) + -2010-12-03 Daiki Ueno ++2010-12-13 Daiki Ueno + + * epg.el (epg-digest-algorithm-alist): Replace "RMD160" with + "RIPEMD160" (Bug#7490). Reported by Daniel Kahn Gillmor. + (epg-context-set-passphrase-callback): Mention that the callback + is not called when used with GnuPG 2.x. + -2010-12-02 Glenn Morris ++2010-12-13 Glenn Morris + + * ps-print.el (ps-line-lengths-internal, ps-nb-pages): + Ensure ps-footer-font-size-internal is initialized. + Call ps-get-page-dimensions before trying to use ps-font-for-text. + -2010-12-01 Kenichi Handa ++2010-12-13 Kenichi Handa + + * mail/rmailmm.el (rmail-mime-parse): Call rmail-mime-process + within condition-case. + (rmail-show-mime): Don't use condition-case. + (rmail-search-mime-message): New function. + (rmail-search-mime-message-function): Set to + rmail-search-mime-message. + -2010-12-01 Leo ++2010-12-13 Leo + + * ido.el (ido-common-initialization): New function. (bug#3274) + (ido-mode): Use it. + (ido-completing-read): Call it. + +2010-12-12 Karl Fogel + + * bookmark.el (bookmark-name-from-full-record): Rename back to + this original name from `bookmark-name-from-record' reverting part + of 2010-12-08T08:09:27Z!kfogel@red-bean.com / kfogel@red-bean.com-20101208080927-5j9jqnb2xvcw4ogm. + As Drew Adams pointed out, there was no reason to cause churn for + third-party callers. + +2010-12-12 Alan Mackenzie + + * progmodes/cc-engine.el (c-forward-type): Before scanning a + template arglist, check that the current language supports this. + +2010-12-11 Glenn Morris + + * vc/vc-bzr.el (vc-bzr-state-heuristic): Also check that the executable + state of the file matches. (Bug#7544) + (vc-bzr-register, vc-bzr-checkin) + (vc-bzr-annotate-extract-revision-at-line): Doc fixes. + (vc-directory-exclusion-list): Remove unnecessary eval-after-load. + + * textmodes/sgml-mode.el (sgml-xml-guess): Add .xhtml extension. + +2010-12-11 Karel Klíč + + * files.el (auto-mode-alist): Use html-mode for *.xhtml. (Bug#7606) + +2010-12-10 Stefan Monnier + + Derive from prog-mode, use derived-mode-p, and fix up various + minor style issues in lisp/progmodes. + + * progmodes/vhdl-mode.el (vhdl-mode): + * progmodes/verilog-mode.el (verilog-mode): + * progmodes/vera-mode.el (vera-mode): + * progmodes/sql.el (sql-mode): + * progmodes/scheme.el (scheme-mode): + * progmodes/perl-mode.el (perl-mode): + * progmodes/octave-inf.el (inferior-octave-mode): + * progmodes/autoconf.el (autoconf-mode): + * progmodes/m4-mode.el (m4-mode): + * progmodes/inf-lisp.el (inferior-lisp-mode): + * progmodes/idlwave.el (idlwave-mode): + * progmodes/icon.el (icon-mode): + * progmodes/idlw-help.el (idlwave-help-mode): + * progmodes/dcl-mode.el (dcl-mode): + * progmodes/idlw-shell.el (idlwave-shell-mode): + * progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) + (ebrowse-member-mode, ebrowse-electric-position-mode): + Use define-derived-mode. + + * progmodes/xscheme.el (exit-scheme-interaction-mode) + (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) + (xscheme-debugger-mode-p, xscheme-send-string-1): + * progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) + (tcl-load-file, tcl-restart-with-file): + * progmodes/ps-mode.el (ps-run-running): + * progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): + * progmodes/js.el (js--get-all-known-symbols): + * progmodes/inf-lisp.el (inferior-lisp-proc): + * progmodes/idlwave.el (idlwave-beginning-of-statement) + (idlwave-template, idlwave-update-buffer-routine-info) + (idlwave-update-current-buffer-info) + (idlwave-get-routine-info-from-buffers, idlwave-choose) + (idlwave-scan-class-info, idlwave-fix-keywords) + (idlwave-list-buffer-load-path-shadows): + * progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) + (idlwave-toolbar-remove): + * progmodes/idlw-shell.el (idlwave-shell-save-and-action) + (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) + (idlwave-shell-menu-def): + * progmodes/idlw-complete-structtag.el + (idlwave-prepare-structure-tag-completion): + * progmodes/gud.el (gud-set-buffer): + * progmodes/f90.el (f90-backslash-not-special): + * progmodes/delphi.el (delphi-find-unit): Use derived-mode-p. + + * progmodes/xscheme.el (xscheme-start) + (local-set-scheme-interaction-buffer, scheme-interaction-mode): + * progmodes/which-func.el (which-function): + * progmodes/vhdl-mode.el (vhdl-set-style): + * progmodes/verilog-mode.el (verilog-set-compile-command) + (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) + (verilog-set-define, verilog-auto-reeval-locals): + * progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): + * progmodes/simula.el (simula-mode): + * progmodes/scheme.el (scheme-mode-variables, dsssl-mode): + * progmodes/python.el (python-check, python-mode): + * progmodes/prolog.el (prolog-mode-variables): + * progmodes/gud.el (gud-tooltip-activate-mouse-motions): + * progmodes/ebrowse.el (ebrowse-view-file-other-frame): + * progmodes/delphi.el (delphi-mode): + * progmodes/cc-styles.el (c-setup-paragraph-variables): + * progmodes/cc-mode.el (c-basic-common-init, c-common-init) + (c-font-lock-init): Move make-local-variable to their setq. + + * progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) + (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> + make-local-hook. + * progmodes/sh-script.el (sh-require-final-newline): Remove. + (sh-set-shell): Don't set require-final-newline since it's already done + by prog-mode. + * progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column + since we never set it. + * progmodes/ebrowse.el (ebrowse-set-tree-indentation): + Use read-string and standard prompt. + * progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. + * progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. + (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. + (meta-common-mode-map): Rename from meta-mode-map. + Remove C-m binding, which is a user preference, not mode specific. + (meta-common-mode): New major mode; replace meta-common-initialization. + * progmodes/js.el (js-mode): Call syntax-propertize rather than messing + around with font-lock. + * progmodes/etags.el (select-tags-table-mode): + Derive from special-mode. + * progmodes/octave-mod.el (octave-mode): + * progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) + (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) + (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): + Let define-derived-mode do its job. + * progmodes/cpp.el (cpp-edit-mode-map): + Move initialization into declaration. + (cpp-edit-mode): Use define-derived-mode. + (cpp-edit-load): Use derived-mode-p. + * progmodes/mixal-mode.el (mixal-mode): + * progmodes/f90.el (f90-mode): + * progmodes/cfengine.el (cfengine-mode): Don't bother setting + require-final-newline since prog-mode does it already. + * progmodes/cc-cmds.el (c-update-modeline): Use match-string. + * progmodes/asm-mode.el (asm-mode-map): Fix menu setup. + * progmodes/antlr-mode.el: Require cc-mode upfront. + (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in + the declaration. + (antlr-directory-dependencies, antlr-show-makefile-rules): + Use derived-mode-p. + (antlr-language-option): Don't assume point-min==1. + (antlr-mode): Use define-derived-mode. + * progmodes/ada-mode.el: Use derived-mode-p. + (ada-mode): Use define-derived-mode. + Use hack-local-variables-hook. + +2010-12-10 Stefan Monnier + + * textmodes/texinfo.el (texinfo-mode-map): Bind texinfo-insert-@end. + (texinfo-mode): Don't disable adaptive-fill-mode. + (texinfo-insert-block): Adjust cursor placement for blocks with arg. + (texinfo-insert-@end, texinfo-insert-braces, texinfo-insert-@code) + (texinfo-insert-@dfn, texinfo-insert-@email, texinfo-insert-@emph) + (texinfo-insert-@example, texinfo-insert-@file, texinfo-insert-@item) + (texinfo-insert-@kbd, texinfo-insert-@node, texinfo-insert-@noindent) + (texinfo-insert-@quotation, texinfo-insert-@samp) + (texinfo-insert-@strong, texinfo-insert-@table, texinfo-insert-@var) + (texinfo-insert-@uref): Use define-skeleton. + (texinfo-insert-@-with-arg): Delete. + +2010-12-10 Eli Zaretskii + + * arc-mode.el (archive-zip-extract): If w32-quote-process-args is + nil, do quote archive member names. (Bug#6144) + +2010-12-10 Glenn Morris + + * files.el (diff-no-select): Declare. + + * mail/emacsbug.el (report-emacs-bug): Use mail-user-agent properties. + (report-emacs-bug-create-existing-bugs-buffer): Avoid free variables. + + * comint.el (comint-input-ring-file-name): Doc fix. + +2010-12-09 Eli Zaretskii + + * menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p): + New functions. + (menu-bar-showhide-menu) : + Use them instead of `nil' and `>', respectively. + (menu-bar-showhide-tool-bar-menu): Use menu-bar-frame-for-menubar + instead of `nil'. + (toggle-menu-bar-mode-from-frame): Use menu-bar-frame-for-menubar + and menu-bar-positive-p instead of `nil' and `>', respectively. + (Bug#1077) + +2010-12-09 Vinicius Jose Latorre + + * whitespace.el (whitespace-newline-mode): Code fix. + +2010-12-09 Glenn Morris + + * play/landmark.el (lm-print-y,s,noise-int, lm-print-y,s,noise): + Rename functions without commas, update callers. + +2010-12-08 Jeff Dairiki (tiny change) + + * whitespace.el (whitespace-cleanup-region): + Clean up spaces before tabs. (Bug#7582) + +2010-12-08 Karl Fogel + + * bookmark.el: Adjust parameter names and doc strings to resolve + confusion over whether "bookmark" meant a bookmark name or a + bookmark record. Along the way, shorten one function's name for + similar reasons. (Issue #7548) + (bookmark-name-from-record): New name for + `bookmark-name-from-full-record'. All callers changed. + (bookmark-get-bookmark, bookmark-get-bookmark-record) + (bookmark-default-annotation-text, bookmark-prop-get, bookmark-prop-set) + (bookmark-get-annotation, bookmark-set-annotation) + (bookmark-get-filename, bookmark-set-filename) + (bookmark-get-position, bookmark-set-position) + (bookmark-get-front-context-string, bookmark-set-front-context-string) + (bookmark-get-rear-context-string, bookmark-set-rear-context-string) + (bookmark-get-handler, bookmark-edit-annotation, bookmark--jump-via) + (bookmark-handle-bookmark, bookmark-location, bookmark-show-annotation): + Rename `bookmark' parameter to `bookmark-name-or-record', to + clearly show its role, and shorten or adjust doc strings accordingly. + (bookmark-set-name): Same, and pass the parameter directly to + `bookmark-get-bookmark' instead of redundantly doing the callee's work. + (bookmark-default-annotation-text, bookmark-send-edited-annotation) + (bookmark-relocate, bookmark-insert-location, bookmark-insert) + (bookmark-delete): Rename `bookmark' parameter to `bookmark-name', + and in some cases shorten doc string accordingly. + (bookmark-rename): Change `old' and `new' parameters to `old-name' + and `new-name', and adjust an internal variable to avoid confusion. + (bookmark-jump, bookmark-jump-noselect): Clarify `bookmark' + parameter in doc string. + +2010-12-08 Glenn Morris + + * progmodes/gdb-mi.el (gdb): Try to initialize comint input history + from gdb's history file. (Bug#7575) + + * mail/emacsbug.el (report-emacs-bug): + Try to handle some other mail clients. + +2010-12-08 Stefan Monnier + + * files.el (dir-locals-collect-variables): Don't let errors stop us. + Use string-prefix-p. + (file-name-version-regexp): New var. + (file-name-sans-versions): + * jka-cmpr-hook.el (jka-compr-build-file-regexp): Use it, + (jka-compr-get-compression-info): Use dolist. + (jka-compr-compression-info-list): Don't bother specifying + version/backup regexps. + +2010-12-07 Tassilo Horn + + * simple.el (just-one-space): Make argument n default to 1 if + omitted. + +2010-12-07 Stefan Monnier + + * electric.el (electric-indent-post-self-insert-function): + Delete trailing newlines even if we don't reindent. + +2010-12-06 Stefan Monnier + + * minibuffer.el (completion-at-point): Remove the `arg'. + * bindings.el (complete-symbol): Move back from minibuffer.el. + +2010-12-06 Deniz Dogan + + * simple.el (just-one-space): Delete newlines for negative arg. + +2010-12-06 Stefan Monnier + + * ansi-color.el (ansi-color-unfontify-region): Replace by trivial def. + (ansi-color-filter-apply): Simplify. + (ansi-color-apply): Use `font-lock-face' rather than `face'. + +2010-12-05 Bob Rogers + + * vc/vc-dir.el (vc-dir-query-replace-regexp): Doc fix (Bug#7501). + +2010-12-04 Chong Yidong + + * dired.el (dired-use-ls-dired): Set default to a special + "unspecified" value. + (dired-insert-directory): When called the first time, check + whether "ls --dired" succeeds and set dired-use-ls-dired (Bug#7546). + +2010-12-04 Tak Ota + + * replace.el: Add "collect" feature to occur. + (occur-collect-regexp-history): New var. + (occur-read-primary-args): Return a replace string for nlines, + if needed. + (occur): Extend the meaning of nlines. + +2010-12-04 Stefan Monnier + + * progmodes/which-func.el (which-func-ff-hook): Log the error message. + (which-func-update-1): Distinguish symbols from strings. + (which-function): Stay within 80 columns. + +2010-12-03 Stefan Monnier + + * subr.el (with-demoted-errors): Distinguish symbols from strings. + + * newcomment.el (comment-styles): Add docs to each style (bug#7509). + Improve docstring. + (comment-style): Use comment-styles's docs to describe values. + +2010-12-03 Jan Djärv + + * term/common-win.el (x-setup-function-keys): Restore ns-new-frame + and ns-show-prefs (Bug#7535). + + * term/ns-win.el (global-map): Restore ns-new-frame and ns-show-prefs + bindings (Bug#7535). + +2010-12-03 Glenn Morris + + * nxml/nxml-mode.el: Require rng-nxml. + (rng-nxml-mode-init, nxml-enable-unicode-char-name-sets): + Remove declarations. + + * nxml/nxml-mode.el, nxml/nxml-outln.el, nxml/rng-loc.el: + * nxml/rng-nxml.el, nxml/rng-valid.el: + Remove leading `*' from defcustom docs. + + * startup.el (normal-top-level-add-subdirs-to-load-path): Simplify. + (normal-top-level-add-to-load-path, tty-handle-args): + Convert comments to basic doc-strings. + + * net/browse-url.el (browse-url-url-at-point) + (browse-url-default-browser): Remove autoload cookies. + + * mail/emacsbug.el (report-emacs-bug-create-existing-bugs-buffer): + Remove more undefined cl functions. + + * vc/diff.el (diff-sentinel): Make new arguments optional. + * ibuf-ext.el (diff-sentinel): Update declaration. + +2010-12-03 Daiki Ueno + + * epg.el (epg-digest-algorithm-alist): Replace "RMD160" with + "RIPEMD160" (Bug#7490). Reported by Daniel Kahn Gillmor. + (epg-context-set-passphrase-callback): Mention that the callback + is not called when used with GnuPG 2.x. + +2010-12-02 Michael Albinus + + * net/tramp.el (tramp-local-host-regexp): Add "localhost6". + (tramp-file-name-port): Check also for `tramp-default-port'. + (tramp-get-connection-name): New defun. + (tramp-get-connection-process): Use it. + (tramp-debug-message): Extend function exclude list. + (tramp-drop-volume-letter): Fix doc string. + + * net/tramp-cmds.el: Remove solved todo item. + + * net/tramp-efs.el: + * net/tramp-ftp.el: + * net/tramp-gvfs.el: + * net/tramp-gw.el: + * net/tramp-imap.el: + * net/tramp-smb.el: Fix regexps added to `tramp-default-method-alist' + and `tramp-default-user-alist', respectively. + + * net/tramp-gw.el (tramp-gw-open-connection): + Use `tramp-get-connection-name' and `tramp-get-connection-buffer'. + + * net/tramp-imap.el (tramp-imap-make-iht): Use just + `tramp-file-name-port'. + + * net/tramp-sh.el (tramp-methods): Add recursive options to "pscp" + and "psftp". Exchange "%k" marker with options. + (tramp-do-copy-or-rename-file, tramp-sh-handle-file-local-copy): + Compute size of link target. + (tramp-do-copy-or-rename-file-out-of-band). Move setting of + `tramp-current-*' up due to gateway methods. Optimze computing of + copy arguments. Use `tramp-get-connection-name' and + `tramp-get-connection-buffer'. Improve debug messages. + (tramp-compute-multi-hops): Remove port determination. + (tramp-maybe-open-connection): Use `tramp-get-connection-name'. + + * net/trampver.el: Update release number. + +2010-12-02 Glenn Morris + + * emacs-lisp/cl-macs.el (cl-parse-loop-clause): + Avoid infinite loop over windows. (Bug#7492) + + * progmodes/flymake.el (flymake-check-file-limit): + Allow nil to mean "no limit". + (flymake-check-patch-master-file-buffer): Update for above change. + Allow a .tex file-name extension to be optional. + (flymake-master-tex-init): Also match \include statements. + +2010-11-30 Sam Steingold + + * nxml/nxml-mode.el (nxml-parent-document): Add a variable. + (nxml-parent-document-set): A function to set `nxml-parent-document'. + (nxml-mode): Define using `define-derived-mode' instead of `defun'. + (nxml-mode-hook): Remove `defcustom' (auto-defined by + define-derived-mode'). + * nxml/rng-valid.el (rng-dtd-trivial-p): Add a helper function for + users who want to call `nxml-parent-document-set'. + 2010-11-27 Chong Yidong * log-edit.el (log-edit-font-lock-keywords): Don't try matching @@@ -2104,6137 -788,535 +2236,6137 @@@ * minibuffer.el (completion--replace): Move point where it belongs when there's a common suffix (bug#7215). -2010-10-15 Michael Albinus +2010-10-24 Chong Yidong - * net/tramp.el (tramp-open-connection-setup-interactive-shell): - Suppress expansion of tabs to spaces. Reported by Dale Sedivec - . + Merge read-color and facemenu-read-color (Bug#7242). -2010-10-15 Kenichi Handa + * faces.el (read-color): Use the completion code from + facemenu-read-color. Require match in completion. Doc fix. - * international/characters.el: Add category '|' (word breakable) - to fullwidth characters. + * facemenu.el (facemenu-read-color): Alias for read-color. + (facemenu-set-foreground, facemenu-set-background): + Use read-color. -2010-10-14 Kenichi Handa + * frame.el (set-background-color, set-foreground-color) + (set-cursor-color, set-mouse-color, set-border-color): + Use read-color. - * mail/rmail.el (rmail-show-message-1): Catch an error of - base64-decode-region and just show an error message (bug#7165). +2010-10-24 Leo - * ps-mule.el (ps-mule-font-spec-list): Delete it. Not used anymore. - (ps-mule-begin-job): Fix for the case that only ENCODING is set in - a font-spec (bug#7197). + * eshell/em-unix.el (eshell-remove-entries): Use the TRASH + argument of delete-file and delete-directory (Bug#7011). -2010-10-13 Glenn Morris +2010-10-24 Chong Yidong - * mail/emacsbug.el (report-emacs-bug): Mention debbugs.gnu.org. + * emacs-lisp/package.el (package-menu-mode-map): Inherit from + button-buffer-map. -2010-10-12 Juanma Barranquero +2010-10-24 Ralf Angeli - * international/mule.el (define-coding-system): - * international/titdic-cnv.el (quail-cxterm-package-ext-info): - * composite.el (compose-region): Fix typo in docstring. + * emacs-lisp/package.el (package--generate-package-list): Make the + *Packages* buffer read-only. -2010-10-10 Jan Djärv +2010-10-24 Alan Mackenzie - * term/ns-win.el (ns-right-alternate-modifier): New defvar. - (ns-right-option-modifier): New alias for ns-right-alternate-modifier. - (mac-right-option-modifier): New alias for ns-right-option-modifier. + * progmodes/cc-fonts.el (c-font-lock-declarations): Cache the + result of `c-beginning-of-decl-1' between invocations of a lambda + function (Bug #7265). - * cus-start.el (all): ns-right-alternate-modifier is new. +2010-10-24 Daiki Ueno -2010-10-10 Andreas Schwab + * epg-config.el (epg-gpg-program): Try to use "gpg2" if "gpg" + executable is not available on the system (Bug#7268). - * Makefile.in (ELCFILES): Update. +2010-10-24 Glenn Morris -2010-10-09 Stefan Monnier + * select.el (selection-coding-system, next-selection-coding-system): + Sync doc with C versions. - * emacs-lisp/lisp.el (lisp-completion-at-point): - Use emacs-lisp-mode-syntax-table for the whole function. + * w32-vars.el (x-select-enable-clipboard): + * term/x-win.el (x-select-enable-clipboard): Move to common-win. + * term/common-win.el (x-select-enable-clipboard): Move here. -2010-10-09 Richard Sharman (tiny change) + * term/tty-colors.el (tty-defined-color-alist): Remove duplicate + definition of C variable. - * progmodes/gdb-ui.el (gdb-mouse-toggle-breakpoint-margin) - (gdb-mouse-toggle-breakpoint-fringe): Correct regexp to - work when breakpoint number exceeds nine. + * frame.el (show-trailing-whitespace, auto-hscroll-mode) + (display-hourglass, hourglass-delay, cursor-in-non-selected-windows): + Don't redefine things that are defined in C. + * cus-start.el: Also handle :risky, :safe, :set, and :tag. + (show-trailing-whitespace, auto-hscroll-mode) + (display-hourglass, hourglass-delay, cursor-in-non-selected-windows): + Set up the appropriate custom properties. -2010-10-05 David Koppelman +2010-10-24 Chong Yidong - * hi-lock.el (hi-lock-font-lock-hook): Check font-lock-fontified - instead of font-lock-mode before adding keywords. - Remove hi-lock-mode off code. Remove inhibit hack. - (hi-lock-set-pattern): Only add keywords if font-lock-fontified - non-nil; removed hook inhibit hack. + Bind "C-c ]" to ... + * progmodes/f90.el (f90-mode-map): ... f90-insert-end. + * nxml/nxml-mode.el (nxml-mode-map): ... nxml-finish-element. + * textmodes/tex-mode.el (tex-mode-map): ... latex-close-block. + * textmodes/sgml-mode.el (sgml-mode-map): ... sgml-close-tag. -2010-10-09 Glenn Morris +2010-10-23 Glenn Morris - * emacs-lisp/shadow.el (find-emacs-lisp-shadows): Rename it... - (load-path-shadows-find): ... to this. - (list-load-path-shadows): Update for above change. + * textmodes/flyspell.el (flyspell-mode): If there was an error, + say what it was. - * mail/mail-utils.el (mail-mbox-from): Also try return-path. + * frame.el (auto-hscroll-mode, cursor-in-non-selected-windows): + Sync docs with C version. -2010-10-08 Glenn Morris + * term/ns-win.el (xw-defined-colors): + * term/x-win.el (xw-defined-colors): Make docs identical to w32-win. - * emacs-lisp/cl-compat.el, emacs-lisp/lmenu.el: Move to obsolete/. + * term/pc-win.el (x-select-enable-clipboard): + * term/x-win.el (x-select-enable-clipboard): + * w32-vars.el (x-select-enable-clipboard): Make doc-strings identical. - * emacs-lisp/shadow.el (lisp-shadow): Change prefix. - (shadows-compare-text-p): Make it an obsolete alias for... - (load-path-shadows-compare-text): ... new name. - (find-emacs-lisp-shadows): Update for above name change. - (load-path-shadows-same-file-or-nonexistent): New name for the old - shadow-same-file-or-nonexistent. + * comint.el (comint-password-prompt-regexp): Make it less vague. + Bump version. -2010-10-03 Chong Yidong + * help-fns.el (doc-file-to-man, doc-file-to-info): New commands. - * minibuffer.el (completion--some, completion--do-completion) - (minibuffer-complete-and-exit, minibuffer-completion-help) - (completion-basic-try-completion) - (completion-basic-all-completions) - (completion-pcm--find-all-completions): Use lexical-let to - avoid some false matches in variable completion (Bug#7056) + * help.el (finder-by-keyword): Remove unnecessary autoload. -2010-10-03 Olof Ohlsson Sax (tiny change) +2010-10-22 Glenn Morris - * vc-svn.el (vc-svn-merge-news): Use --non-interactive. (Bug#7152) + * loadup.el: Unconditionally load float-sup. + * paren.el (show-paren-delay): + * emacs-lisp/float-sup.el: + * emulation/cua-base.el (cua-prefix-override-inhibit-delay): + * obsolete/lazy-lock.el (lazy-lock-defer-time, lazy-lock-stealth-nice) + (lazy-lock-stealth-verbose): Assume float support. + * ps-print.el: Assume float support on Emacs. + * emacs-lisp/timer.el (timer-next-integral-multiple-of-time): + Remove non-float branch. -2010-10-03 Leo + * emacs-lisp/autoload.el (batch-update-autoloads): Update for + src/Makefile no longer being pre-processed. - * dnd.el (dnd-get-local-file-name): If MUST-EXIST is non-nil, only - return non-nil if the file exists (Bug#7090). +2010-10-22 Stefan Monnier -2010-09-30 Stefan Monnier + * emacs-lisp/find-func.el (find-library): Use test-completion. - * minibuffer.el (completion--replace): - Better preserve markers (bug#7138). +2010-10-21 Lars Magne Ingebrigtsen -2010-09-29 Juanma Barranquero + * newcomment.el (comment-dwim): Fix the intentation in the doc string. - * server.el (server-process-filter): Doc fix. +2010-10-21 Michael Albinus -2010-09-27 Drew Adams + * net/tramp-sh.el (tramp-do-file-attributes-with-stat): Do not use + space in stat format string. + (tramp-send-command): Unset $PS1 when using here documents, in + order not to get several prompts. + (tramp-get-inline-coding): Return `nil' in case of errors. - * dired.el (dired-save-positions): Doc fix. (Bug#7119) +2010-10-21 Daiki Ueno -2010-09-27 Andreas Schwab + * hexl.el (hexl-mode, hexl-mode-exit): + Tweak revert-buffer-function to inhibit auto-mode-alist (Bug#7252). + (hexl-revert-buffer-function): New function. + (hexl-before-revert-hook, hexl-after-revert-hook): Abolish. - * Makefile.in (ELCFILES): Update. +2010-10-19 Alan Mackenzie - * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): - Avoid infinite recursion on erroneous lambda form. (Bug#7114) + * progmodes/cc-langs.el (c-type-decl-prefix-key): C++ bit: + Move "\(const\|throw\|volatile\)\>" nearer the start of the regexp, so + that these keywords aren't wrongly matched as identifiers. -2010-09-27 Kenichi Handa + * progmodes/cc-mode.el (c-before-change, c-after-change): Move the + setting of c-new-BEG and c-new-END from c-before-change to + c-after-change. (Bug#7181) - * tar-mode.el (tar-header-block-tokenize): Decode filenames in - "ustar" format. +2010-10-19 Chong Yidong -2010-09-27 Kenichi Handa + * cus-face.el (custom-theme-set-faces): Revert 2010-10-18 change. + Don't mark as safe. - * international/mule.el (define-coding-system): Docstring fixed. + * custom.el (custom-theme-set-variables): Likewise. + (load-theme): Add custom-theme-set-faces and + custom-theme-set-variables to safe-functions while loading. + (custom-enabled-themes): Mark as risky. - * international/mule-diag.el (describe-character-set): Use princ - with proper print-length and print-level instead of insert. +2010-10-18 Julien Danjou -2010-09-26 Juanma Barranquero + * bindings.el: Remove end dashes in default mode-line-format. - * window.el (walk-windows): Doc fix (bug#7105). +2010-10-19 Chong Yidong -2010-09-23 Glenn Morris + * bindings.el (global-map): Bind C-d to delete-char and deletechar + to delete-forward-char. - * isearch.el (isearch-lazy-highlight-cleanup) - (isearch-lazy-highlight-initial-delay) - (isearch-lazy-highlight-interval) - (isearch-lazy-highlight-max-at-a-time, isearch-lazy-highlight-face): - * net/net-utils.el (ipconfig-program-options): - Move aliases to options before the associated definitions. + * simple.el (normal-erase-is-backspace-mode): Remap delete to + deletechar, and hence delete-forward-char. -2010-09-21 Stefan Monnier +2010-10-19 Stefan Monnier - * newcomment.el (comment-normalize-vars): Better test validity of - comment-end-skip. + * repeat.el (repeat): Use read-key (bug#6256). -2010-09-19 Stefan Monnier +2010-10-19 Chong Yidong - * emacs-lisp/float-sup.el (float-pi): New name for `pi'. - (float-e): New name for `e'. - (degrees-to-radians, radians-to-degrees): - * calendar/solar.el (solar-longitude): - * calculator.el (calculator-registers, calculator-funcall): - * textmodes/artist.el (artist-spray-random-points): - * play/bubbles.el (bubbles--initialize-images): Use new names. + * emacs-lisp/unsafep.el: Don't mark functions that display + messages as safe. Suggested by Johan Bockgård. -2010-09-19 Eric M. Ludlam +2010-10-19 Stefan Monnier - Update to CEDET 1.0's version of EIEIO. + * minibuffer.el (completion--replace): Move point where it belongs + when there's a common suffix (bug#7215). - * emacs-lisp/eieio.el (eieio-specialized-key-to-generic-key): - New function. - (eieio-defmethod, eieio-generic-form, eieio-generic-call): Use it. - (eieio-default-eval-maybe): Eval val instead of unquoting only. - (class-precedence-list): If class is nil, return nil. - (eieio-generic-call): If class of first input arg is nil, don't - look up static methods, and do check for primary methods. - (initialize-instance): See if the default needs to be evaluated - during the constructor. - (eieio-perform-slot-validation-for-default): Don't do the check - for values that will eventually be evaluated. - (eieio-eval-default-p): New function. - (eieio-default-eval-maybe): Use it. +2010-10-19 Kenichi Handa -2010-07-03 Jan Moringen + * international/characters.el: Add category '|' (word breakable) + to fullwidth characters. - * emacs-lisp/eieio.el (eieio-defclass): Allow :c3 - method-invocation-order. - (eieio-c3-candidate, eieio-c3-merge-lists): New functions. - (eieio-class-precedence-dfs): Compute class precedence list using - dfs algorithm. - (eieio-class-precedence-bfs): Compute class precedence list using - bfs algorithm. - (eieio-class-precedence-c3): Compute class precedence list using - c3 algorithm. - (class-precedence-list): New function. - (eieiomt-method-list, eieiomt-sym-optimize): Use it. - (inconsistent-class-hierarchy): New error symbol. - (call-next-method): Stow the replacement argument list for future - call-next-method invocations. +2010-10-19 Michael Albinus -2010-09-15 Glenn Morris + * net/tramp-sh.el (tramp-do-file-attributes-with-stat) + (tramp-do-directory-files-and-attributes-with-stat): Use "e0" in + order to make stat results a float. Patch by Andreas Schwab + . - * calendar/appt.el (appt-check): If not displaying the diary, - use (diary 1) to only get the entries we need. - (appt-make-list): Sort diary-list-entries, if we cannot guarantee - that it is in day order. (Bug#7019) +2010-10-18 Julien Danjou - * calendar/appt.el (appt-check): Rather than showing the diary, - just turn off invisible display, and only if needed. + * avoid.el (mouse-avoidance-ignore-p): Ignore mouse when it is + hidden by `make-pointer-invisible'. - * calendar/diary-lib.el (diary-list-entries): Doc fix. (Bug#7019) +2010-10-18 Stefan Monnier -2010-09-14 Stefan Monnier + * files.el (locate-file-completion-table): Strip non-matching elements + before checking length of list (bug#7238). - * emacs-lisp/byte-run.el (set-advertised-calling-convention): - Add `when' argument. Update callers. +2010-10-18 Chong Yidong - * subr.el (unintern): Declare the obarray arg mandatory. + * custom.el (custom-theme-set-variables): Mark as a safe function. + (load-theme): Check forms using unsafep. + + * cus-face.el (custom-theme-set-faces): Mark as a safe function. + +2010-10-17 Agustín Martín + + * textmodes/ispell.el (ispell-aspell-find-dictionary): + Fix aspell data file searching (bug#7230). + +2010-10-16 Chong Yidong + + * cus-theme.el (custom-theme--migrate-settings): New var. + (customize-create-theme): Allow editing the `user' theme. + (custom-theme-add-variable, custom-theme-add-var-1) + (custom-theme-add-face, custom-theme-add-face-1): Add a checkbox + to the front of each variable or face widget. + (custom-theme-write): Save theme settings in the correct order. + Optionally, remove saved settings from user customizations. + (custom-theme-write-variables, custom-theme-write-faces): + Save only the checked widgets. + (customize-themes): Add a link for migrating custom settings. + + * custom.el (custom-declare-theme, provide-theme): + Use custom-theme-name-valid-p. + (custom-theme-name-valid-p): Remove checks that are now + unnecessary since themes no longer obey load-path. + + * cus-edit.el (custom-variable-value-create): For the simple + style, hide documentation string when hidden. + +2010-10-16 Chong Yidong + + * cus-edit.el (custom-variable, custom-face): Combine the + :inhibit-magic and :display-style properties into a single + :custom-style property. + (custom-toggle-hide-variable, custom-toggle-hide-face): + New functions. If hiding an edited value, save it to :shown-value. + (custom-variable-value-create, custom-face-value-create): Use them. + (custom-magic-reset): Allow magic property to be unset. + + * custom.el: Custom themes no longer use load-path. + (custom-theme-load-path): New option. Change built-in theme + directory to etc/. + (custom-enabled-themes): Add custom-theme-load-path dependency. + (custom-theme--load-path): New function. + (load-theme, custom-available-themes): Use it. + + * cus-theme.el (describe-theme-1): Use custom-theme--load-path. + (customize-themes): Link to custom-theme-load-path variable. + (custom-theme-add-var-1, custom-theme-add-face-1): Use the + :custom-style property. + + * themes/*.el: Moved to etc/. + +2010-10-16 Ralf Angeli + + * textmodes/reftex-cite.el + (reftex-extract-bib-entries-from-thebibliography): Do not move + point when searching for \bibitem entries. Match entries with + spaces or tabs in front of arguments. + +2010-10-16 Chong Yidong + + * cus-theme.el (customize-create-theme): Delete overlays after + erasing. If given a THEME arg, display only the faces of that arg + instead of custom-theme--listed-faces. + (custom-theme-variable-menu, custom-theme-variable-action) + (custom-variable-reset-theme, custom-theme-delete-variable): Delete. + (custom-theme-add-variable, custom-theme-add-face): Apply value + from the theme settings, instead of the current value. + (custom-theme-add-var-1, custom-theme-add-face-1): New functions. + (custom-theme-visit-theme): Allow calling outside theme buffers. + (custom-theme-merge-theme): Don't enable the theme when merging. + (custom-theme-write-variables, custom-theme-write-faces): Use the + :shown-value properties to save buffer values, not global ones. + (customize-themes): Display a warning about user customizations. + + * cus-edit.el (custom-variable-value-create) + (custom-face-value-create): Obey new special properties + :shown-value and :inhibit-magic. -2010-09-14 Glenn Morris +2010-10-15 Michael Albinus - * calendar/diary-lib.el (diary-list-entries-hook, diary-sort-entries): - Doc fixes. + * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): + Suppress expansion of tabs to spaces. Reported by Dale Sedivec + . - * calendar/diary-lib.el (diary-included-files): New variable. - (diary-list-entries): Maybe initialize diary-included-files. - (diary-include-other-diary-files): Append to diary-included-files. - * calendar/appt.el (appt-update-list): Also check the members of - diary-included-files. (Bug#6999) - (appt-check): Doc fix. +2010-10-14 Kenichi Handa -2010-09-12 David Reitter + * mail/rmail.el (rmail-show-message-1): Catch an error of + base64-decode-region and just show an error message (bug#7165). - * simple.el (line-move-visual): Do not truncate goal column to - integer size. (Bug#7020) + * ps-mule.el (ps-mule-font-spec-list): Delete it. Not used anymore. + (ps-mule-begin-job): Fix for the case that only ENCODING is set in + a font-spec (bug#7197). -2010-09-11 Stefan Monnier +2010-10-14 Glenn Morris - * repeat.el (repeat): Allow repeating when the last event is a click. - Suggested by Drew Adams (bug#6256). + * mail/emacsbug.el (report-emacs-bug): Mention debbugs.gnu.org. -2010-09-11 Sascha Wilde +2010-10-14 Juanma Barranquero - * vc/vc-hg.el (vc-hg-state,vc-hg-working-revision): - Replace setting HGRCPATH to "" by some less invasive --config options. + * international/mule.el (define-coding-system): + * international/titdic-cnv.el (quail-cxterm-package-ext-info): + * composite.el (compose-region): Fix typo in docstring. -2010-09-11 Stefan Monnier +2010-10-14 Chong Yidong - * font-lock.el (font-lock-beginning-of-syntax-function): - Mark as obsolete. + * cus-face.el (custom-theme-set-faces): Call custom-push-theme + only after checking the theme-face property. -2010-09-10 Glenn Morris + * faces.el (face-spec-reset-face): Reset all attributes in one + single call to set-face-attribute. + (face-spec-match-p): Make it a defsubst. + (frame-set-background-mode): New arg KEEP-FACE-SPECS. + (x-create-frame-with-faces, tty-create-frame-with-faces) + (tty-set-up-initial-frame-faces): Don't recompute face specs in + frame-set-background-mode, since they are recomputed immediately + afterwards in face-set-after-frame-default. + (face-set-after-frame-default): Minor optimization. + (cursor): Provide non-trivial defface spec. - * menu-bar.el (menu-bar-options-save): Fix handling of menu-bar - and tool-bar modes. (Bug#6211) - (menu-bar-mode): Move setting of standard-value after the - minor-mode definition, otherwise it seems to have no effect. + * custom.el (custom-theme-recalc-face): Simplify. -2010-09-08 Masatake YAMATO +2010-10-14 Jay Belanger - * progmodes/antlr-mode.el (antlr-font-lock-additional-keywords): - Fix typo. (Bug#6976) + * calc/calc-alg.el (math-var): Rename from `var'. + (math-is-polynomial, math-is-poly-rec): Replace `var' + with `math-var'. -2010-09-06 Vinicius Jose Latorre + * calc/calcalg2.el (math-var): Rename from `var'. + (calcFunc-table, math-scan-for-limits): Replace `var' + with `math-var'. - * whitespace.el: Allow cleaning up blanks without blank - visualization (Bug#6651). Adjust help window for - whitespace-toggle-options (Bug#6479). Allow to use fill-column - instead of whitespace-line-column (from EmacsWiki). New version 13.1. - (whitespace-style): Add new value 'face. Adjust docstring. - (whitespace-space, whitespace-hspace, whitespace-tab): - Adjust foreground property face. - (whitespace-line-column): Adjust docstring and type declaration. - (whitespace-style-value-list, whitespace-toggle-option-alist) - (whitespace-help-text): Adjust const initialization. - (whitespace-toggle-options, global-whitespace-toggle-options): - Adjust docstring. - (whitespace-display-window, whitespace-interactive-char) - (whitespace-style-face-p, whitespace-color-on): Adjust code. - (whitespace-help-scroll): New fun. +2010-10-13 Glenn Morris -2010-09-05 Alexander Klimov (tiny change) + * subr.el (last): Deal with dotted lists (reported in bug#7174). - * files.el (directory-abbrev-alist): Use \` as default regexp. +2010-10-13 Stephen Berman - * emacs-lisp/rx.el (rx-any): Don't explode ranges that end in special - chars like - or ] (bug#6984). - (rx-any-condense-range): Explode 2-char ranges. + * subr.el (last): Use `safe-length' instead of `length' (bug#7206). -2010-09-02 Stefan Monnier +2010-10-13 Lars Magne Ingebrigtsen - * textmodes/bibtex.el: - * proced.el: Update to new email for Roland Winkler . + * net/tls.el (tls-program): Remove spurious %s from openssl. + (tls-starttls-switches): Remove starttls hack. + (open-tls-stream): Ditto. + (tls-find-starttls-argument): Ditto. -2010-09-02 Glenn Morris +2010-10-13 Juanma Barranquero - * desktop.el (desktop-path): Bump :version after 2009-09-15 change. + * image.el (image-library-alist): Declare as obsolete alias. + (image-type-available-p): Use `dynamic-library-alist'. -2010-08-31 Kenichi Handa + * term/w32-win.el (dynamic-library-alist): + Use instead of `image-library-alist'. - * international/mule-cmds.el (standard-display-european-internal): - Setup standard-display-table for 8-bit characters by storing 8-bit - characters in the element vector. +2010-10-13 IRIE Shinsuke (tiny change) - * disp-table.el (standard-display-8bit): - Setup standard-display-table for 8-bit characters by storing 8-bit - characters in the element vector. - (standard-display-european): Likewise. + * subr.el (last): Make it faster. (Bug#7174) -2010-08-26 Michael Albinus +2010-10-13 Rainer Orth (tiny change) - Sync with Tramp 2.1.19. + * Makefile.in (compile-clean): Use `` instead of $(). (Bug#7178) - * net/tramp-cmds.el (tramp-cleanup-all-connections) - (tramp-reporter-dump-variable, tramp-load-report-modules) - (tramp-append-tramp-buffers): Use `tramp-compat-funcall'. - (tramp-bug): Recommend setting of `tramp-verbose' to 9. +2010-10-12 Chong Yidong - * net/tramp-compat.el (top): Do not autoload - `tramp-handle-file-remote-p'. Load tramp-util.el and tramp-vc.el - only when `start-file-process' is not bound. - (byte-compile-not-obsolete-vars): Define if not bound. - (tramp-compat-funcall): New defmacro. - (tramp-compat-line-beginning-position) - (tramp-compat-line-end-position) - (tramp-compat-temporary-file-directory) - (tramp-compat-make-temp-file, tramp-compat-file-attributes) - (tramp-compat-copy-file, tramp-compat-copy-directory) - (tramp-compat-delete-file, tramp-compat-delete-directory) - (tramp-compat-number-sequence, tramp-compat-process-running-p): - Use it. - (tramp-advice-file-expand-wildcards): Do not use - `tramp-handle-file-remote-p'. - (tramp-compat-make-temp-file): Simplify fallback implementation. - (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT. - (tramp-compat-copy-tree): Remove function. - (tramp-compat-delete-file): New defun. - (tramp-compat-delete-directory): Provide implementation for older - Emacsen. - (tramp-compat-file-attributes): Handle only - `wrong-number-of-arguments' error. + * cus-theme.el (custom-theme--listed-faces): Add cursor face. + (describe-theme-1): Extract doc from unloaded themes. - * net/tramp-fish.el (tramp-fish-handle-copy-file): - Add PRESERVE_SELINUX_CONTEXT. - (tramp-fish-handle-delete-file): Add TRASH arg. - (tramp-fish-handle-directory-files-and-attributes): - Do not use `tramp-fish-handle-file-attributes. - (tramp-fish-handle-file-local-copy) - (tramp-fish-handle-insert-file-contents) - (tramp-fish-maybe-open-connection): Use `with-progress-reporter'. + * custom.el (custom-theme-name-valid-p): Don't list color-themes. - * net/tramp-gvfs.el (top): Require url-util. - (tramp-gvfs-mount-point): Remove. - (tramp-gvfs-file-name-handler-alist): Add `file-selinux-context' - and `set-file-selinux-context'. - (tramp-gvfs-stringify-dbus-message, tramp-gvfs-send-command) - (tramp-gvfs-handle-file-selinux-context) - (tramp-gvfs-handle-set-file-selinux-context): New defuns. - (with-tramp-dbus-call-method): Format trace message. - (tramp-gvfs-handle-copy-file): Handle PRESERVE-SELINUX-CONTEXT. - (tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file): - Implement backup call, when operation on local files fails. - Use progress reporter. Flush properties of changed files. - (tramp-gvfs-handle-delete-file): Add TRASH arg. - Use `tramp-compat-delete-file'. - (tramp-gvfs-handle-expand-file-name): Expand "~/". - (tramp-gvfs-handle-make-directory): Make more traces. - (tramp-gvfs-handle-write-region): Protect deleting tmpfile. - (tramp-gvfs-url-file-name): Hexify file name in url. - (tramp-gvfs-fuse-file-name): Take also prefix (like dav shares) - into account for the resulting file name. - (tramp-gvfs-handler-askquestion): Preserve current message, in - order to let progress reporter continue afterwards. (Bug#6257) - Return dummy mountpoint, when the answer is "no". - See `tramp-gvfs-maybe-open-connection'. - (tramp-gvfs-handler-mounted-unmounted) - (tramp-gvfs-connection-mounted-p): Test also for new mountspec - attribute "default_location". Set "prefix" property. - Handle default-location. - (tramp-gvfs-mount-spec): Return both prefix and mountspec. - (tramp-gvfs-maybe-open-connection): Test, whether mountpoint - exists. Raise an error, if not (due to a corresponding answer - "no" in interactive questions, for example). - Use `tramp-compat-funcall'. + * themes/tango-theme.el: + * themes/tango-dark-theme.el: + * themes/wheatgrass-theme.el: New files. - * net/tramp-imap.el (top): Autoload `epg-make-context'. - (tramp-imap-handle-copy-file): Add PRESERVE-SELINUX-CONTEXT. - (tramp-imap-do-copy-or-rename-file) - (tramp-imap-handle-insert-file-contents) - (tramp-imap-handle-file-local-copy): Use `with-progress-reporter'. - (tramp-imap-handle-delete-file): Add TRASH arg. +2010-10-12 Chong Yidong - * net/tramp-smb.el (tramp-smb-handle-copy-file): - Add PRESERVE-SELINUX-CONTEXT. - (tramp-smb-handle-copy-file) - (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) - (tramp-smb-handle-write-region, tramp-smb-maybe-open-connection): - Use `with-progress-reporter'. - (tramp-smb-handle-delete-file): Add TRASH arg. + * cus-theme.el (describe-theme, customize-themes) + (custom-theme-save): New commands. + (custom-new-theme-mode-map): Bind C-x C-s. + (custom-new-theme-mode): Use custom--initialize-widget-variables. + (customize-create-theme): New optional arg THEME. + (custom-theme-revert): Use it. + (custom-theme-visit-theme): Remove dead code. + (custom-theme-merge-theme): Use custom-available-themes. + (custom-theme-write): Make interactive. + (custom-theme-write): Use custom-theme-name-valid-p. + (describe-theme-1, custom-theme-choose-revert) + (custom-theme-checkbox-toggle, custom-theme-selections-toggle): + New funs. + (custom-theme-allow-multiple-selections): New option. + (custom-theme-choose-mode): New major mode. - * net/tramp.el (tramp-methods): Move hostname to the end in all - ssh `tramp-login-args'. Add `tramp-async-args' attribute where - appropriate. - (tramp-verbose): Describe verbose level 9. - (tramp-completion-function-alist) - (tramp-file-name-regexp, tramp-chunksize) - (tramp-local-coding-commands, tramp-remote-coding-commands) - (with-connection-property, tramp-completion-mode-p) - (tramp-action-process-alive, tramp-action-out-of-band) - (tramp-check-for-regexp, tramp-file-name-p, tramp-equal-remote) - (tramp-exists-file-name-handler): Fix docstring. - (tramp-remote-process-environment): Use `format' instead of - `concat'. Protect version string by apostroph. - (tramp-shell-prompt-pattern): Do not use a shy group in case of - XEmacs. - (tramp-file-name-regexp-unified) - (tramp-completion-file-name-regexp-unified): On W32 systems, do - not regard the volume letter as remote filename. (Bug#5447) - (tramp-perl-file-attributes) - (tramp-perl-directory-files-and-attributes): Don't pass "$3". - (tramp-vc-registered-read-file-names): Read input as - here-document, otherwise the command could exceed maximum length - of command line. - (tramp-file-name-handler-alist): Add `file-selinux-context' and - `set-file-selinux-context'. - (tramp-debug-message): Add `tramp-compat-funcall' to ignored - backtrace functions. - (tramp-error-with-buffer): Don't show the connection buffer when - we are in completion mode. - (tramp-progress-reporter-update, tramp-remote-selinux-p) - (tramp-handle-file-selinux-context) - (tramp-handle-set-file-selinux-context, tramp-process-sentinel) - (tramp-connectable-p, tramp-open-shell, tramp-get-remote-trash): - New defuns. - (with-progress-reporter): New defmacro. - (tramp-debug-outline-regexp): New defconst. - (top, tramp-rfn-eshadow-setup-minibuffer) - (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times) - (tramp-handle-dired-compress-file, tramp-handle-shell-command) - (tramp-completion-mode-p, tramp-check-for-regexp) - (tramp-open-connection-setup-interactive-shell) - (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd) - (tramp-time-diff, tramp-coding-system-change-eol-conversion) - (tramp-set-process-query-on-exit-flag, tramp-unload-tramp): - Use `tramp-compat-funcall'. - (tramp-handle-make-symbolic-link): Flush file properties. - (tramp-handle-load, tramp-handle-file-local-copy) - (tramp-handle-insert-file-contents, tramp-handle-write-region) - (tramp-handle-vc-registered, tramp-maybe-send-script) - (tramp-find-shell): Use `with-progress-reporter'. - (tramp-do-file-attributes-with-stat): Add space in format string, - in order to work around a bug in pdksh. Reported by Gilles Pion - . - (tramp-handle-verify-visited-file-modtime): Do not send a command - when the connection is not established. - (tramp-handle-set-file-times): Simplify the check for utc. - (tramp-handle-directory-files-and-attributes) - (tramp-get-remote-path): Use `copy-tree'. - (tramp-completion-handle-file-name-all-completions): Ensure, that - non remote files are still checked. Oops. - (tramp-handle-copy-file, tramp-do-copy-or-rename-file): - Handle PRESERVE-SELINUX-CONTEXT. - (tramp-do-copy-or-rename-file): Add progress reporter. - (tramp-do-copy-or-rename-file-directly): Do not use - `tramp-handle-file-remote-p'. - (tramp-do-copy-or-rename-file-out-of-band): - Use `tramp-compat-delete-directory'. - (tramp-do-copy-or-rename-file-out-of-band) - (tramp-compute-multi-hops, tramp-maybe-open-connection): - Use `format-spec-make'. - (tramp-handle-delete-file): Add TRASH arg. - (tramp-handle-dired-uncache): Flush directory cache, not only file - cache. - (tramp-handle-expand-file-name) - (tramp-completion-handle-file-name-all-completions) - (tramp-completion-handle-file-name-completion): - Use `tramp-connectable-p'. - (tramp-handle-start-file-process): Set connection property "vec". - Use it, in order to invalidate file caches. Check only for - `remote-tty' process property. - Implement tty setting. (Bug#4604, Bug#6360) - (tramp-file-name-for-operation): Add `call-process-region' and - `set-file-selinux-context'. - (tramp-find-foreign-file-name-handler) - (tramp-advice-make-auto-save-file-name) - (tramp-set-auto-save-file-modes): Remove superfluous check for - `stringp'. This is done inside `tramp-tramp-file-p'. - (tramp-file-name-handler): Trace 'quit. Catch the error for some - operations when we are in completion mode. This gives the user - the chance to correct the file name in the minibuffer. - (tramp-completion-mode-p): Use `non-essential'. - (tramp-handle-file-name-all-completions): Backward/ XEmacs - compatibility: Use `completion-ignore-case' if - `read-file-name-completion-ignore-case' does not exist. - (tramp-get-debug-buffer): Use `tramp-debug-outline-regexp'. - (tramp-find-shell, tramp-open-connection-setup-interactive-shell): - `tramp-open-shell'. - (tramp-action-password): Hide password prompt before next run. + * custom.el (custom-theme-set-variables): Remove dead code. + Obey custom--inhibit-theme-enable. + (custom--inhibit-theme-enable): New var. + (provide-theme): Obey it. + (load-theme): Replace load with manual read/eval, in order to + check for correctness. Use custom-theme-name-valid-p. + (custom-theme-name-valid-p): New function. + (custom-available-themes): Use it. + + * cus-edit.el (custom--initialize-widget-variables): New function. + (Custom-mode): Use it. + + * cus-face.el (custom-theme-set-faces): Remove dead code. + Obey custom--inhibit-theme-enable. + + * help-mode.el (help-theme-def, help-theme-edit): New buttons. + +2010-10-12 Juanma Barranquero + + * net/telnet.el (telnet-mode-map): Fix previous change (bug#7193). + +2010-10-12 Jan Djärv + + * term/ns-win.el (ns-right-alternate-modifier): New defvar. + (ns-right-option-modifier): New alias for ns-right-alternate-modifier. + (mac-right-option-modifier): New alias for ns-right-option-modifier. + + * cus-start.el (all): ns-right-alternate-modifier is new. + +2010-10-12 Stefan Monnier + + * emacs-lisp/lisp.el (lisp-completion-at-point): + Use emacs-lisp-mode-syntax-table for the whole function. + +2010-10-12 David Koppelman + + * hi-lock.el (hi-lock-font-lock-hook): Check font-lock-fontified + instead of font-lock-mode before adding keywords. + Remove hi-lock-mode off code. Remove inhibit hack. + (hi-lock-set-pattern): Only add keywords if font-lock-fontified + non-nil; removed hook inhibit hack. + +2010-10-12 Glenn Morris + + * emacs-lisp/shadow.el (find-emacs-lisp-shadows): Rename it... + (load-path-shadows-find): ... to this. + (list-load-path-shadows): Update for above change. + + * mail/mail-utils.el (mail-mbox-from): Also try return-path. + +2010-10-11 Katsumi Yamaoka + + * mail/hashcash.el, net/imap.el, pgg-parse.el, pgg.el: + Fix comment for declare-function. + +2010-10-11 Chong Yidong + + * custom.el (custom-fix-face-spec): New function; code moved from + custom-face-edit-fix-value. + (custom-push-theme): Use it when checking if a face has been + changed outside customize. + (custom-available-themes): New function. + (load-theme): Use it. + + * cus-edit.el (custom-face-edit-fix-value): Use custom-fix-face-spec. + + * custom.el (custom-push-theme): Cleanup (use cond). + (disable-theme): Recompute the saved-face property. + (custom-theme-recalc-face): Follow face alias before setting prop. + + * image.el (image-checkbox-checked, image-checkbox-unchecked): + New variables, containing checkbox images. + + * startup.el (fancy-startup-tail): + * wid-edit.el (checkbox): Use them. + +2010-10-10 Dan Nicolaescu + + * shell.el (shell-mode-map): + * progmodes/modula2.el (m2-mode-map): + * progmodes/inf-lisp.el (inferior-lisp-mode-map): + * play/mpuz.el (mpuz-mode-map): + * play/landmark.el (lm-mode-map): + * play/decipher.el (decipher-mode-map): + * play/5x5.el (5x5-mode-map): + * net/telnet.el (telnet-mode-map): + * net/quickurl.el (quickurl-list-mode-map): + * net/mairix.el (mairix-searches-mode-map): + * net/eudc-hotlist.el (eudc-hotlist-mode-map): + * net/dig.el (dig-mode-map): + * mail/mspools.el (mspools-mode-map): + * hexl.el (hexl-mode-map): + * emulation/ws-mode.el (wordstar-C-k-map, wordstar-mode-map) + (wordstar-C-o-map, wordstar-C-q-map): + * emacs-lisp/edebug.el (edebug-eval-mode-map): + * emacs-lisp/chart.el (chart-map): + * edmacro.el (edmacro-mode-map): + * erc/erc-list.el (erc-list-menu-mode-map): + * array.el (array-mode-map): Declare and define in one step. + + * vc/log-view.el (log-view-mode-map): Bind revert-buffer. + +2010-10-10 Daiki Ueno + + * epa.el (epa-passphrase-callback-function): Display filename + passed as the 3rd arg. + * epa-file.el (epa-file-passphrase-callback-function): + Pass filename to epa-passphrase-callback-function. + +2010-10-09 Chong Yidong + + * cus-edit.el (custom-face-widget-to-spec) + (custom-face-get-current-spec, custom-face-state): New functions. + (custom-face-set, custom-face-mark-to-save) + (custom-face-value-create, custom-face-state-set): Use them. + + * cus-theme.el (custom-theme--listed-faces): New var. + (customize-create-theme): Use *Custom Theme* as the buffer name. + Set revert-buffer-function. Optional arg BUFFER. Insert all + faces listed in custom-theme--listed-faces. + (custom-theme-revert): New function. + (custom-theme-add-variable, custom-theme-add-face): Insert at the + bottom of the list. + (custom-theme-write): Prompt for theme name if empty. + (custom-theme-write-variables): Use dolist. + (custom-theme-write-faces): Handle hidden (collapsed) widgets. + +2010-10-09 Alan Mackenzie + + Enhance fontification of declarators to take account of the + presence/absence of "typedef". + + * cc-engine.el (c-forward-type): New &optional param + "brace-block-too". + (c-forward-decl-or-cast-1): cdr of return value now indicates the + presence of either or both of a "struct"-like keyword and "typedef". + + * cc-fonts.el (c-complex-decl-matchers): Remove the heuristic + fontification of declarators which follow a "}". + (c-font-lock-declarations): Fontify declarators according to the + presence/absence of "typedef". + + * cc-langs.el (c-typedef-kwds c-typedef-key): New lang variable + for "typedef". + (c-typedef-decl-key): New lang variable built from + c-typedef-decl-kwds. + +2010-10-09 Lars Magne Ingebrigtsen + + * ibuffer.el (ibuffer-mode-map): Don't redefine the cursor keys, + since that's too annoying. Move the filter groups commands to + TAB/backtab. + + * epa.el (epa-passphrase-callback-function): Say what we're + querying the password for. + + * ibuffer.el (ibuffer-visit-buffer): To mimick list-buffers + behaviour, don't bury the ibuffer buffer when visiting other buffers. + +2010-10-08 Chong Yidong + + * cus-edit.el (custom-commands, custom-buffer-create-internal) + (custom-magic-value-create): Pad button tags with spaces. + (custom-face-edit): New variable. + (custom-face-value-create): Determine whether to use the usual + face editor here, instead of using custom-face-selected. + Pass face defaults to custom-face-edit widget. + (custom-face-selected, custom-display-unselected): Delete widgets. + (custom-display-unselected-match): Function removed. + (custom-face-set, custom-face-mark-to-save): + Accept custom-face-edit widgets as the direct widget child. + + * wid-edit.el (widget--completing-widget): New var. + (widget-default-complete): Bind it when doing completion. + (widget-string-complete, widget-file-complete): Use it. + +2010-10-09 Glenn Morris + + * calendar/cal-hebrew.el (holiday-hebrew-rosh-hashanah) + (holiday-hebrew-passover, holiday-hebrew-tisha-b-av) + (holiday-hebrew-misc): Small simplifications. + + * emacs-lisp/authors.el (authors-valid-file-names): Add b2m.c. + + * net/browse-url.el: Don't require thingatpt, term, dired, + executable, or w3-auto when compiling. + (dired-get-filename, term-char-mode, term-send-down, term-send-string): + Declare. + (browse-url-text-emacs): Require term. + +2010-10-08 Andreas Schwab + + * net/browse-url.el (browse-url-xdg-open): Remove use of /bin/sh. + +2010-10-08 Glenn Morris + + * emacs-lisp/cl-compat.el, emacs-lisp/lmenu.el: Move to obsolete/. + + * emacs-lisp/shadow.el (lisp-shadow): Change prefix. + (shadows-compare-text-p): Make it an obsolete alias for... + (load-path-shadows-compare-text): ... new name. + (find-emacs-lisp-shadows): Update for above name change. + (load-path-shadows-same-file-or-nonexistent): New name for the old + shadow-same-file-or-nonexistent. + +2010-10-08 Chong Yidong + + * minibuffer.el (completion--some, completion--do-completion) + (minibuffer-complete-and-exit, minibuffer-completion-help) + (completion-basic-try-completion) + (completion-basic-all-completions) + (completion-pcm--find-all-completions): Use lexical-let to + avoid some false matches in variable completion (Bug#7056) + +2010-10-08 Olof Ohlsson Sax (tiny change) + + * vc-svn.el (vc-svn-merge-news): Use --non-interactive. (Bug#7152) + +2010-10-08 Leo + + * dnd.el (dnd-get-local-file-name): If MUST-EXIST is non-nil, only + return non-nil if the file exists (Bug#7090). + +2010-10-08 Stefan Monnier + + * minibuffer.el (completion--replace): + Better preserve markers (bug#7138). + +2010-10-08 Juanma Barranquero + + * server.el (server-process-filter): Doc fix. + +2010-10-08 Drew Adams + + * dired.el (dired-save-positions): Doc fix. (Bug#7119) + +2010-10-08 Glenn Morris + + * vc/ediff-wind.el (ediff-setup-control-frame): + * vc/ediff-ptch.el (ediff-default-backup-extension): + * vc/ediff-diff.el (ediff-shell, ediff-diff-options) + (ediff-exec-process): Remove system-types emx, windows-95. + + * net/browse-url.el (browse-url-xdg-open): Shell-quote url. (Bug#7166) + +2010-10-07 Chong Yidong + + * cus-edit.el (custom-variable, custom-face): Doc fix. + (custom-face-edit): Add value-create attribute. + (custom-face-edit-value-create) + (custom-face-edit-value-visibility-action): New functions. + Hide unused face attributes by default, and add a visibility toggle. + (custom-face-edit-deactivate): Show empty values with shadow face. + (custom-face-selected): Only use this for face specs with default + attributes. + (custom-face-value-create): Cleanup. + + * wid-edit.el (widget-checklist-value-create): Use dolist. + (widget-checklist-match-find): Make second arg optional. + +2010-10-07 Glenn Morris + + * hilit-chg.el (hilit-chg-get-diff-info, hilit-chg-get-diff-list-hk): + Prefix things. + + * emacs-lisp/shadow.el (shadow-font-lock-keywords) + (load-path-shadows-mode, list-load-path-shadows): Rename shadow-mode to + load-path-shadows-mode, update references. + (load-path-shadows-font-lock-keywords, load-path-shadows-find-file): + Rename variable and button. + (list-load-path-shadows): Update button caller. + +2010-10-07 Stefan Monnier + + * emacs-lisp/smie.el (smie-bnf-classify): New function. + (smie-bnf-precedence-table): Use it to remember the closers/openers. + (smie-merge-prec2s): Handle those new entries. + (smie-prec2-levels): Only set precedence to nil for actual + openers/closers. + * progmodes/octave-mod.el (octave-smie-op-levels): Remove dummy entry + that is now unnecessary. + +2010-10-07 Miles Bader + + * emacs-lisp/regexp-opt.el (regexp-opt): Add `symbols' mode. + +2010-10-07 Glenn Morris + + * mail/rmail.el (mail-sendmail-delimit-header, mail-header-end) + (mail-position-on-field): Remove declarations. + (mail-position-on-field): Autoload it. + (rmail-retry-failure): Replace use of mail-sendmail-delimit-header + and mail-header-end. Don't require sendmail. + + * emacs-lisp/shadow.el (shadow-font-lock-keywords): New variable. + (shadow-mode): New mode. + (shadow-find-file): New button. + (list-load-path-shadows): Use shadow-mode and buttons. + + * iimage.el (iimage-version): Remove. + (iimage-mode-image-search-path, iimage-mode-image-regex-alist): + Turn into defcustoms. + (iimage-mode-map): Give it a doc string. + + * calendar/appt.el (appt-activate): Give a warning rather than an error + if there is no diary-file. + +2010-10-06 Michael Albinus + + * net/tramp-sh.el (tramp-sh-file-name-handler-alist): + Use `tramp-handle-find-backup-file-name'. + +2010-10-06 Glenn Morris + + * font-core.el (font-lock-defaults-alist): Remove variable. + (font-lock-mode): Doc fix. + (font-lock-default-function): Do not consult font-lock-defaults-alist. + * font-lock.el (font-lock-refresh-defaults): Doc fix. + (font-lock-set-defaults): Doc fix. + Do not consult font-lock-defaults-alist. + + * hilit-chg.el (hilit-chg-get-diff-list-hk): Declare `e' for compiler. + + * emacs-lisp/cl.el: No longer provide cl-19. + +2010-10-05 Michael Albinus + + * net/tramp.el (tramp-handle-directory-files-and-attributes) + (tramp-handle-file-exists-p, tramp-handle-file-newer-than-file-p): + New defuns, taken from tramp-smb.el. + (tramp-coding-system-change-eol-conversion) + (tramp-set-process-query-on-exit-flag): Remove. + + * net/tramp-compat.el (top): Do not check for byte-compiler objects. + (tramp-compat-coding-system-change-eol-conversion) + (tramp-compat-set-process-query-on-exit-flag): New defuns, taken + from tramp.el. + + * net/tramp-gvfs.el: + * net/tramp-gw.el: Replace `tramp-set-process-query-on-exit-flag' + by `tramp-compat-set-process-query-on-exit-flag'. + + * net/tramp-imap.el (tramp-imap-file-name-handler-alist): + Use `tramp-handle-directory-files-and-attributes', + `tramp-handle-file-exists-p' and + `tramp-handle-file-newer-than-file-p'. + (tramp-imap-handle-file-exists-p) + (tramp-imap-handle-file-executable-p) + (tramp-imap-handle-file-readable-p) + (tramp-imap-handle-directory-files-and-attributes) + (tramp-imap-handle-file-newer-than-file-p): Remove. + + * net/tramp-sh.el: Replace `tramp-set-process-query-on-exit-flag' + by `tramp-compat-set-process-query-on-exit-flag' and + `tramp-coding-system-change-eol-conversion' by + `tramp-compat-coding-system-change-eol-conversion'. + + * net/tramp-smb.el (tramp-smb-file-name-handler-alist): + Use `tramp-handle-directory-files-and-attributes', + `tramp-handle-file-exists-p' and + `tramp-handle-file-newer-than-file-p'. + (tramp-smb-handle-directory-files-and-attributes) + (tramp-smb-handle-file-exists-p) + (tramp-smb-handle-file-newer-than-file-p): Remove. + (tramp-smb-maybe-open-connection): + Replace `tramp-set-process-query-on-exit-flag' by + `tramp-compat-set-process-query-on-exit-flag'. + +2010-10-05 Glenn Morris + + * obsolete/rnews.el, obsolete/rnewspost.el: Remove files. + +2010-10-04 Michael Albinus + + Continue reorganization of load dependencies. (Bug#7156) + + * net/tramp.el (tramp-handle-file-local-copy-hook) + (tramp-delete-temp-file-function): Move down. + (tramp-exists-file-name-handler): Move up. + (tramp-register-file-name-handlers): Simplify autoload. + (tramp-handle-write-region-hook, tramp-handle-directory-file-name) + (tramp-handle-directory-files, tramp-handle-dired-uncache) + (tramp-handle-file-modes, tramp-handle-file-name-as-directory) + (tramp-handle-file-name-completion) + (tramp-handle-file-name-directory) + (tramp-handle-file-name-nondirectory, tramp-handle-file-regular-p) + (tramp-handle-file-remote-p, tramp-handle-file-symlink-p) + (tramp-handle-find-backup-file-name) + (tramp-handle-insert-file-contents, tramp-handle-load) + (tramp-handle-substitute-in-file-name) + (tramp-handle-unhandled-file-name-directory) + (tramp-mode-string-to-int, tramp-local-host-p) + (tramp-make-tramp-temp-file): Move from tramp-sh.el. + + * net/tramp-gvfs.el (top): + * net/tramp-smb.el (top): Do not require 'tramp-sh. + + * net/tramp-sh.el (all): Move several objects to tramp.el, see + there. Rename `tramp-handle-*' to `tramp-sh-handle-*'. + +2010-10-04 Glenn Morris + + * calendar/appt.el (appt-add): Ensure reminders are enabled. + (appt-activate): Give status messages. + +2010-10-03 Teodor Zlatanov + + * net/gnutls.el: Improve docs. Remove starttls and ssl emulation. + Provide only `open-gnutls-stream' (formerly `open-ssl-stream') and + `gnutls-negotiate' (formerly `starttls-negotiate'). + Remove trivial wrapper `starttls-open-stream'. + +2010-10-03 Dan Nicolaescu + + Make 'g' (AKA revert-buffer) rerun the VC log, log-incoming and + log-outgoing commands. + * vc/vc.el (vc-log-internal-common): Add a new argument and use it + to create a buffer local revert-buffer-function variable. + (vc-print-log-internal, vc-log-incoming, vc-log-outgoing): Pass a + revert-buffer-function lambda. + +2010-10-03 Teodor Zlatanov + + * net/gnutls.el (starttls-negotiate): Use the plist interface to + `gnutls-boot'. Make TYPE the only required parameter. + Allow TRUSTFILES and KEYFILES to be lists. + (open-ssl-stream): Use it. + +2010-10-03 Glenn Morris + + * subr.el (directory-sep-char): Remove obsolete variable. + * net/tramp-compat.el: Don't mess about with the byte-compiler unless + it is "necessary". + + * vc/vc-hooks.el (vc-header-alist): Remove obsolete variable. + * vc/vc.el (vc-static-header-alist): Doc fix. + * vc/vc-cvs.el (vc-cvs-header): + * vc/vc-rcs.el (vc-rcs-header): + * vc/vc-sccs.el (vc-sccs-header): + * vc/vc-svn.el (vc-svn-header): Do not consult vc-header-alist. + * obsolete/vc-mcvs.el (vc-mcvs-header): + * progmodes/cperl-mode.el (cperl-mode): Only set vc-header-alist + on XEmacs. + +2010-10-03 Chong Yidong + + * emacs-lisp/bytecomp.el (byte-compile-from-buffer): + Remove obsolete use of binary-overwrite-mode (Bug#7001). + +2010-10-03 Glenn Morris + + * obsolete/x-menu.el: Remove file, obsolete since 21.1 + + * textmodes/rst.el (rst-font-lock-keywords-function): + Drop Emacs 20 code. + + * textmodes/artist.el (artist-replace-char): Drop Emacs 20 code. + + * printing.el: Drop Emacs 20 code. + + * calendar/appt.el (appt-delete): Don't autoload it (you can't use it + without having used appt.el already). + + * subr.el (make-local-hook): Remove function obsolete since 21.1. + * progmodes/cc-mode.el (make-local-hook): Don't do cc-bytecomp stuff. + (c-basic-common-init, c-font-lock-init): Only call make-local-hook on + XEmacs. + * progmodes/cc-styles.el (make-local-hook): Don't do cc-bytecomp stuff. + (c-make-styles-buffer-local): Only call make-local-hook on XEmacs. + + * ps-def.el (leading-code-private-22, charset-bytes, charset-id) + (charset-width, find-charset-region, chars-in-region, forward-point) + (encode-coding-string, coding-system-p, ccl-execute-on-string) + (define-ccl-program, multibyte-string-p, string-make-multibyte): + Remove compatibility cruft (none of these are used by ps*.el). + +2010-10-03 Kevin Rodgers + + * subr.el (booleanp): Return t instead of a list (Bug#7086). + +2010-10-03 Chong Yidong + + * server.el (server-process-filter, server-return-error): + Give emacsclient time to shut down after receiving an error string. + +2010-10-02 Michael Albinus + + * files.el (remote-file-name-inhibit-cache): New defcustom. + + * time.el (display-time-file-nonempty-p): + Use `remote-file-name-inhibit-cache'. + + * net/tramp.el (tramp-completion-reread-directory-timeout): + Fix docstring. + + * net/tramp-cache.el (tramp-cache-inhibit-cache): Remove. + (tramp-get-file-property): Replace `tramp-cache-inhibit-cache' by + `remote-file-name-inhibit-cache'. Check also for an integer + value. Add/increase counter when `tramp-verbose' >= 10. + (tramp-set-file-property): Add/increase counter when + `tramp-verbose' >= 10. + + * net/tramp-cmds.el (tramp-cleanup-all-connections) + (tramp-cleanup-all-buffers): Set tramp-autoload cookie. + (tramp-bug): Set tramp-autoload cookie. Report all interned + tramp-* variables. Report also `remote-file-name-inhibit-cache'. + (tramp-reporter-dump-variable): Fix docstring. Mask non-7bit + characters only in strings. + + * net/tramp-compat.el (remote-file-name-inhibit-cache): Define due + to backward compatibility. + + * net/tramp-sh.el (tramp-handle-verify-visited-file-modtime) + (tramp-handle-file-name-all-completions) + (tramp-handle-vc-registered): Use `remote-file-name-inhibit-cache'. + (tramp-open-connection-setup-interactive-shell): + Call `tramp-cleanup-connection' directly. + +2010-10-02 Glenn Morris + + * emacs-lisp/checkdoc.el (checkdoc-minor-keymap): Remove obsolete alias. + + * subr.el (char-bytes): Remove obsolete function. + + * isearch.el (isearch-return-char): Remove obsolete function. + + * mouse.el: No longer provide mldrag. + (mldrag-drag-mode-line, mldrag-drag-vertical-line): + Remove obsolete aliases. + + * comint.el (comint-kill-output): Remove obsolete alias. + + * composite.el (decompose-composite-char): Remove obsolete function. + * ps-def.el (decompose-composite-char): Remove unused function. + + * iswitchb.el (iswitchb-default-keybindings): Remove obsolete function. + + * outline.el (outline-visible): Remove obsolete function. + + * term/pc-win.el (x-frob-font-slant, x-frob-font-weight): + * faces.el (internal-find-face, internal-get-face) + (frame-update-faces, frame-update-face-colors) + (x-frob-font-weight, x-frob-font-slant) + (internal-frob-font-weight, internal-frob-font-slant) + (x-make-font-bold, x-make-font-demibold, x-make-font-unbold) + (x-make-font-italic, x-make-font-oblique, x-make-font-unitalic) + (x-make-font-bold-italic): Remove functions and aliases, obsolete + since Emacs 21.1. + * emulation/viper-util.el (viper-get-face): + * obsolete/lucid.el (find-face, get-face): Use facep. + * vc/ediff-init.el (ediff-valid-color-p, ediff-get-face): + Remove unused functions. + * vc/ediff-util.el (ediff-submit-report): Doc fix. + + * emacs-lisp/bytecomp.el (byte-compile-file): Use kill-emacs-hook to + delete tempfile if interrupted during compilation. + +2010-10-01 Lars Magne Ingebrigtsen + + * net/tls.el (tls-starttls-switches): Give up on using starttls with + gnutls-cli. + (tls-program): Add --insecure to be consistent with the defaults from + openssl s_client. Now all three commands are insecure. + +2010-10-01 Eli Zaretskii + + * makefile.w32-in (DEST, TAGS, TAGS-LISP, TAGS-nmake) + (TAGS-LISP-nmake, TAGS-gmake, TAGS-LISP-gmake, TAGS-SH) + (TAGS-LISP-SH, TAGS-CMD, TAGS-LISP-CMD): New targets. + +2010-10-01 Glenn Morris + + * obsolete/sc.el: Remove file. + + * files.el (temporary-file-directory): On darwin, also try + DARWIN_USER_TEMP_DIR (see discussion in bug#7135). + +2010-10-01 Juanma Barranquero + + * server.el (server-start): Revert part of 2010-09-30T02:53:26Z!lekktu@gmail.com. + Let's not break compatibility gratuitously, shall we? + +2010-09-30 Lars Magne Ingebrigtsen + + * net/tls.el (tls-starttls-switches): New variable. + (tls-find-starttls-argument): Use it. + (open-tls-stream): Ditto. + + * net/netrc.el (netrc-credentials): Return the value of the "default" + entry. + (netrc-machine): Ditto. + +2010-09-30 Eli Zaretskii + + * vc/vc-hooks.el (vc-default-mode-line-string): Doc fix. + +2010-09-30 Juanma Barranquero + + * server.el (server-start): Don't write pid to the authentication file. + (server-create-tty-frame): Don't send pid. + (server-process-filter): Send pid at the start of every connection. + +2010-09-30 Glenn Morris + + * calendar/diary-lib.el (view-diary-entries, list-diary-entries) + (show-all-diary-entries): Remove obsolete function aliases. + + * calendar/appt.el (appt-issue-message, appt-visible, appt-msg-window): + Remove options, obsolete since 22.1. + (appt-display-format, appt-display-message): + Remove backwards-compatibility code. + (appt-check): No longer check appt-issue-message. + (appt-make-list): No longer autoload it. Doc fix. No longer + activate the package. + +2010-09-29 Lars Magne Ingebrigtsen + + * net/gnutls.el (starttls-negotiate): Loop a lot longer. + (starttls-negotiate): Just call boot, and let the handshake be + triggered from the read loop. + +2010-09-29 Glenn Morris + + * calendar/diary-lib.el (diary-list-entries): Use temp buffers when + not displaying the diary. + (diary-add-to-list): If no buffer-file-name, fall back to diary-file. + * calendar/appt.el (appt-check): No longer need to kill diary. + + * calendar/diary-lib.el (diary-list-entries): Move the + "Preparing..." message entirely here. + (diary-simple-display, diary-fancy-display): Move "Preparing..." + messages to diary-list-entries. + (diary-include-other-diary-files): Use LIST-ONLY rather than setting + diary-display-function. + + * calendar/diary-lib.el (diary-include-other-diary-files): + Trap some recursive includes. + + * calendar/appt.el (appt-activate): Check diary file. + +2010-09-29 Katsumi Yamaoka + + * pgg.el (pgg-run-at-time-1): Define it for XEmacs only; fix if/else + construction. + + * calendar/time-date.el: No need to require cl for Emacs 21. + +2010-09-28 Glenn Morris + + * calendar/appt.el (appt-check): Minor simplification. + +2010-09-28 Katsumi Yamaoka + + * mail/sendmail.el (mail-citation-prefix-regexp): Remove "}" from + citation prefix. + +2010-09-27 Andreas Schwab + + * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): + Avoid infinite recursion on erroneous lambda form. (Bug#7114) + +2010-09-27 Kenichi Handa + + * tar-mode.el (tar-header-block-tokenize): Decode filenames in + "ustar" format. + +2010-09-27 Kenichi Handa + + * international/mule.el (define-coding-system): Docstring fixed. + + * international/mule-diag.el (describe-character-set): Use princ + with proper print-length and print-level instead of insert. + +2010-09-27 Juanma Barranquero + + * window.el (walk-windows): Doc fix (bug#7105). + +2010-09-27 Stefan Monnier + + * emacs-lisp/float-sup.el (e): Remove. + +2010-09-27 Teodor Zlatanov + + * net/gnutls.el (gnutls, gnutls-log-level): Add group and custom + variable. + (starttls-negotiate): Use it. + +2010-09-27 Lars Magne Ingebrigtsen + + * net/gnutls.el (starttls-negotiate): Stop looping when we get a t + back. + +2010-09-26 Stefan Monnier + + * emacs-lisp/pcase.el (pcase-let*, pcase-let): plet -> pcase-let. + +2010-09-26 Lars Magne Ingebrigtsen + + * net/gnutls.el (starttls-negotiate): Avoid the cl.el decf function. + + * net/netrc.el (netrc-store-data): New function. + +2010-09-26 Teodor Zlatanov + + * net/gnutls.el: GnuTLS glue code to set up a connection. + +2010-09-25 Julien Danjou + + * notifications.el: Call dbus-register-signal only if it is bound. + +2010-09-25 Glenn Morris + + * eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el: + * eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el: + * eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el: + * eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el: + * eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el: + * eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el: + * eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el: + * eshell/esh-util.el, eshell/esh-var.el: + Remove leading `*' from docs of faces and defcustoms. + +2010-09-25 Ulrich Mueller + + * eshell/em-ls.el (eshell-ls-archive-regexp): + * eshell/esh-util.el (eshell-tar-regexp): + * ibuffer.el (ibuffer-compressed-file-name-regexp): + * info.el (Info-suffix-list): + * international/mule.el (auto-coding-alist): + * woman.el (woman-file-regexp, woman-file-compression-regexp): + * progmodes/etags.el (tags-compression-info-list): + Support xz compression. + +2010-09-25 Chong Yidong + + * files.el (get-free-disk-space): Don't assume the "df" output + columns line up (Bug#6995). + +2010-09-25 Juanma Barranquero + + * finder.el (finder-unknown-keywords): + * progmodes/gdb-mi.el (gdb-jsonify-buffer, gdb-running-threads-count): + * progmodes/etags.el (tags-table-including): Fix typos in docstrings. + +2010-09-25 Juanma Barranquero + + * server.el (server-start): Revert part of 2010-08-08 change. Using + address 127.0.0.1 for local host is now done in Fmake_network_process. + +2010-09-24 Glenn Morris + + * image-mode.el, progmodes/compile.el, progmodes/gud.el: + * progmodes/mixal-mode.el, textmodes/bibtex-style.el: + * textmodes/css-mode.el, textmodes/dns-mode.el: + Move autoloaded auto-mode-alist entries to files.el. + * files.el (auto-mode-alist): Move entries here. + +2010-09-23 Glenn Morris + + * isearch.el (isearch-lazy-highlight-cleanup) + (isearch-lazy-highlight-initial-delay) + (isearch-lazy-highlight-interval) + (isearch-lazy-highlight-max-at-a-time, isearch-lazy-highlight-face): + * net/net-utils.el (ipconfig-program-options): + Move aliases to options before the associated definitions. + +2010-09-23 Stefan Monnier + + * newcomment.el (comment-normalize-vars): Better test validity of + comment-end-skip. + +2010-09-23 Stefan Monnier + + * emacs-lisp/float-sup.el (float-pi): New name for `pi'. + (float-e): New name for `e'. + (degrees-to-radians, radians-to-degrees): + * calendar/solar.el (solar-longitude): + * calculator.el (calculator-registers, calculator-funcall): + * textmodes/artist.el (artist-spray-random-points): + * play/bubbles.el (bubbles--initialize-images): Use new names. + +2010-09-23 Eric M. Ludlam + + Update to CEDET 1.0's version of EIEIO. + + * emacs-lisp/eieio.el (eieio-specialized-key-to-generic-key): + New function. + (eieio-defmethod, eieio-generic-form, eieio-generic-call): Use it. + (eieio-default-eval-maybe): Eval val instead of unquoting only. + (class-precedence-list): If class is nil, return nil. + (eieio-generic-call): If class of first input arg is nil, don't + look up static methods, and do check for primary methods. + (initialize-instance): See if the default needs to be evaluated + during the constructor. + (eieio-perform-slot-validation-for-default): Don't do the check + for values that will eventually be evaluated. + (eieio-eval-default-p): New function. + (eieio-default-eval-maybe): Use it. + +2010-09-23 Jan Moringen + + * emacs-lisp/eieio.el (eieio-defclass): Allow :c3 + method-invocation-order. + (eieio-c3-candidate, eieio-c3-merge-lists): New functions. + (eieio-class-precedence-dfs): Compute class precedence list using + dfs algorithm. + (eieio-class-precedence-bfs): Compute class precedence list using + bfs algorithm. + (eieio-class-precedence-c3): Compute class precedence list using + c3 algorithm. + (class-precedence-list): New function. + (eieiomt-method-list, eieiomt-sym-optimize): Use it. + (inconsistent-class-hierarchy): New error symbol. + (call-next-method): Stow the replacement argument list for future + call-next-method invocations. + +2010-09-23 Glenn Morris + + * calendar/appt.el (appt-check): If not displaying the diary, + use (diary 1) to only get the entries we need. + (appt-make-list): Sort diary-list-entries, if we cannot guarantee + that it is in day order. (Bug#7019) + + * calendar/appt.el (appt-check): Rather than showing the diary, + just turn off invisible display, and only if needed. + + * calendar/diary-lib.el (diary-list-entries): Doc fix. (Bug#7019) + +2010-09-23 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-file-form-defvar): + (byte-compile-defvar, byte-compile-cl-warn): + Start warnings with lower-case, like the majority. + + * files.el (auto-mode-alist): Add .xa, .xw, .xsw for ld-script-mode. + + * files.el (auto-mode-alist): Prefer C-mode for .xs. (Bug#7071) + + * progmodes/ld-script.el (auto-mode-alist): Move to files.el. + * files.el (auto-mode-alist): Move ld-script entries here, further down + the list. + + * vc/add-log.el: Don't require timezone when compiling. + (timezone-make-date-sortable): Autoload it. + (change-log-sortable-date-at): Don't require timezone. + Use `ignore-errors'. + + * comint.el (comint-use-prompt-regexp-instead-of-fields): + Move alias before definition, so it does not need autoloading. + + * emulation/crisp.el, emulation/cua-base.el, emulation/edt.el: + * emulation/pc-select.el, emulation/vip.el, international/iso-ascii.el: + * international/kkc.el, international/ogonek.el, mail/feedmail.el: + * net/browse-url.el, net/eudc-vars.el, net/net-utils.el: + * net/rcompile.el, net/rlogin.el, textmodes/enriched.el: + * textmodes/makeinfo.el, textmodes/page-ext.el, textmodes/picture.el: + * textmodes/refer.el, textmodes/spell.el, textmodes/table.el: + * textmodes/tex-mode.el, textmodes/two-column.el: + Remove leading `*' from docs of defcustoms etc. + +2010-09-23 Teodor Zlatanov + + * net/netrc.el (netrc-parse): Remove encrypt.el mentions. + +2010-09-22 Dan Christensen + + * calendar/time-date.el (date-to-time): Try using parse-time-string + first before using the slower timezone-make-date-arpa-standard. + +2010-09-22 Katsumi Yamaoka + + * calendar/time-date.el (format-seconds): Comment fix. + +2010-09-22 Glenn Morris + + * emacs-lisp/package.el (package-menu-mode): `revert-buffer-function' + is not automatically buffer-local. + +2010-09-21 Stefan Monnier + + * emacs-lisp/smie.el (smie-debug--describe-cycle): Fix typo. + (smie-indent-comment): Be more careful with comment-start-skip. + (smie-indent-comment-close, smie-indent-comment-inside): New funs. + (smie-indent-functions): Use them. + +2010-09-21 Michael Albinus + + * net/ange-ftp.el (ange-ftp-skip-msgs): Add "^504 ..." message. + +2010-09-21 Jan Djärv + + * menu-bar.el (menu-bar-set-tool-bar-position): customize-set-variable + tool-bar-position. Don't modify frame parameters here. + (menu-bar-options-save): Add tool-bar-position. + + * tool-bar.el (tool-bar-position): New defcustom (Bug#7049). + +2010-09-20 Stefan Monnier + + * textmodes/reftex-parse.el (reftex-what-macro) + (reftex-context-substring): Let-bind forward-sexp-function to nil + since we don't need/want to treat \begin...\end as a block (bug#7053). + + * emacs-lisp/lisp.el (up-list): Don't do nothing silently. + + * simple.el (blink-matching-open): Use syntax-class. + + * progmodes/pascal.el (pascal-mode): Use define-derived-mode. + Set invisibility spec for pascal's outline mode. + (pascal-outline-change): Clean up calling convention. + (pascal-show-all, pascal-hide-other-defuns): Update callers. + + * progmodes/prolog.el (prolog-smie-forward-token) + (prolog-smie-backward-token): New functions. + (prolog-mode-variables): Use them to parse "!," correctly. + Set up smie-blink-matching for ".". + + * textmodes/ispell.el (ispell-start, ispell-end): Rename from `start' + and `end'. + (ispell-region, ispell-process-line): Update users. + + * textmodes/reftex-parse.el (reftex-what-macro): Don't hardcode + point-min==1. + + * textmodes/ispell.el: Fix commenting convention. + (ispell-parse-output): Simplify, use push. + (ispell-region): Use match-string-no-properties. + (ispell-begin-skip-region-regexp): Use mapconcat to simplify. + (ispell-minor-mode): Use define-minor-mode. + (ispell-message): Remove unused var `skip-regexp'. + (ispell-add-per-file-word-list): Use dynamic let-binding. + Try and use the proper comment marker. + + * mail/sendmail.el: Fix commenting convention. + (sendmail-send-it): Use line-beginning-position. + + * help-fns.el (describe-variable): Add original value, if applicable. + +2010-09-20 Juanma Barranquero + + * subr.el (y-or-n-p): Remove leftover code from 2010-09-17T13:30:30Z!monnier@iro.umontreal.ca. + + * emacs-lisp/smie.el (smie-indent--hanging-p): Use `smie-indent--bolp'. + +2010-09-19 Stefan Monnier + + * emacs-lisp/smie.el (smie-bnf-precedence-table): Improve error message. + (smie-debug--prec2-cycle, smie-debug--describe-cycle): New functions. + (smie-prec2-levels): Use them to better diagnose precedence cycles. + (smie-blink-matching-check): Don't signal a mismatch if car is t. + (smie-blink-matching-open): Rewrite to remove assumptions, so that + something like "." can also be a closer. + (smie--associative-p, smie-indent--hanging-p, smie-indent--bolp) + (smie-indent--offset, smie-indent--offset-rule, smie-indent--column): + Rename internal functions to use "--". Update callers. + + * frame.el (make-frame-names-alist): Don't list frames on other displays. + + * fringe.el (fringe-styles): New var. + (fringe-mode, fringe-query-style): Use it. + +2010-09-18 Michael R. Mauger + + * progmodes/sql.el: Version 2.8 + (sql-login-params): Update widget structure; changes still needed. + (sql-product-alist): Add :list-all and :list-table features for + SQLite, Postgres and MySQL products. + (sql-redirect): Handle default value. + (sql-execute, sql-execute-feature): New functions. + (sql-read-table-name): New function. + (sql-list-all, sql-list-table): New functions. User API. + (sql-mode-map, sql-interactive-mode-map): Add key definitions + for above functions. + (sql-mode-menu, sql-interactive-mode-menu): Add menu definitions + for above functions. + (sql-postgres-login-params): Add user and database defaults. + (sql-buffer-live-p): Bug fix. + (sql-product-history): New variable. + (sql-read-product): New function. Use it. + (sql-set-product, sql-product-interactive): Use it. + (sql-connection-history): New variable. + (sql-read-connection): New function. Use it. + (sql-connect): New function. + (sql-for-each-login): Redesign function interface. + (sql-make-alternate-buffer-name, sql-save-connection): Use it. + (sql-get-login-ext, sql-get-login): Use it. Handle default values. + (sql-comint): Check for program. Existing live buffer. + (sql-comint-postgres): Add port parameter. + +2010-09-19 Stefan Monnier + + * emacs-lisp/warnings.el: Fix commenting convention. + (display-warning): Use special mode and make the buffer read-only. + +2010-09-18 Jay Belanger + + * calc/calc-prog.el (calc-read-parse-table-part): Don't "fix" the + empty string when it follows a repeated or optional pattern. + +2010-09-18 Stefan Monnier + + * indent.el (indent-according-to-mode): Apply syntax-propertize. + (indent-region): Use indent-according-to-mode. + +2010-09-18 Eli Zaretskii + + * fringe.el (fringe-mode): Doc fix. + +2010-09-14 Kan-Ru Chen (tiny change) + + * textmodes/nroff-mode.el (nroff-view): Kill old buffer before + refreshing the preview buffer. + +2010-09-18 Stefan Monnier + + * textmodes/tex-mode.el (tex-syntax-propertize-rules) + (latex-syntax-propertize-rules): New consts; replace + tex-font-lock-syntactic-keywords. + (tex-env-mark, latex-env-before-change): New functions. + (latex-electric-env-pair-mode): New minor mode. + (tex-font-lock-verb): Change arguments; do move point. + (tex-font-lock-syntactic-face-function): Adjust to new verbatim + representation as a form of comment. + (tex-font-lock-keywords-1): Remove workaround, now unneeded. + (doctex-syntax-propertize-rules): New const; replaces + doctex-font-lock-syntactic-keywords. + (tex-common-initialization, doctex-mode): Use syntax-propertize-rules. + + * progmodes/fortran.el (fortran--font-lock-syntactic-keywords): Remove. + (fortran-make-syntax-propertize-function): New function; replaces + fortran-font-lock-syntactic-keywords. + (fortran-mode): Use it. + (fortran-line-length): Use it. Improve interactive spec. + + * emacs-lisp/syntax.el (syntax-propertize-precompile-rules): New macro. + (syntax-propertize-rules): Add var-ref case. Fix offset computation + when adding surrounding \(..\). + + * progmodes/js.el (js-mode): Fix last change (bug#7054). + +2010-09-17 Stefan Monnier + + * obsolete/old-whitespace.el (whitespace-rescan-files-in-buffers): + Use with-current-buffer. + + * isearch.el (isearch-face): Rename from `isearch'. + (isearch-highlight): Use new name. + +2010-09-17 Eli Zaretskii + + * fringe.el (fringe-mode, fringe-query-style): Use 4 pixels, not + 5, for `half' width fringes. (Bug#6933) + +2010-09-17 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compile-file-form-defvar) + (byte-compile-defvar): "foo/bar" does not lack a prefix. + + * subr.el (y-or-n-p): Add the "(y or n)" that was lost somehow. + +2010-09-17 Stephen Berman + + * dframe.el (dframe-reposition-frame-emacs): Use tool-bar-pixel-width + in calculating new frame position. Add more space between new and + parent on the left (Bug#7048). + +2010-09-17 Michael Albinus + + * net/tramp-compat.el (tramp-compat-with-temp-message): Make it a + defmacro. + +2010-09-16 Chong Yidong + + * mail/sendmail.el: Add "*unsent mail*" to same-window-buffer-names. + + * term/x-win.el (x-cut-buffer-or-selection-value): Define as + obsolete alias for x-selection-value. + + * ido.el (ido-make-buffer-list): Fix error in 2010-08-22 merge. + +2010-09-16 Michael Albinus + + * net/tramp-cmds.el (tramp-cleanup-connection): Set tramp-autoload + cookie. + +2010-09-15 Michael Albinus + + * net/tramp-compat.el (tramp-compat-with-temp-message) + (tramp-compat-font-lock-add-keywords, tramp-compat-process-get) + (tramp-compat-process-put): New defuns. + + * net/tramp.el (top): + * net/tramp-gvfs.el (top): + * net/tramp-cache.el (top): Use `tramp-compat-font-lock-add-keywords'. + + * net/tramp.el (tramp-progress-reporter-update): + Use `tramp-compat-funcall'. + + * net/tramp.el (tramp-process-actions): + * net/tramp-gvfs.el (tramp-handle-vc-registered): + * net/tramp-sh.el (tramp-gvfs-handler-askquestion) + (tramp-get-remote-stat, tramp-get-remote-readlink): + Use `tramp-compat-with-temp-message'. + + * net/tramp-sh.el (top): Require 'cl. + (tramp-handle-start-file-process): Use `tramp-compat-process-get'. + (tramp-open-connection-setup-interactive-shell): + Use `tramp-compat-process-put'. + +2010-09-15 Alan Mackenzie + + * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Correct the + indentation. + (c-forward-<>-arglist-recur): Fix an infinite recursion. + +2010-09-15 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compile-warning-types): New type + `lexical' for warnings related to lexical scoping. + (byte-compile-file-form-defvar, byte-compile-defvar): Warn about + global vars which don't have a prefix and could hence affect lexical + scoping in unrelated files. + +2010-09-14 Lars Magne Ingebrigtsen + + * net/imap.el: Revert back to version + cb950ed8ff3e0f40dac437a51b269166f9ffb60d, since some of the changes + seem problematic. + +2010-09-14 Juanma Barranquero + + * obsolete/old-whitespace.el (whitespace-unload-function): + Explicitly pass `obarray' to `unintern' to avoid a warning. + +2010-09-14 Stefan Monnier + + * emacs-lisp/byte-run.el (set-advertised-calling-convention): + Add `when' argument. Update callers. + + * subr.el (unintern): Declare the obarray arg mandatory. + +2010-09-14 Glenn Morris + + * calendar/diary-lib.el (diary-list-entries-hook, diary-sort-entries): + Doc fixes. + + * calendar/diary-lib.el (diary-included-files): New variable. + (diary-list-entries): Maybe initialize diary-included-files. + (diary-include-other-diary-files): Append to diary-included-files. + * calendar/appt.el (appt-update-list): Also check the members of + diary-included-files. (Bug#6999) + (appt-check): Doc fix. + +2010-09-14 David Reitter + + * simple.el (line-move-visual): Do not truncate goal column to + integer size. (Bug#7020) + +2010-09-14 Stefan Monnier + + * repeat.el (repeat): Allow repeating when the last event is a click. + Suggested by Drew Adams (bug#6256). + +2010-09-14 Sascha Wilde + + * vc/vc-hg.el (vc-hg-state,vc-hg-working-revision): + Replace setting HGRCPATH to "" by some less invasive --config options. + +2010-09-14 Stefan Monnier + + * font-lock.el (font-lock-beginning-of-syntax-function): + Mark as obsolete. + +2010-09-14 Glenn Morris + + * menu-bar.el (menu-bar-options-save): Fix handling of menu-bar + and tool-bar modes. (Bug#6211) + (menu-bar-mode): Move setting of standard-value after the + minor-mode definition, otherwise it seems to have no effect. + +2010-09-14 Masatake YAMATO + + * progmodes/antlr-mode.el (antlr-font-lock-additional-keywords): + Fix typo. (Bug#6976) + +2010-09-14 Vinicius Jose Latorre + + * whitespace.el: Allow cleaning up blanks without blank + visualization (Bug#6651). Adjust help window for + whitespace-toggle-options (Bug#6479). Allow to use fill-column + instead of whitespace-line-column (from EmacsWiki). New version 13.1. + (whitespace-style): Add new value 'face. Adjust docstring. + (whitespace-space, whitespace-hspace, whitespace-tab): + Adjust foreground property face. + (whitespace-line-column): Adjust docstring and type declaration. + (whitespace-style-value-list, whitespace-toggle-option-alist) + (whitespace-help-text): Adjust const initialization. + (whitespace-toggle-options, global-whitespace-toggle-options): + Adjust docstring. + (whitespace-display-window, whitespace-interactive-char) + (whitespace-style-face-p, whitespace-color-on): Adjust code. + (whitespace-help-scroll): New fun. + +2010-09-14 Katsumi Yamaoka + + * calendar/time-date.el (format-seconds): Comment fix. + +2010-09-13 Michael R. Mauger + + * progmodes/sql.el: Version 2.7. + (sql-buffer-live-p): Improve detection. + (sql-find-sqli-buffer, sql-set-sqli-buffer-generally) + (sql-set-sqli-buffer): Use it. + (sql-product-interactive): Run `sql-set-sqli-hook'. + (sql-rename-buffer): Code cleanup. + (sql-redirect, sql-redirect-value): New functions. More to come. + +2010-09-13 Juanma Barranquero + + Port tramp-related Makefile changes of 2010-09-08T14:42:54Z!michael.albinus@gmx.de, 2010-09-13T15:17:01Z!michael.albinus@gmx.de to Windows. + * makefile.w32-in (LOADDEFS): Add $(lisp)/net/tramp-loaddefs.el. + (TRAMP_SRC): New macro. + ($(lisp)/net/tramp-loaddefs.el): New target. + +2010-09-13 Michael Albinus + + Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el. + + * Makefile.in (TRAMP_SRC): Remove tramp-fish.el. Add tramp-sh.el. + + * net/tramp.el (top): Don't show loading message. Require just + 'tramp-compat, everything else is required there. + Use `ignore-errors' where appropriate. + (tramp-inline-compress-start-size, tramp-copy-size-limit) + (tramp-terminal-type, tramp-end-of-output) + (tramp-initial-end-of-output, tramp-completion-function-alist-rsh) + (tramp-completion-function-alist-ssh) + (tramp-completion-function-alist-telnet) + (tramp-completion-function-alist-su) + (tramp-completion-function-alist-putty, tramp-remote-path) + (tramp-remote-process-environment, tramp-sh-extra-args) + (tramp-actions-before-shell, tramp-uudecode) + (tramp-perl-file-truename, tramp-perl-file-name-all-completions) + (tramp-perl-file-attributes) + (tramp-perl-directory-files-and-attributes) + (tramp-perl-encode-with-module, tramp-perl-decode-with-module) + (tramp-perl-encode, tramp-perl-decode) + (tramp-vc-registered-read-file-names, tramp-file-mode-type-map) + (tramp-file-name-handler-alist, tramp-make-tramp-temp-file) + (tramp-handle-make-symbolic-link, tramp-handle-load) + (tramp-handle-file-name-as-directory) + (tramp-handle-file-name-directory) + (tramp-handle-file-name-nondirectory, tramp-handle-file-truename) + (tramp-handle-file-exists-p, tramp-handle-file-attributes) + (tramp-do-file-attributes-with-ls) + (tramp-do-file-attributes-with-perl) + (tramp-do-file-attributes-with-stat) + (tramp-handle-set-visited-file-modtime) + (tramp-handle-verify-visited-file-modtime) + (tramp-handle-set-file-modes, tramp-handle-set-file-times) + (tramp-set-file-uid-gid, tramp-remote-selinux-p) + (tramp-handle-file-selinux-context) + (tramp-handle-set-file-selinux-context) + (tramp-handle-file-executable-p, tramp-handle-file-readable-p) + (tramp-handle-file-newer-than-file-p, tramp-handle-file-modes) + (tramp-handle-file-directory-p, tramp-handle-file-regular-p) + (tramp-handle-file-symlink-p, tramp-handle-file-writable-p) + (tramp-handle-file-ownership-preserved-p) + (tramp-handle-directory-file-name, tramp-handle-directory-files) + (tramp-handle-directory-files-and-attributes) + (tramp-do-directory-files-and-attributes-with-perl) + (tramp-do-directory-files-and-attributes-with-stat) + (tramp-handle-file-name-all-completions) + (tramp-handle-file-name-completion, tramp-handle-add-name-to-file) + (tramp-handle-copy-file, tramp-handle-copy-directory) + (tramp-handle-rename-file, tramp-do-copy-or-rename-file) + (tramp-do-copy-or-rename-file-via-buffer) + (tramp-do-copy-or-rename-file-directly) + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-handle-make-directory, tramp-handle-delete-directory) + (tramp-handle-delete-file) + (tramp-handle-dired-recursive-delete-directory) + (tramp-handle-dired-compress-file, tramp-handle-dired-uncache) + (tramp-handle-insert-directory) + (tramp-handle-unhandled-file-name-directory) + (tramp-handle-expand-file-name) + (tramp-handle-substitute-in-file-name) + (tramp-handle-executable-find, tramp-process-sentinel) + (tramp-handle-start-file-process, tramp-handle-process-file) + (tramp-handle-call-process-region, tramp-handle-shell-command) + (tramp-handle-file-local-copy, tramp-handle-file-remote-p) + (tramp-handle-insert-file-contents) + (tramp-handle-insert-file-contents-literally) + (tramp-handle-find-backup-file-name) + (tramp-handle-make-auto-save-file-name, tramp-handle-write-region) + (tramp-vc-registered-file-names, tramp-handle-vc-registered) + (tramp-sh-file-name-handler, tramp-vc-file-name-handler) + (tramp-maybe-send-script, tramp-set-auto-save, tramp-run-test) + (tramp-run-test2, tramp-find-executable, tramp-set-remote-path) + (tramp-find-file-exists-command, tramp-open-shell) + (tramp-find-shell, tramp-barf-if-no-shell-prompt) + (tramp-open-connection-setup-interactive-shell) + (tramp-local-coding-commands, tramp-remote-coding-commands) + (tramp-find-inline-encoding, tramp-call-local-coding-command) + (tramp-inline-compress-commands, tramp-find-inline-compress) + (tramp-compute-multi-hops, tramp-maybe-open-connection) + (tramp-send-command, tramp-wait-for-output) + (tramp-send-command-and-check, tramp-barf-unless-okay) + (tramp-send-command-and-read, tramp-mode-string-to-int) + (tramp-convert-file-attributes, tramp-check-cached-permissions) + (tramp-file-mode-from-int, tramp-file-mode-permissions) + (tramp-shell-case-fold, tramp-make-copy-program-file-name) + (tramp-method-out-of-band-p, tramp-local-host-p) + (tramp-get-remote-path, tramp-get-remote-tmpdir) + (tramp-get-ls-command, tramp-get-ls-command-with-dired) + (tramp-get-test-command, tramp-get-test-nt-command) + (tramp-get-file-exists-command, tramp-get-remote-ln) + (tramp-get-remote-perl, tramp-get-remote-stat) + (tramp-get-remote-readlink, tramp-get-remote-trash) + (tramp-get-remote-id, tramp-get-remote-uid, tramp-get-remote-gid) + (tramp-get-local-uid, tramp-get-local-gid) + (tramp-get-inline-compress, tramp-get-inline-coding): Move to + tramp-sh.el. + (tramp-methods, tramp-default-method-alist) + (tramp-default-user-alist, tramp-foreign-file-name-handler-alist): + Move initialization to tramp-sh.el. + (tramp-temp-name-prefix): Make it a defconst. + (tramp-dissect-file-name): Don't check anymore for multi-hop + methods. + (tramp-debug-outline-regexp): Add a docstring. + (tramp-debug-outline-level): Rename from `tramp-outline-level'. + (tramp-get-debug-buffer): Use it. + + * net/tramp-cache.el (top): Set tramp-autoload cookie for + initialization forms. + (tramp-set-connection-property): Don't protect `tramp-message' + call, it isn't necessary any longer. + (tramp-dump-connection-properties): Use `ignore-errors'. + + * net/tramp-compat.el (top): Require 'advice, 'format-spec, + 'password-cache and 'auth-source. + + * net/tramp-gvfs.el (top): + * net/tramp-smb.el (top): Require 'tramp-sh. + + * net/tramp-gw.el (tramp-gw-open-network-stream): Use `ignore-errors'. + + * net/tramp-sh.el: New file, derived from tramp.el. + (top): Initialize `tramp-methods', `tramp-default-method-alist', + `tramp-default-user-alist', `tramp-foreign-file-name-handler-alist'. + Remove "scp1_old", "scp2_old", "ssh1_old", "ssh2_old". + Use `ignore-errors' where appropriate. + (tramp-sh-file-name-handler-alist): Rename from + `tramp-file-name-handler-alist'. + (tramp-send-command-and-check): Return t or nil. Remove all + `zerop' checks, where called. + (tramp-handle-set-file-modes) + (tramp-do-copy-or-rename-file-directly) + (tramp-handle-delete-directory, tramp-handle-delete-file) + (tramp-maybe-send-script): Use `tramp-barf-unless-okay'. + (tramp-sh-file-name-handler, tramp-send-command-and-check) + (tramp-get-remote-ln): Set tramp-autoload cookie. + + * net/tramp-fish.el: Remove file. + +2010-09-13 Daiki Ueno + + * epa-file.el (epa-file-insert-file-contents): If visiting, bind + buffer-file-name to avoid file-locking. (Bug#7026) + +2010-09-13 Julien Danjou + + * notifications.el (notifications-notify): Add support for + image-path and sound-name. + (notifications-specification-version): Add this variable. + +2010-09-12 Stefan Monnier + + * subr.el (y-or-n-p): New function, moved from src/fns.c; use read-key. + +2010-09-12 Leo + + * net/rcirc.el (rcirc-server-commands, rcirc-client-commands) + (rcirc-completion-start): New variables. + (rcirc-nick-completions): Rename to rcirc-completions. + (rcirc-nick-completion-start-offset): Delete. + (rcirc-completion-at-point): New function for constructing + completion data for both nicks and irc commands. Add to + completion-at-point-functions in rcirc mode. + (rcirc-complete): Rename from rcirc-nick-complete; use + rcirc-completion-at-point. + (defun-rcirc-command): Update rcirc-client-commands. + +2010-09-11 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-file): Create .elc files + atomically, to avoid parallel build errors. (Bug#4196) + +2010-09-11 Michael R. Mauger + + * progmodes/sql.el: Version 2.6 + (sql-dialect): Synonym for "sql-product". + (sql-find-sqli-buffer, sql-set-sqli-buffer-generally) + (sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode): + Set "sql-buffer" to buffer name not buffer object so multiple sql + interactive buffers work properly. Reverts misguided changes in + earlier work. + (sql-comint): Make sure different buffer name is used if "*SQL*" + buffer is for a different product. + (sql-make-alternate-buffer-name): Fix bug with "sql-database" + login param. + (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql) + (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase) + (sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer): + Accept new buffer name or prompt for one. + (sql-port): Default to zero. + (sql-comint-mysql): Handle "sql-port" as a numeric. + (sql-port-history): Delete unused variable. + (sql-get-login): Default "sql-port" to a number. + (sql-product-alist): Correct Postgres prompt and terminator regexp. + (sql-sqlite-program): Dynamically detect presence of "sqlite" or + "sqlite3" executables. + (sql-sqlite-login-params): Add "*.sqlite[23]?" database name pattern. + (sql-buffer-live-p): New function. + (sql-mode-menu, sql-send-string): Use it. + (sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK + syntax pattern. + (sql-mode-postgres-font-lock-keywords): Support Postgres V9. + (sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands. + +2010-09-10 Lars Magne Ingebrigtsen + + * net/netrc.el (netrc-credentials): New convenience function. + +2010-09-10 Stefan Monnier + + * textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun + to replace texinfo-font-lock-syntactic-keywords. + (texinfo-mode): Use it. + + * textmodes/tex-mode.el (tex-common-initialization, doctex-mode): + Use syntax-propertize-function. + + * textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to + replace sgml-font-lock-syntactic-keywords. + (sgml-mode): Use it. + + * textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare + since we don't use it. + + * textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function. + + * progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function + if available. + (vhdl-fontify-buffer): Adjust. + + * progmodes/tcl.el (tcl-syntax-propertize-function): New var to + replace tcl-font-lock-syntactic-keywords. + (tcl-mode): Use it. + + * progmodes/simula.el (simula-syntax-propertize-function): New var to + replace simula-font-lock-syntactic-keywords. + (simula-mode): Use it. + + * progmodes/sh-script.el (sh-st-symbol): Remove. + (sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg. + (sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove. + (sh-font-lock-quoted-subshell): Assume we've already matched $(. + (sh-font-lock-paren): Set syntax-multiline. + (sh-font-lock-syntactic-keywords): Remove. + (sh-syntax-propertize-function): New function to replace it. + (sh-mode): Use it. + + * progmodes/ruby-mode.el (ruby-here-doc-beg-re): + Define while compiling. + (ruby-here-doc-end-re, ruby-here-doc-beg-match) + (ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax) + (syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p) + (ruby-here-doc-find-end, ruby-here-doc-beg-syntax) + (ruby-here-doc-end-syntax): Only define when + syntax-propertize is not available. + (ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc): + New functions. + (ruby-in-ppss-context-p): Update to new syntax of heredocs. + (electric-indent-chars): Silence bytecompiler. + (ruby-mode): Use prog-mode, syntax-propertize-function, and + electric-indent-chars. + + * progmodes/python.el (python-syntax-propertize-function): New var to + replace python-font-lock-syntactic-keywords. + (python-mode): Use it. + (python-quote-syntax): Simplify and adjust to new use. + + * progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to + replace perl-font-lock-syntactic-keywords. + (perl-syntax-propertize-special-constructs): New fun to replace + perl-font-lock-special-syntactic-constructs. + (perl-font-lock-syntactic-face-function): New fun. + (perl-mode): Use it. + + * progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function + to replace octave-font-lock-close-quotes. + (octave-syntax-propertize-function): New function to replace + octave-font-lock-syntactic-keywords. + (octave-mode): Use it. + + * progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var; + replaces mixal-font-lock-syntactic-keywords. + (mixal-mode): Use it. + + * progmodes/make-mode.el (makefile-syntax-propertize-function): + New var; replaces makefile-font-lock-syntactic-keywords. + (makefile-mode): Use it. + (makefile-imake-mode): Adjust. + + * progmodes/js.el (js--regexp-literal): Define while compiling. + (js-syntax-propertize-function): New var; replaces + js-font-lock-syntactic-keywords. + (js-mode): Use it. + + * progmodes/gud.el (gdb-script-syntax-propertize-function): New var; + replaces gdb-script-font-lock-syntactic-keywords. + (gdb-script-mode): Use it. + + * progmodes/fortran.el (fortran-mode): Use syntax-propertize-function. + (fortran--font-lock-syntactic-keywords): New var. + (fortran-line-length): Update syntax-propertize-function and + fortran--font-lock-syntactic-keywords. + + * progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function. + + * progmodes/cfengine.el (cfengine-mode): + Use syntax-propertize-function. + (cfengine-font-lock-syntactic-keywords): Remove. + + * progmodes/autoconf.el (autoconf-mode): + Use syntax-propertize-function. + (autoconf-font-lock-syntactic-keywords): Remove. + + * progmodes/ada-mode.el (ada-set-syntax-table-properties) + (ada-after-change-function, ada-initialize-syntax-table-properties) + (ada-handle-syntax-table-properties): Only define when + syntax-propertize is not available. + (ada-mode): Use syntax-propertize-function. + + * font-lock.el (font-lock-syntactic-keywords): Make obsolete. + (font-lock-fontify-syntactic-keywords-region): Move handling of + font-lock-syntactically-fontified to... + (font-lock-default-fontify-region): ...here. + Let syntax-propertize-function take precedence. + (font-lock-fontify-syntactically-region): Cal syntax-propertize. + + * emacs-lisp/syntax.el (syntax-propertize-function) + (syntax-propertize-chunk-size, syntax-propertize--done) + (syntax-propertize-extend-region-functions): New vars. + (syntax-propertize-wholelines, syntax-propertize-multiline) + (syntax-propertize--shift-groups, syntax-propertize-via-font-lock) + (syntax-propertize): New functions. + (syntax-propertize-rules): New macro. + (syntax-ppss-flush-cache): Set syntax-propertize--done. + (syntax-ppss): Call syntax-propertize. + + * emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups. + +2010-09-10 Agustín Martín + + * textmodes/ispell.el (ispell-init-process): Improve comments. + XEmacs compatibility changes regarding (add-hook) 'local option + and (set-process-query-on-exit-flag). + +2010-09-09 Michael Albinus + + * net/tramp-cache.el (tramp-parse-connection-properties): + Set tramp-autoload cookie. + +2010-09-09 Glenn Morris + + * image.el (imagemagick-types-inhibit): Add :type, :version, :group. + (imagemagick-register-types): Doc fix. + +2010-09-08 Stefan Monnier + + * progmodes/octave-mod.el (electric-indent-chars): Silence bytecomp. + + * progmodes/js.el (require): Require is already "eval-and-compile". + (js--re-search-forward): Avoid `eval'. Preserve the error data. + (js--re-search-backward): Use js--re-search-forward. + + * progmodes/fortran.el (fortran-line-length): Don't recompute + syntactic keywords redundantly a second time. + + * progmodes/ada-mode.el: Replace "(set '" with setq. + (ada-mode): Simplify. + (ada-create-case-exception, ada-adjust-case-interactive) + (ada-adjust-case-region, ada-format-paramlist, ada-indent-current) + (ada-search-ignore-string-comment, ada-move-to-start) + (ada-move-to-end): Use with-syntax-table. + + * font-lock.el (save-buffer-state): Remove `varlist' arg. + (font-lock-unfontify-region, font-lock-default-fontify-region): + Update usage correspondingly. + (font-lock-fontify-syntactic-keywords-region): + Set parse-sexp-lookup-properties buffer-locally here. + (font-lock-fontify-syntactically-region): Remove unused `ppss' arg. + + * simple.el (blink-matching-open): Don't burp if we can't find a match. + +2010-09-08 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-report-ops): + Error if not compiled with -DBYTE_CODE_METER. + + * emacs-lisp/bytecomp.el (byte-recompile-directory): + Ignore dir-locals-file. + +2010-09-08 Stefan Monnier + + * progmodes/compile.el (compilation-error-regexp-alist-alist): + Not a const. + (compilation-error-regexp-alist-alist): Rule out ": " in file names + for the `gnu' messages. + (compilation-set-skip-threshold): New command. + (compilation-start): Use \' rather than $. + (compilation-forget-errors): Use clrhash. + +2010-09-08 Agustín Martín + + * textmodes/ispell.el (ispell-valid-dictionary-list): + Simplify logic. + +2010-09-08 Michael Albinus + + Migrate to Tramp 2.2. Rearrange load dependencies. + (Bug#1529, Bug#5448, Bug#5705) + + * Makefile.in (TRAMP_DIR, TRAMP_SRC): New variables. + ($(TRAMP_DIR)/tramp-loaddefs.el): New target. + (LOADDEFS): Add $(lisp)/net/tramp-loaddefs.el. + + * net/tramp.el (top): Remove all other tramp-* loads except + tramp-compat.el. Remove all changes to tramp-unload-hook for + other tramp-* packages. Rearrange defun order. Change calls of + `tramp-compat-call-process', `tramp-compat-decimal-to-octal', + `tramp-compat-octal-to-decimal' to new function names. + (tramp-terminal-type, tramp-initial-end-of-output) + (tramp-methods, tramp-foreign-file-name-handler-alist) + (tramp-tramp-file-p, tramp-completion-mode-p) + (tramp-send-command-and-check, tramp-get-remote-path) + (tramp-get-remote-tmpdir, tramp-get-remote-ln) + (tramp-shell-quote-argument): Set tramp-autoload cookie. + (with-file-property, with-connection-property): Move to + tramp-cache.el. + (tramp-local-call-process, tramp-decimal-to-octal) + (tramp-octal-to-decimal): Move to tramp-compat.el. + (tramp-handle-shell-command): Do not require 'shell. + (tramp-compute-multi-hops): No special handling for tramp-gw-* + symbols. + (tramp-unload-tramp): Do not call `tramp-unload-file-name-handlers'. + + * net/tramp-cache.el (top): Require 'tramp. Add to + `tramp-unload-hook'. + (tramp-cache-data, tramp-get-file-property) + (tramp-set-file-property, tramp-flush-file-property) + (tramp-flush-directory-property, tramp-get-connection-property) + (tramp-set-connection-property, tramp-flush-connection-property) + (tramp-cache-print, tramp-list-connections): Set tramp-autoload + cookie. + (with-file-property, with-connection-property): New defuns, moved + from tramp.el. + (tramp-flush-file-function): Use `with-parsed-tramp-file-name' + macro. + + * net/tramp-cmds.el (top): Add to `tramp-unload-hook'. + (tramp-version): Set tramp-autoload cookie. + + * net/tramp-compat.el (top): Require 'tramp-loaddefs. Remove all + changes to tramp-unload-hook for other tramp-* packages. Add to + `tramp-unload-hook'. + (tramp-compat-decimal-to-octal, tramp-compat-octal-to-decimal) + (tramp-compat-call-process): New defuns, moved from tramp.el. + + * net/tramp-fish.el (top) Require just 'tramp. Add objects to + `tramp-methods' and `tramp-foreign-file-name-handler-alist'. + Add to `tramp-unload-hook'. Change call of + `tramp-compat-decimal-to-octal' to new function name. + (tramp-fish-method): Make it a defconst. + (tramp-fish-file-name-p): Make it a defsubst. + (tramp-fish-method, tramp-fish-file-name-handler) + (tramp-fish-file-name-p): Set tramp-autoload cookie. + + * net/tramp-ftp.el (top) Add objects to `tramp-methods' and + `tramp-foreign-file-name-handler-alist'. Add to + `tramp-unload-hook'. + (tramp-ftp-method): Make it a defconst. + (tramp-ftp-file-name-p): Make it a defsubst. + (tramp-ftp-method, tramp-ftp-file-name-handler) + (tramp-ftp-file-name-p): Set tramp-autoload cookie. + + * net/tramp-gvfs.el (top) Add objects to `tramp-methods' and + `tramp-foreign-file-name-handler-alist'. Add to + `tramp-unload-hook'. Change checks, whether package can be + loaded. + (tramp-gvfs-file-name-p): Make it a defsubst. + (tramp-gvfs-methods, tramp-gvfs-file-name-handler) + (tramp-gvfs-file-name-p): Set tramp-autoload cookie. + (tramp-gvfs-handle-file-directory-p): New defun. + (tramp-gvfs-file-name-handler-alist): Use it. + + * net/tramp-gw.el (top) Add objects to `tramp-methods' and + `tramp-foreign-file-name-handler-alist'. Add to + `tramp-unload-hook'. + (tramp-gw-tunnel-method, tramp-gw-default-tunnel-port) + (tramp-gw-socks-method, tramp-gw-default-socks-port): Make it a + defconst. + (tramp-gw-tunnel-method, tramp-gw-socks-method) + (tramp-gw-open-connection): Set tramp-autoload cookie. + + * net/tramp-imap.el (top) Require just 'tramp. Add objects to + `tramp-methods' and `tramp-foreign-file-name-handler-alist'. + Add to `tramp-unload-hook'. Change checks, whether package can be + loaded. + (tramp-imap-file-name-p): Make it a defsubst. + (tramp-imap-method, tramp-imaps-method) + (tramp-imap-file-name-handler) + (tramp-imap-file-name-p): Set tramp-autoload cookie. + + * net/tramp-smb.el (top) Require just 'tramp. Add objects to + `tramp-methods' and `tramp-foreign-file-name-handler-alist'. + Add to `tramp-unload-hook'. Change checks, whether package can be + loaded. Change call of `tramp-compat-decimal-to-octal' to new + function name. + (tramp-smb-tunnel-method): Make it a defconst. + (tramp-smb-file-name-p): Make it a defsubst. + (tramp-smb-method, tramp-smb-file-name-handler) + (tramp-smb-file-name-p): Set tramp-autoload cookie. + + * net/tramp-uu.el (top) Add to `tramp-unload-hook'. + (tramp-uuencode-region): Set tramp-autoload cookie. + + * net/trampver.el (top) Add to `tramp-unload-hook'. + (tramp-version, tramp-bug-report-address): Set tramp-autoload + cookie. Update release number. + +2010-09-07 Agustín Martín + + * textmodes/ispell.el (ispell-start-process): Make sure original + arg list is properly initialized (Bug#6993, Bug#6994). + +2010-09-06 Alexander Klimov (tiny change) + + * files.el (directory-abbrev-alist): Use \` as default regexp. + + * emacs-lisp/rx.el (rx-any): Don't explode ranges that end in special + chars like - or ] (bug#6984). + (rx-any-condense-range): Explode 2-char ranges. + +2010-09-06 Glenn Morris + + * desktop.el (desktop-path): Bump :version after 2009-09-15 change. + +2010-09-06 Stefan Monnier + + * textmodes/bibtex.el: + * proced.el: Update to new email for Roland Winkler . + +2010-09-05 Lars Magne Ingebrigtsen + + * net/imap.el (imap-message-map): Remove optional buffer parameter, + since no callers use it. + (imap-message-get): Ditto. + (imap-message-put): Ditto. + (imap-mailbox-map): Ditto. + (imap-mailbox-put): Ditto. + (imap-mailbox-get): Ditto. + (imap-mailbox-get): Revert last change for this function. + +2010-09-05 Lars Magne Ingebrigtsen + + * net/imap.el (imap-fetch-safe): Remove function, and alter all + callers to use `imap-fetch' instead. According to the comments, this + should be safe, since all other IMAP clients use the 1:* syntax. + (imap-enable-exchange-bug-workaround): Remove. + (imap-debug): Remove -- doesn't seem very useful. + +2010-09-05 Lars Magne Ingebrigtsen + + * net/imap.el (imap-log): New convenience function used throughout + instead of repeating the same code all over the place. + +2010-09-05 David De La Harpe Golden + + * mouse.el (mouse-save-then-kill): Save region to kill-ring + when mouse-drag-copy-region is non-nil (Bug#6956). + +2010-09-05 Chong Yidong + + * dired.el (dired-ls-sorting-switches, dired-sort-by-name-regexp): + Improve regexps (Bug#6987). + (dired-sort-toggle): Search more robustly for -t flag. + + * files.el (get-free-disk-space): Search more robustly for + "available" column. Suggested by Ehud Karni + . + +2010-09-05 Juanma Barranquero + + * international/uni-bidi.el: + * international/uni-category.el: + * international/uni-combining.el: + * international/uni-decimal.el: + * international/uni-mirrored.el: + * international/uni-name.el: Regenerate. + +2010-09-04 Stefan Monnier + + * electric.el (electric-indent-post-self-insert-function): + Don't reindent with a sloppy indentation function. + + * emacs-lisp/syntax.el (syntax-ppss): More sanity check to catch + border case in change-log-mode. + +2010-09-04 Chong Yidong + + * progmodes/compile.el (compilation-error-regexp-alist-alist): + Remove ruby regexp; handle Ruby errors with gcc-include and gnu. + Recognize leading tab in gcc-include regexp. Ignore names with + leading "from" or "in" in gnu regexp (Bug#6937). + +2010-09-04 Stefan Monnier + + Avoid global recursive calls to kill-buffer-hooks; fit into 80 cols. + * textmodes/ispell.el (ispell-process-buffer-name): Remove. + (ispell-start-process): Avoid setq and simplify logic. + (ispell-init-process): Setup kill-buffer-hook locally when needed. + (kill-buffer-hook): Don't use it globally with code that uses + expand-file-name since that may call kill-buffer via + code_conversion_restore. + +2010-09-04 Noorul Islam K M (tiny change) + + * emacs-lisp/package.el (package-directory-list): Only call + file-name-nondirectory on a string. + +2010-09-02 Chong Yidong + + * emacs-lisp/package.el (package--download-one-archive): + Ensure that archive-contents is valid before saving it. + (package-activate-1, package-mark-obsolete, define-package) + (package-compute-transaction, package-list-maybe-add): Use push. + +2010-09-03 Stefan Monnier + + Use SMIE's blink-paren for octave-mode. + * progmodes/octave-mod.el (octave-font-lock-close-quotes): + Backslashes do not escape single-quotes, single-quotes do. + (octave-block-else-regexp, octave-block-end-regexp) + (octave-block-match-alist): Remove. + (octave-smie-bnf-table): New var, with old content. + (octave-smie-op-levels): Use it. + (octave-smie-closer-alist): New var. + (octave-mode): Use it. Setup smie-blink-matching and electric-indent. + (octave-blink-matching-block-open): Remove. + (octave-reindent-then-newline-and-indent, octave-electric-semi) + (octave-electric-space): Let self-insert-command run expand-abbrev and + blink parens. + + * electric.el (electricity): New group. + (electric-indent-chars): New var. + (electric-indent-post-self-insert-function): New fun. + (electric-indent-mode): New minor mode. + (electric-pair-skip-self): New custom. + (electric-pair-post-self-insert-function): New function. + (electric-pair-mode): New minor mode. + + * calc/calc-aent.el (calcAlg-blink-matching-check): New fun, to replace + calcAlg-blink-matching-open. + (calc-alg-ent-map, calc-alg-ent-esc-map): Initialize in the declaration. + (calc-do-alg-entry): Only touch the part of the keymap that varies. + Use the new blink-matching-check-function. + + Provide blink-matching support to SMIE. + * emacs-lisp/smie.el (smie-bnf-closer-alist): New function. + (smie-blink-matching-triggers, smie-blink-matching-inners): New vars. + (smie-blink-matching-check, smie-blink-matching-open): New functions. + + * simple.el (newline): Fix last change to properly remove itself from + the hook. + +2010-09-02 Stefan Monnier + + * simple.el (newline): Eliminate optimization. + Use post-self-insert-hook to set hard-newline and things before + running post-self-insert-hook. + (blink-matching-check-mismatch): New function. + (blink-matching-check-function): New variable. + (blink-matching-open): Use them. + Skip back forward over prefix chars skipped by forward-sexp. + Don't check if the parens are backslash escaped. + (blink-paren-post-self-insert-function): Check backslash escaping here. + +2010-09-02 Chong Yidong + + * emacs-lisp/package.el (package-menu-mode-map): + Change package-menu-revert bindings to revert-buffer. + (package-menu-mode): Set revert-buffer-function. + (package-menu-revert): Doc fix. + +2010-09-02 Agustín Martín + + * textmodes/ispell.el (ispell-init-process): Use "~/" as + `default-directory' unless using Ispell per-directory personal + dictionaries and not in a mini-buffer under XEmacs. + (kill-buffer-hook): Do not kill ispell process on exit when + `ispell-process-directory' is "~/". (Bug#6143) + +2010-09-02 Jan Djärv + + * simple.el (kill-new): Call interprogram-cut-function with only + one argument. + + * term.el (term-mouse-paste): Don't call x-get-cutbuffer. + Remove cut buffer from error message. + + * term/x-win.el (x-select-text): + * term/pc-win.el (x-selection-value): + * term/ns-win.el (x-selection-value): + * eshell/em-term.el: + * w32-fns.el (x-get-selection-value): + * mouse-sel.el (mouse-sel-set-selection-function): + * frame.el (display-selections-p): Remove cut-buffer in documentation. + + * term/x-win.el: Update documentation for x-last-selected-text-*. + (x-last-selected-text-cut, x-last-selected-text-cut-encoded) + (x-last-cut-buffer-coding, x-cut-buffer-max): Remove. + (x-select-text): Remove argument PUSH, update documentation. + Remove cut-buffer code. + (x-selection-value-internal): Was previously x-selection-value. + (x-selection-value): Rename from x-cut-buffer-or-selection-value. + Update documentation, remove cut-buffer code. + Call x-selection-value-internal. + (x-clipboard-yank): Call x-selection-value-internal. + (x-initialize-window-system): Remove setting of x-cut-buffer-max. + + * term/pc-win.el (x-last-selected-text): + x-cut-buffer-or-selection-value renamed to x-selection-value + (x-select-text): Remove argument PUSH, update documentation. + + * term/ns-win.el (x-setup-function-keys, ns-last-selected-text): + x-cut-buffer-or-selection-value renamed to x-selection-value + (x-selection-value): Rename from x-cut-buffer-or-selection-value. + (x-select-text): Remove argument PUSH, update documentation. + + * emacs-lisp/cl-macs.el (x-get-cutbuffer, x-get-cut-buffer): Remove. + + * w32-fns.el (x-last-selected-text): + x-cut-buffer-or-selection-value renamed to x-selection-value. + (x-cut-buffer-max): Remove. + (x-select-text): Remove argument PUSH, update documentation. + + * simple.el (interprogram-cut-function): Remove mention of PUSH. + + * select.el (x-get-cut-buffer, x-set-cut-buffer): Remove. + + * mouse-sel.el (mouse-sel-get-selection-function): + x-cut-buffer-or-selection-value renamed to x-selection-value. + (x-select-text): Remove optional push. + +2010-09-01 Stefan Monnier + + * simple.el (blink-paren-function): Move from C to here. + (blink-paren-post-self-insert-function): New function. + (post-self-insert-hook): Use it. + + * emacs-lisp/pcase.el (pcase-split-memq): + Fix overenthusiastic optimisation. + (pcase-u1): Handle the case of a lambda pred. + +2010-08-31 Kenichi Handa + + * international/mule-cmds.el (standard-display-european-internal): + Setup standard-display-table for 8-bit characters by storing 8-bit + characters in the element vector. + + * disp-table.el (standard-display-8bit): + Setup standard-display-table for 8-bit characters by storing 8-bit + characters in the element vector. + (standard-display-european): Likewise. + +2010-08-31 Masatake YAMATO + + * textmodes/nroff-mode.el (nroff-view): New command. + (nroff-mode-map): Bind it to C-c C-c. + +2010-08-31 Stefan Monnier + + * emacs-lisp/smie.el (smie-down-list): New command. + + Remove old indentation and navigation code on octave-mode. + * progmodes/octave-mod.el (octave-mode-map): Remap down-list to + smie-down-list rather than add a binding for octave-down-block. + (octave-mark-block, octave-blink-matching-block-open): + Rely on forward-sexp-function. + (octave-fill-paragraph): Don't narrow, so you can use + indent-according-to-mode. + (octave-block-begin-regexp, octave-block-begin-or-end-regexp): Remove. + (octave-in-block-p, octave-re-search-forward-kw) + (octave-re-search-backward-kw, octave-indent-calculate) + (octave-end-as-array-index-p, octave-block-end-offset) + (octave-scan-blocks, octave-forward-block, octave-backward-block) + (octave-down-block, octave-backward-up-block, octave-up-block) + (octave-before-magic-comment-p, octave-indent-line): Remove. + +2010-08-31 Chong Yidong + + * emacs-lisp/package.el (package--read-archive-file): Just use + `read', to avoid copying an additional string. + (package-menu-mode): Set header-line-format here. + (package-menu-refresh, package-menu-revert): Signal an error if + not in the Package Menu. + (package-menu-package-list): New var. + (package--generate-package-list): Operate on the current buffer; + don't assume that it is *Packages*, since the user may rename it. + Allow persistent package listings and sort keys using + package-menu-package-list and package-menu-package-sort-key. + (package-menu--version-predicate): Fix version calculation. + (package-menu-sort-by-column): Don't select the window. + (package--list-packages): Create the *Packages* buffer. + Set package-menu-package-list-key. + (list-packages): Sorting by status is now the default. + (package-buffer-info): Use match-string-no-properties. + (define-package): Add a &rest argument for future proofing, but + don't use it yet. + (package-install-from-buffer, package-install-buffer-internal): + Merge into a single function, package-install-from-buffer. + (package-install-file): Change caller. + + * finder.el: Load finder-inf using `require'. + (finder-list-matches): Sorting by status is now the default. + (finder-compile-keywords): Simpify printing. + +2010-08-30 Stefan Monnier + + * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt. + (octave-mode-map): Remove special bindings for forward/backward-block + and octave-backward-up-block. Use smie-close-block. + (octave-continuation-marker-regexp): New var. + (octave-continuation-regexp): Use it. + (octave-operator-table, octave-smie-op-levels) + (octave-operator-regexp, octave-smie-indent-rules): New vars. + (octave-smie-backward-token, octave-smie-forward-token): New funs. + (octave-mode): Use SMIE. + (octave-close-block): Delete. + +2010-08-30 Eli Zaretskii + + * menu-bar.el (menu-bar-edit-menu) <"Paste">: Check selection in + CLIPBOARD, not in PRIMARY. (Bug#6944) + +2010-08-30 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-offset-rule): Let :parent take + a list of parents. + (smie-indent-column): Allow indirection through variables. + + * composite.el (save-buffer-state): Delete, unused. + * font-lock.el (save-buffer-state): Use with-silent-modifications. + (font-lock-default-fontify-region): Use with-syntax-table. + * jit-lock.el (with-buffer-unmodified): Remove. + (with-buffer-prepared-for-jit-lock): Use with-silent-modifications. + + Use `declare' in defmacros. + * window.el (save-selected-window): + * subr.el (with-temp-file, with-temp-message, with-syntax-table): + * progmodes/python.el (def-python-skeleton): + * net/dbus.el (dbus-ignore-errors): + * jka-cmpr-hook.el (with-auto-compression-mode): + * international/mule.el (with-category-table): + * emacs-lisp/timer.el (with-timeout): + * emacs-lisp/lisp-mnt.el (lm-with-file): + * emacs-lisp/eieio.el (with-slots): + * emacs-lisp/easymenu.el (easy-menu-define): + * emacs-lisp/debug.el (debugger-env-macro): + * emacs-lisp/cl-compat.el (Multiple-value-bind, Multiple-value-setq) + (Multiple-value-call, Multiple-value-prog1): + * emacs-lisp/cl-seq.el (cl-parsing-keywords, cl-check-key) + (cl-check-test-nokey, cl-check-test, cl-check-match): Move indent and + edebug rule to definition. + * emacs-lisp/lisp-mode.el (save-selected-window) + (with-current-buffer, combine-after-change-calls) + (with-output-to-string, with-temp-file, with-temp-buffer) + (with-temp-message, with-syntax-table, read-if, eval-after-load) + (dolist, dotimes, when, unless): + * emacs-lisp/byte-run.el (inline): Remove indent rule, redundant. + +2010-08-29 Chong Yidong + + * finder.el: Require `package'. + (finder-known-keywords): Tweak descriptions. Retire `oop' keyword. + (finder-package-info): Var deleted. + (finder-keywords-hash, finder--builtins-alist): New vars. + (finder-compile-keywords): Compute package--builtins and + finder-keywords-hash instead of finder-keywords-hash, respecting + the "Package" header. + (finder-unknown-keywords, finder-list-matches): + Use finder-keywords-hash and package--list-packages. + (finder-mode): Don't set font-lock-defaults. + (finder-exit): We don't use "*Finder-package*" and "*Finder + Category*" buffers anymore. + + * emacs-lisp/package.el (package--builtins-base): Var deleted. + (package--builtins): Set default value to nil. + (package-initialize): Load precomputed value of package--builtins + from finder-inf.el. + (package-alist, package-compute-transaction) + (package-download-transaction): Improve docstring. + (package-read-all-archive-contents): Do not change + package--builtins here. + (list-packages): Make package-list-packages an alias for this. + Sort by status by default. + (package--list-packages): Add optional PACKAGES arg. + (describe-package-1): Use font-lock-face property. For built-in + packages, insert file commentary. + (package--generate-package-list): Rename from + package-list-packages-internal; all callers changed. Add optional + PACKAGES arg. Add alphabetical sort fallbacks. + (package-menu--version-predicate, package-menu--status-predicate) + (package-menu--description-predicate) + (package-menu--name-predicate): New functions. + + * info.el (Info-finder-find-node): Search package-alist instead of + finder-package-info. + +2010-08-29 Chong Yidong + + * subr.el (version-regexp-alist): Don't use "a" and "b" for + "alpha" and "beta". + (version-to-list): Handle versions like "10.3d". + +2010-08-28 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexpand-all-1): Use pcase. + (macroexp-accumulate): Use `declare'. + +2010-08-27 Vinicius Jose Latorre + + * whitespace.el (whitespace-style): Adjust type declaration. + +2010-08-26 Magnus Henoch + + * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass + empty argument to gvfs-copy. + +2010-08-26 Chong Yidong + + * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to + handle new TRASH arg of `delete-file'. + +2010-08-26 Christian Lynbech (tiny change) + + * net/tramp.el (tramp-handle-insert-directory): Don't use + `forward-word', its default syntax could be changed. + +2010-08-26 Toru TSUNEYOSHI + Michael Albinus + + Implement compression for inline methods. + + * net/tramp.el (tramp-inline-compress-start-size): New defcustom. + (tramp-copy-size-limit): Allow also nil. + (tramp-inline-compress-commands): New defconst. + (tramp-find-inline-compress, tramp-get-inline-compress) + (tramp-get-inline-coding): New defuns. + (tramp-get-remote-coding, tramp-get-local-coding): Remove, + replaced by `tramp-get-inline-coding'. + (tramp-handle-file-local-copy, tramp-handle-write-region) + (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'. + +2010-08-26 Noah Lavine (tiny change) + + Detect ssh 'ControlMaster' argument automatically in some cases. + + * net/tramp.el (tramp-detect-ssh-controlmaster): New defun. + (tramp-default-method): Use it. + +2010-08-26 Karel Klíč + + * net/tramp.el (tramp-file-name-for-operation): + Add file-selinux-context. + +2010-08-26 Łukasz Stelmach (tiny change) + + * play/cookie1.el (read-cookie): Fix off-by-one error (bug#6921). + +2010-08-26 Chong Yidong + + * simple.el (beginning-of-buffer, end-of-buffer): Doc fix + (Bug#6907). + +2010-08-26 Nathan Weizenbaum (tiny change) + + * progmodes/js.el: Make indentation more customizable (Bug#6914). + (js-paren-indent-offset, js-square-indent-offset) + (js-curly-indent-offset): New options. + (js--proper-indentation): Use them. + +2010-08-26 Daniel Colascione + + * progmodes/sh-script.el (sh-get-indent-info): Use syntax-ppss + instead of inspecting font-lock properties (Bug#6916). + +2010-08-26 David Reitter + + * server.el (server-visit-files): Run pre-command-hook and + post-command-hook for each buffer while it is current (Bug#6910). + (server-execute): Do not run hooks here. + +2010-08-26 Michael Albinus + + Sync with Tramp 2.1.19. + + * net/tramp-cmds.el (tramp-cleanup-all-connections) + (tramp-reporter-dump-variable, tramp-load-report-modules) + (tramp-append-tramp-buffers): Use `tramp-compat-funcall'. + (tramp-bug): Recommend setting of `tramp-verbose' to 9. + + * net/tramp-compat.el (top): Do not autoload + `tramp-handle-file-remote-p'. Load tramp-util.el and tramp-vc.el + only when `start-file-process' is not bound. + (byte-compile-not-obsolete-vars): Define if not bound. + (tramp-compat-funcall): New defmacro. + (tramp-compat-line-beginning-position) + (tramp-compat-line-end-position) + (tramp-compat-temporary-file-directory) + (tramp-compat-make-temp-file, tramp-compat-file-attributes) + (tramp-compat-copy-file, tramp-compat-copy-directory) + (tramp-compat-delete-file, tramp-compat-delete-directory) + (tramp-compat-number-sequence, tramp-compat-process-running-p): + Use it. + (tramp-advice-file-expand-wildcards): Do not use + `tramp-handle-file-remote-p'. + (tramp-compat-make-temp-file): Simplify fallback implementation. + (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT. + (tramp-compat-copy-tree): Remove function. + (tramp-compat-delete-file): New defun. + (tramp-compat-delete-directory): Provide implementation for older + Emacsen. + (tramp-compat-file-attributes): Handle only + `wrong-number-of-arguments' error. + + * net/tramp-fish.el (tramp-fish-handle-copy-file): + Add PRESERVE_SELINUX_CONTEXT. + (tramp-fish-handle-delete-file): Add TRASH arg. + (tramp-fish-handle-directory-files-and-attributes): + Do not use `tramp-fish-handle-file-attributes. + (tramp-fish-handle-file-local-copy) + (tramp-fish-handle-insert-file-contents) + (tramp-fish-maybe-open-connection): Use `with-progress-reporter'. + + * net/tramp-gvfs.el (top): Require url-util. + (tramp-gvfs-mount-point): Remove. + (tramp-gvfs-file-name-handler-alist): Add `file-selinux-context' + and `set-file-selinux-context'. + (tramp-gvfs-stringify-dbus-message, tramp-gvfs-send-command) + (tramp-gvfs-handle-file-selinux-context) + (tramp-gvfs-handle-set-file-selinux-context): New defuns. + (with-tramp-dbus-call-method): Format trace message. + (tramp-gvfs-handle-copy-file): Handle PRESERVE-SELINUX-CONTEXT. + (tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file): + Implement backup call, when operation on local files fails. + Use progress reporter. Flush properties of changed files. + (tramp-gvfs-handle-delete-file): Add TRASH arg. + Use `tramp-compat-delete-file'. + (tramp-gvfs-handle-expand-file-name): Expand "~/". + (tramp-gvfs-handle-make-directory): Make more traces. + (tramp-gvfs-handle-write-region): Protect deleting tmpfile. + (tramp-gvfs-url-file-name): Hexify file name in url. + (tramp-gvfs-fuse-file-name): Take also prefix (like dav shares) + into account for the resulting file name. + (tramp-gvfs-handler-askquestion): Preserve current message, in + order to let progress reporter continue afterwards. (Bug#6257) + Return dummy mountpoint, when the answer is "no". + See `tramp-gvfs-maybe-open-connection'. + (tramp-gvfs-handler-mounted-unmounted) + (tramp-gvfs-connection-mounted-p): Test also for new mountspec + attribute "default_location". Set "prefix" property. + Handle default-location. + (tramp-gvfs-mount-spec): Return both prefix and mountspec. + (tramp-gvfs-maybe-open-connection): Test, whether mountpoint + exists. Raise an error, if not (due to a corresponding answer + "no" in interactive questions, for example). + Use `tramp-compat-funcall'. + + * net/tramp-imap.el (top): Autoload `epg-make-context'. + (tramp-imap-handle-copy-file): Add PRESERVE-SELINUX-CONTEXT. + (tramp-imap-do-copy-or-rename-file) + (tramp-imap-handle-insert-file-contents) + (tramp-imap-handle-file-local-copy): Use `with-progress-reporter'. + (tramp-imap-handle-delete-file): Add TRASH arg. + + * net/tramp-smb.el (tramp-smb-handle-copy-file): + Add PRESERVE-SELINUX-CONTEXT. + (tramp-smb-handle-copy-file) + (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) + (tramp-smb-handle-write-region, tramp-smb-maybe-open-connection): + Use `with-progress-reporter'. + (tramp-smb-handle-delete-file): Add TRASH arg. + + * net/tramp.el (tramp-methods): Move hostname to the end in all + ssh `tramp-login-args'. Add `tramp-async-args' attribute where + appropriate. + (tramp-verbose): Describe verbose level 9. + (tramp-completion-function-alist) + (tramp-file-name-regexp, tramp-chunksize) + (tramp-local-coding-commands, tramp-remote-coding-commands) + (with-connection-property, tramp-completion-mode-p) + (tramp-action-process-alive, tramp-action-out-of-band) + (tramp-check-for-regexp, tramp-file-name-p, tramp-equal-remote) + (tramp-exists-file-name-handler): Fix docstring. + (tramp-remote-process-environment): Use `format' instead of + `concat'. Protect version string by apostroph. + (tramp-shell-prompt-pattern): Do not use a shy group in case of + XEmacs. + (tramp-file-name-regexp-unified) + (tramp-completion-file-name-regexp-unified): On W32 systems, do + not regard the volume letter as remote filename. (Bug#5447) + (tramp-perl-file-attributes) + (tramp-perl-directory-files-and-attributes): Don't pass "$3". + (tramp-vc-registered-read-file-names): Read input as + here-document, otherwise the command could exceed maximum length + of command line. + (tramp-file-name-handler-alist): Add `file-selinux-context' and + `set-file-selinux-context'. + (tramp-debug-message): Add `tramp-compat-funcall' to ignored + backtrace functions. + (tramp-error-with-buffer): Don't show the connection buffer when + we are in completion mode. + (tramp-progress-reporter-update, tramp-remote-selinux-p) + (tramp-handle-file-selinux-context) + (tramp-handle-set-file-selinux-context, tramp-process-sentinel) + (tramp-connectable-p, tramp-open-shell, tramp-get-remote-trash): + New defuns. + (with-progress-reporter): New defmacro. + (tramp-debug-outline-regexp): New defconst. + (top, tramp-rfn-eshadow-setup-minibuffer) + (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times) + (tramp-handle-dired-compress-file, tramp-handle-shell-command) + (tramp-completion-mode-p, tramp-check-for-regexp) + (tramp-open-connection-setup-interactive-shell) + (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd) + (tramp-time-diff, tramp-coding-system-change-eol-conversion) + (tramp-set-process-query-on-exit-flag, tramp-unload-tramp): + Use `tramp-compat-funcall'. + (tramp-handle-make-symbolic-link): Flush file properties. + (tramp-handle-load, tramp-handle-file-local-copy) + (tramp-handle-insert-file-contents, tramp-handle-write-region) + (tramp-handle-vc-registered, tramp-maybe-send-script) + (tramp-find-shell): Use `with-progress-reporter'. + (tramp-do-file-attributes-with-stat): Add space in format string, + in order to work around a bug in pdksh. Reported by Gilles Pion + . + (tramp-handle-verify-visited-file-modtime): Do not send a command + when the connection is not established. + (tramp-handle-set-file-times): Simplify the check for utc. + (tramp-handle-directory-files-and-attributes) + (tramp-get-remote-path): Use `copy-tree'. + (tramp-completion-handle-file-name-all-completions): Ensure, that + non remote files are still checked. Oops. + (tramp-handle-copy-file, tramp-do-copy-or-rename-file): + Handle PRESERVE-SELINUX-CONTEXT. + (tramp-do-copy-or-rename-file): Add progress reporter. + (tramp-do-copy-or-rename-file-directly): Do not use + `tramp-handle-file-remote-p'. + (tramp-do-copy-or-rename-file-out-of-band): + Use `tramp-compat-delete-directory'. + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-compute-multi-hops, tramp-maybe-open-connection): + Use `format-spec-make'. + (tramp-handle-delete-file): Add TRASH arg. + (tramp-handle-dired-uncache): Flush directory cache, not only file + cache. + (tramp-handle-expand-file-name) + (tramp-completion-handle-file-name-all-completions) + (tramp-completion-handle-file-name-completion): + Use `tramp-connectable-p'. + (tramp-handle-start-file-process): Set connection property "vec". + Use it, in order to invalidate file caches. Check only for + `remote-tty' process property. + Implement tty setting. (Bug#4604, Bug#6360) + (tramp-file-name-for-operation): Add `call-process-region' and + `set-file-selinux-context'. + (tramp-find-foreign-file-name-handler) + (tramp-advice-make-auto-save-file-name) + (tramp-set-auto-save-file-modes): Remove superfluous check for + `stringp'. This is done inside `tramp-tramp-file-p'. + (tramp-file-name-handler): Trace 'quit. Catch the error for some + operations when we are in completion mode. This gives the user + the chance to correct the file name in the minibuffer. + (tramp-completion-mode-p): Use `non-essential'. + (tramp-handle-file-name-all-completions): Backward/ XEmacs + compatibility: Use `completion-ignore-case' if + `read-file-name-completion-ignore-case' does not exist. + (tramp-get-debug-buffer): Use `tramp-debug-outline-regexp'. + (tramp-find-shell, tramp-open-connection-setup-interactive-shell): + `tramp-open-shell'. + (tramp-action-password): Hide password prompt before next run. + (tramp-process-actions): Widen connection buffer for the trace. + (tramp-open-connection-setup-interactive-shell): Set `remote-tty' + process property. Trace stty settings if `tramp-verbose' >= 9. + Apply workaround for IRIX64 bug. Move argument of last + `tramp-send-command' where it belongs to. + (tramp-maybe-open-connection): Use `async-args' and `gw-args' in + front of `login-args'. + (tramp-get-ls-command, tramp-get-ls-command-with-dired): Run tests + on "/dev/null" instead of "/". + (tramp-get-ls-command-with-dired): Make test for "--dired" + stronger. + (tramp-set-auto-save-file-modes): Adapt version check. + (tramp-set-process-query-on-exit-flag): Fix wrong parentheses. + (tramp-handle-process-file): Call the program in a subshell, in + order to preserve working directory. + (tramp-handle-shell-command): Don't use hard-wired "/bin/sh" but + `tramp-remote-sh' from `tramp-methods'. + (tramp-get-ls-command): Make test for "--color=never" stronger. + (tramp-check-for-regexp): Use (forward-line 1). + + * net/trampver.el: Update release number. + +2010-08-26 Chong Yidong + + * help.el (help-map): Bind `C-h P' to describe-package. + + * menu-bar.el (menu-bar-describe-menu): Add describe-package. + + * emacs-lisp/package.el (package-refresh-contents): Catch errors + when downloading archives. + (describe-package-1): Add package commentary. + (package-install-button-action): New function. + (package-menu-mode-map): Bind ? to package-menu-describe-package. + (package-menu-view-commentary): Function removed. + (package-list-packages-internal): Hide the `package' package too. + +2010-08-25 Kenichi Handa + + * language/misc-lang.el ("Arabic"): New language environment. + Setup composition-function-table for Arabic characters. + + * international/fontset.el (setup-default-fontset): Fix typo for + arabic OTF spec (fini->fina). + +2010-08-25 Jan Djärv + + * menu-bar.el (menu-bar-set-tool-bar-position): Set frame parameter + on all frames. + +2010-08-24 Vinicius Jose Latorre + + * whitespace.el: Allow cleaning up blanks without blank + visualization (Bug#6651). Adjust help window for + whitespace-toggle-options (Bug#6479). Allow to use fill-column + instead of whitespace-line-column (from EmacsWiki). New version + 13.1. + (whitespace-style): Add new value 'face. Adjust docstring. + (whitespace-space, whitespace-hspace, whitespace-tab): + Adjust foreground property face. + (whitespace-line-column): Adjust docstring and type declaration. + (whitespace-style-value-list, whitespace-toggle-option-alist) + (whitespace-help-text): Adjust const initialization. + (whitespace-toggle-options, global-whitespace-toggle-options): + Adjust docstring. + (whitespace-display-window, whitespace-interactive-char) + (whitespace-style-face-p, whitespace-color-on): Adjust code. + (whitespace-help-scroll): New fun. + +2010-08-24 Chong Yidong + + * emacs-lisp/package.el (list-packages): Alias for + package-list-packages. + +2010-08-24 Kevin Ryde + + * textmodes/flyspell.el (flyspell-check-tex-math-command): Doc fix + (Bug#5651). + + * progmodes/ruby-mode.el (ruby): Add defgroup. + +2010-08-24 Chong Yidong + + * progmodes/python.el: Add Ipython support (Bug#5390). + (python-shell-prompt-alist) + (python-shell-continuation-prompt-alist): New options. + (python--set-prompt-regexp): New function. + (inferior-python-mode, run-python, python-shell): + Require ansi-color. Use python--set-prompt-regexp to set the comint + prompt based on the Python interpreter. + (python--prompt-regexp): New var. + (python-check-comint-prompt) + (python-comint-output-filter-function): Use it. + (run-python): Use a pipe (Bug#5694). + +2010-08-24 Fabian Ezequiel Gallina (tiny change) + + * progmodes/python.el (python-send-region): Send a different + Python command if Ipython is in use. + (python-check-version): Use a Python command to find the version. + +2010-08-24 Chong Yidong + + * mouse.el (mouse-yank-primary): Avoid setting primary when + deactivating the mark (Bug#6872). + +2010-08-23 Chris Foote (tiny change) + + * progmodes/python.el (python-block-pairs): Allow use of "finally" + with "else" (Bug#3991). + +2010-08-23 Michael Albinus + + * net/dbus.el: Accept UNIX domain sockets as bus address. + (top): Don't initialize `dbus-registered-objects-table' anymore, + this is done in dbusbind,c. + (dbus-check-event): Adapt test for bus. + (dbus-return-values-table, dbus-unregister-service) + (dbus-event-bus-name, dbus-introspect, dbus-register-property): + Adapt doc string. + +2010-08-23 Juanma Barranquero + + * ido.el (ido-use-virtual-buffers): Fix typo in docstring. + +2010-08-22 Juri Linkov + + * simple.el (read-extended-command): New function with the logic + for `completing-read' moved to Elisp from `execute-extended-command'. + Use `function-called-at-point' in `minibuffer-default-add-function' + to get a command name for M-n (bug#5364, bug#5214). + +2010-08-22 Chong Yidong + + * startup.el (command-line-1): Issue warning for ignored arguments + --unibyte, etc (Bug#6886). + +2010-08-22 Leo + + * net/rcirc.el (rcirc-add-or-remove): Accept a list of elements. + (ignore, bright, dim, keyword): Split list of nicknames before + passing to rcirc-add-or-remove (Bug#6894). + +2010-08-22 Chong Yidong + + * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix (Bug#6880). + +2010-08-22 Leo + + Fix buffer-list rename&refresh after killing a buffer in ido. + * ido.el: Revert Óscar's. + (ido-kill-buffer-at-head): Exit the minibuffer with ido-exit=refresh. + Remember the buffers at head, rather than their name. + * iswitchb.el (iswitchb-kill-buffer): Re-make the list. + +2010-08-22 Kirk Kelsey (tiny change) + Stefan Monnier + + * progmodes/make-mode.el (makefile-fill-paragraph): Account for the + extra backslash added to each line (bug#6890). + +2010-08-22 Stefan Monnier + + * subr.el (read-key): Don't echo keystrokes (bug#6883). + +2010-08-22 Glenn Morris + + * menu-bar.el (menu-bar-games-menu): Add landmark. + +2010-08-22 Glenn Morris + + * align.el (align-regexp): Make group and spacing arguments + use the interactive defaults when non-interactive. (Bug#6698) + + * mail/rmail.el (rmail-forward): Replace mail-text-start with its + expansion, so as not to need sendmail. + (mail-text-start): Remove declaration. + (rmail-retry-failure): Require sendmail. + +2010-08-22 Chong Yidong + + * subr.el (read-key): Don't hide the menu-bar entries (bug#6881). + +2010-08-22 Michael Albinus + + * progmodes/flymake.el (flymake-start-syntax-check-process): + Use `start-file-process' in order to let it run also on remote hosts. + +2010-08-22 Kenichi Handa + + * files.el: Add `word-wrap' as safe local variable. + +2010-08-22 Glenn Morris + + * woman.el (woman-translate): Case matters. (Bug#6849) + +2010-08-22 Chong Yidong + + * simple.el (kill-region): Doc fix (Bug#6787). + +2010-08-22 Glenn Morris + + * calendar/diary-lib.el (diary-header-line-format): + Fit it to the window, not the frame. + +2010-08-22 Andreas Schwab + + * subr.el (ignore-errors): Add debug declaration. + +2010-08-22 Geoff Gole (tiny change) + + * whitespace.el (whitespace-color-off): Remove post-command-hook + locally. + +2010-08-21 Stefan Monnier + + * vc/add-log.el (add-log-file-name): Don't get confused by symlinks. + +2010-08-21 Chong Yidong + + * cus-edit.el (custom-group-value-create): Add extra newline + before end line (Bug#6876). + +2010-08-21 Chong Yidong + + * mouse.el (mouse-save-then-kill): Don't save region to kill ring + when extending it. Before killing on the second click, check if + the buffer is the correct one. Doc fix. + (mouse-secondary-save-then-kill): Allow usage without first + calling mouse-start-secondary, by defaulting to point. Don't save + an empty secondary selection. Doc fix. + +2010-08-21 Vinicius Jose Latorre + + * whitespace.el: Fix slow cursor movement (Bug#6172). Reported by + Christoph Groth and Liu Xin . + New version 13.0. + (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp): + Adjust initialization. + (whitespace-bob-marker, whitespace-eob-marker) + (whitespace-buffer-changed): New vars. + (whitespace-cleanup, whitespace-color-on, whitespace-color-off) + (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp) + (whitespace-post-command-hook, whitespace-display-char-on): + Adjust code. + (whitespace-looking-back, whitespace-buffer-changed): New funs. + (whitespace-space-regexp, whitespace-tab-regexp): Fun eliminated. + +2010-08-19 Stefan Monnier + + * files.el (locate-file-completion-table): Only list the .el and .elc + extensions if there's no other choice (bug#5955). + + * facemenu.el (facemenu-self-insert-data): New var. + (facemenu-post-self-insert-function, facemenu-set-self-insert-face): + New functions. + (facemenu-add-face): Use them. + + * simple.el (blink-matching-open): Obey forward-sexp-function. + +2010-08-18 Stefan Monnier + + * simple.el (prog-mode-map): New var. + (prog-indent-sexp): New command. + + * progmodes/octave-mod.el (octave-mode-menu): Make toggle buttons. + + * progmodes/prolog.el (smie): Require. + + * emacs-lisp/smie.el (smie-default-backward-token) + (smie-default-forward-token): Strip properties. + (smie-next-sexp): Be more careful with associative operators. + (smie-forward-sexp-command): Generalize. + (smie-backward-sexp-command): Simplify. + (smie-closer-alist): New var. + (smie-close-block): New command. + (smie-indent-debug-log): New var. + (smie-indent-offset-rule): Add a few more cases. + (smie-indent-column): New function. + (smie-indent-after-keyword): Use it. + (smie-indent-keyword): Use it. + Fix up the opener code's point position. + (smie-indent-comment): Only applies at BOL. + (smie-indent-debug): New command. + + * emacs-lisp/autoload.el (make-autoload): Preload the macros's + declarations that are useful before running the macro. + +2010-08-18 Joakim Verona + + * image.el (imagemagick-types-inhibit): New variable. + (imagemagick-register-types): New function. + * image-mode.el (image-transform-properties): New function. + (image-transform-set-scale, image-transform-fit-to-height) + (image-transform-set-rotation, image-transform-set-resize) + (image-transform-fit-to-width, image-transform-fit-to-height): + New functions. + (image-toggle-display-image): Support image transforms. + +2010-08-18 Katsumi Yamaoka + + * image.el (create-animated-image): Don't add heuristic mask to image + (Bug#6839). + +2010-08-18 Jan Djärv + + * term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard): + Use QCLIPBOARD instead of QPRIMARY (Bug#6677). + +2010-08-17 Stefan Monnier + + * emacs-lisp/lisp.el (up-list): Obey forward-sexp-function if set. + + Font-lock '...' strings, plus various simplifications and fixes. + * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt. + (octave-font-lock-close-quotes): New function. + (octave-font-lock-syntactic-keywords): New var. + (octave-mode): Use it. Set beginning-of-defun-function. + (octave-mode-map): Don't override the -defun commands. + (octave-mode-menu): Pass it directly to easy-menu-define; + remove (now generic) -defun commands; use info-lookup-symbol. + (octave-block-match-alist): Fix up last change so that + octave-close-block uses the more specific keyword. + (info-lookup-mode): Silence byte-compiler. + (octave-beginning-of-defun): Not interactive any more. + Optimize slightly. + (octave-end-of-defun, octave-mark-defun, octave-in-defun-p): Remove. + (octave-indent-defun, octave-send-defun): Use mark-defun instead. + (octave-completion-at-point-function): Make sure point is within + beg..end. + (octave-reindent-then-newline-and-indent): + Use reindent-then-newline-and-indent. + (octave-add-octave-menu): Remove. + +2010-08-17 Jan Djärv + + * mail/emacsbug.el (report-emacs-bug-insert-to-mailer) + (report-emacs-bug-can-use-xdg-email): New functions. + (report-emacs-bug): Set can-xdg-email to result of + report-emacs-bug-can-use-xdg-email. If can-xdg-email bind + \C-cm to report-emacs-bug-insert-to-mailer and add help text + about it. + + * net/browse-url.el (browse-url-default-browser): Add cond + for browse-url-xdg-open. + (browse-url-can-use-xdg-open, browse-url-xdg-open): New functions. + +2010-08-17 Glenn Morris + + * progmodes/cc-engine.el (c-new-BEG, c-new-END) + (c-fontify-recorded-types-and-refs): Define for compiler. + * progmodes/cc-mode.el (c-new-BEG, c-new-END): Move definitions + before use. + + * calendar/icalendar.el (icalendar--convert-recurring-to-diary): + Fix format call. + +2010-08-17 Michael Albinus + + * net/tramp.el (tramp-handle-make-symbolic-link): Flush file + properties. + (tramp-handle-process-file): Call the program in a subshell, in + order to preserve working directory. + (tramp-action-password): Hide password prompt before next run. (tramp-process-actions): Widen connection buffer for the trace. + +2010-08-16 Deniz Dogan + + * net/rcirc.el (rcirc-log-process-buffers): New option. + (rcirc-print): Use it. + (rcirc-generate-log-filename): New function. + (rcirc-log-filename-function): Change default to + rcirc-generate-log-filename (Bug#6828). + +2010-08-16 Chong Yidong + + * simple.el (deactivate-mark): If select-active-regions is `only', + only set selection for temporarily active regions. + + * cus-start.el: Change defcustom for select-active-regions. + +2010-08-15 Chong Yidong + + * mouse.el (mouse--drag-set-mark-and-point): New function. + (mouse-drag-track): Use LOCATION arg to push-mark. + Use mouse--drag-set-mark-and-point to take click-count into + consideration when updating point and mark (Bug#6840). + +2010-08-15 Chong Yidong + + * progmodes/compile.el (compilation-error-regexp-alist-alist): + Give the Ruby rule a lower priority than Gnu (Bug#6778). + +2010-08-14 Štěpán Němec (tiny change) + + * font-lock.el (lisp-font-lock-keywords-2): + Add combine-after-change-calls, condition-case-no-debug, + with-demoted-errors, and with-silent-modifications (Bug#6025). + +2010-08-14 Kevin Ryde + + * emacs-lisp/copyright.el (copyright-update-year) + (copyright-update): Temporary switch-to-buffer to ensure the + buffer change being queried is visible (Bug#5394). + +2010-08-14 Tom Tromey + + * progmodes/etags.el (tags-file-name): Mark safe if stringp + (Bug#6733). + +2010-08-14 Eli Zaretskii + + * mouse.el (mouse-yank-primary): Fix mouse-2 on MS-Windows and + MS-DOS. (Bug#6689) + +2010-08-13 Jan Djärv + + * menu-bar.el (menu-bar-set-tool-bar-position): New function. + (menu-bar-showhide-tool-bar-menu-customize-enable-left) + (menu-bar-showhide-tool-bar-menu-customize-enable-right) + (menu-bar-showhide-tool-bar-menu-customize-enable-top) + (menu-bar-showhide-tool-bar-menu-customize-enable-bottom): + Call menu-bar-set-tool-bar-position. + +2010-08-12 Stefan Monnier + + * progmodes/octave-mod.el (octave-mode-syntax-table): Use the new "c" + comment style (bug#6834). + * progmodes/scheme.el (scheme-mode-syntax-table): + * emacs-lisp/lisp-mode.el (lisp-mode-syntax-table): Remove spurious + "b" flag in "' 14b" syntax. + + * progmodes/octave-mod.el (octave-mode-map): Remove special bindings + for (un)commenting the region and performing completion. + (octave-mode-menu): Use standard commands for help and completion. + (octave-mode-syntax-table): Support %{..%} comments (sort of). + (octave-mode): Use define-derived-mode. + Set completion-at-point-functions and don't set columns. + Don't disable adaptive-fill-regexp. + (octave-describe-major-mode, octave-comment-region) + (octave-uncomment-region, octave-comment-indent) + (octave-indent-for-comment): Remove. + (octave-indent-calculate): Rename from calculate-octave-indent. + (octave-indent-line, octave-fill-paragraph): Update caller. + (octave-initialize-completions): No need to make an alist. + (octave-completion-at-point-function): New function. + (octave-complete-symbol): Use it. + (octave-insert-defun): Use define-skeleton. + + * progmodes/octave-mod.el (octave-mode): Set comment-add. + (octave-mode-map): Use comment-dwim (bug#6829). + +2010-08-12 Antoine Levitt (tiny change) + + * cus-edit.el (custom-save-variables, custom-save-faces): Fix up + indentation of inserted comment. + +2010-08-11 Jan Djärv + + * faces.el (region): Add type gtk that uses gtk colors. + + * dynamic-setting.el (dynamic-setting-handle-config-changed-event): + Handle theme-name change. + +2010-08-10 Michael R. Mauger + + * progmodes/sql.el: Version 2.5 + (sql-product-alist): Add :prompt-cont-regexp property for several + database products. + (sql-prompt-cont-regexp): New variable. + (sql-output-newline-count, sql-output-by-send): + New variables. Record number of newlines in input text. + (sql-send-string): Handle multiple filters and count newlines. + (sql-send-magic-terminator): Count terminator newline. + (sql-interactive-remove-continuation-prompt): Filters output to + remove continuation prompts; one for each newline. + (sql-interactive-mode): Set up new variables, prompt regexp and + output filter. + (sql-mode-sqlite-font-lock-keywords): Correct some keywords. + (sql-make-alternate-buffer-name): Correct buffer name in edge cases. + +2010-08-10 Stefan Monnier + + * emacs-lisp/pcase.el: New file. + +2010-08-10 Michael Albinus + + * net/tramp.el (tramp-vc-registered-read-file-names): Read input + as here-document, otherwise the command could exceed maximum + length of command line. + (tramp-handle-vc-registered): Call script accordingly. + Reported by Toru TSUNEYOSHI . + +2010-08-10 Kenichi Handa + + * language/hebrew.el: Exclude U+05C3 (Hebrew SOF PASUQ) from the + composable pattern. + +2010-08-09 Chong Yidong + + * emacs-lisp/package.el (package-version-split) + (package--version-first-nonzero, package-version-compare): + Functions removed. + (package-directory-list, package-load-all-descriptors) + (package--built-in, package-activate, define-package) + (package-installed-p, package-compute-transaction) + (package-read-all-archive-contents) + (package--add-to-archive-contents, package-buffer-info) + (package-tar-file-info, package-list-packages-internal): + Use version-to-list and version-list-*. + + * emacs-lisp/package-x.el (package-upload-buffer-internal): + Use version-to-list. + (package-upload-buffer-internal): Use version-list-<=. + +2010-08-09 Kenichi Handa + + * language/hebrew.el: Exclude U+05BD (Hebrew MAQAF) from the + composable pattern. + +2010-08-08 Chong Yidong + + * tutorial.el (tutorial--default-keys): C-d is now bound to + delete-forward-char (Bug#6826). + + * mouse.el (mouse-drag-track): Remove accidentally-removed check + for `double' value of mouse-1-click-follows-link (Bug#6807). + +2010-08-08 Johan Bockgård + + * replace.el (replace-highlight): Bind isearch-forward and + isearch-error, ensuring that highlighting is updated if the user + switches the search direction (Bug#6808). + + * isearch.el (isearch-lazy-highlight-forward): New var. + (isearch-lazy-highlight-new-loop, isearch-lazy-highlight-search): + (isearch-lazy-highlight-update): Use it. + +2010-08-08 Kenichi Handa + + * international/mule.el (define-charset): Store NAME as :base property. + (ctext-non-standard-encodings-table): Pay attention to charset aliases. + (ctext-pre-write-conversion): Sort ctext-standard-encodings by the + current priority. Force using the designation of the specific + charset by adding `charset' text property. Improve the whole algorithm. + +2010-08-08 Juanma Barranquero + + * emulation/pc-select.el (pc-selection-mode-hook) + (copy-region-as-kill-nomark, beginning-of-buffer-mark) + (pc-selection-mode): Fix typos in docstrings. + +2010-08-08 Kenichi Handa + + * language/cyrillic.el: Don't add "microsoft-cp1251" to + ctext-non-standard-encodings-alist here. + + * international/mule.el (ctext-non-standard-encodings-alist): + Add "koi8-r" and "microsoft-cp1251". + (ctext-standard-encodings): New variable. + (ctext-non-standard-encodings-table): List only elements for + non-standard encodings. + (ctext-pre-write-conversion): Adjust for the above change. + Check ctext-standard-encodings. + + * international/mule-conf.el (compound-text): Doc fix. + (ctext-no-compositions): Doc fix. + (compound-text-with-extensions): Doc fix. + +2010-08-08 Stefan Monnier + + * simple.el (exchange-dot-and-mark): Mark obsolete, finally. + +2010-08-08 Juanma Barranquero + + * progmodes/which-func.el (which-func-format): Split help-echo text + into lines, like other mode-line tooltips. + + * server.el (server-start): When using TCP sockets, force IPv4 + and use a literal 127.0.0.1 for localhost. (Related to bug#6781.) + +2010-08-08 Stefan Monnier + + * bindings.el (complete-symbol): Run completion-at-point as a fallback. + +2010-08-08 Juanma Barranquero + + * term.el (term-delimiter-argument-list): Reflow docstring. + (term-read-input-ring, term-write-input-ring, term-send-input) + (term-bol, term-erase-in-display, serial-supported-or-barf): + Fix typos in docstrings. + +2010-08-08 Stefan Monnier + + * bindings.el (function-key-map): Add a S-tab => backtab fallback. + +2010-08-08 Juanma Barranquero + + * dabbrev.el (dabbrev-completion): Fix typo in docstring. + +2010-08-08 MON KEY (tiny change) + + * emacs-lisp/syntax.el (syntax-ppss-toplevel-pos): + Fix typo in docstring (bug#6747). + +2010-08-08 Leo + + * eshell/esh-io.el (eshell-get-target): Better detection of + read-only file (Bug#6762). + +2010-08-08 Juanma Barranquero + + * align.el (align-default-spacing): Doc fix. + (align-region-heuristic, align-regexp): Fix typos in docstrings. + +2010-08-08 Stephen Peters + + * calendar/icalendar.el + (icalendar--split-value): Fix splitting regexp. (Bug#6766) + (icalendar--get-weekday-numbers): New. + (icalendar--convert-recurring-to-diary): Handle multiple byday + values in weekly rules. (Bug#6766) + +2010-08-08 Ulf Jasper + + * calendar/icalendar.el (icalendar-uid-format): Doc fix. + (icalendar--create-uid, icalendar-export-region) + (icalendar--parse-summary-and-rest): Code formatting. + +2010-08-08 Jay Belanger + + * calc/calc.el (calc-trail-mode,calc-refresh): Use `face' property + to italicize headers. + (calc-highlight-selections-with-faces): New variable. + (calc-selected-face, calc-nonselected-face): New faces. + + * calc/calccomp.el (math-comp-highlight-string): Use + `calc-highlight-selections-with-faces' to determine how to highlight + sub-formulas. + + * calc/calc-sel.el (calc-show-selections): Change message to when + using faces to highlight selections. + +2010-08-07 Michael R. Mauger + + * progmodes/sql.el (sql-mode-sqlite-font-lock-keywords): + Add SQLite 3 keywords, functions and datatypes. + (sql-interactive-mode): Remove `comint-process-echoes' set to t + (Bug#6686). + +2010-08-07 Chong Yidong + + * simple.el (select-active-regions): Move to keyboard.c. + (deactivate-mark): Used saved-region-selection. + (select-active-region): Function removed. + (activate-mark, set-mark, push-mark-command) + (handle-shift-selection): Don't call it. + (keyboard-quit): Avoid adding the region to the window selection. + + * mouse.el (mouse-drag-track): Remove hacks to deal with old + select-active-regions implementation. + (mouse-yank-at-click): Doc fix. + + * cus-start.el: Add custom declaration for select-active-regions. + +2010-08-07 Eli Zaretskii + + * simple.el (delete-forward-char): Doc fix. + + * tutorial.el (help-with-tutorial): Hack safe file-local variables + after reading the tutorial. + +2010-08-06 Alan Mackenzie + + * progmodes/cc-cmds.el (c-mask-paragraph, c-fill-paragraph): + Fix for the case that a C style comment has its delimiters alone on + their respective lines. + +2010-08-06 Michael Albinus + + * net/tramp.el (tramp-handle-start-file-process): Set connection + property "vec". + (tramp-process-sentinel): Use it for flushing the cache. + We cannot do it via the process buffer, the buffer could be deleted + already when running the sentinel. + +2010-08-06 Jürgen Hötzel (tiny change) + + * comint.el (comint-mode): Make directory tracking functions + functional on remote files. (Bug#6764) + +2010-08-06 Dan Nicolaescu + + * vc/diff-mode.el (diff-mode-shared-map): Bind g to revert-buffer. + +2010-08-05 Eli Zaretskii + + * emacs-lisp/find-gc.el (find-gc-source-files): + Rename unexec.c => unexcoff.c. + + * emacs-lisp/authors.el (authors-fixed-entries): + Rename unexec.c => unexcoff.c. + +2010-08-05 Michael Albinus + + * net/tramp.el (tramp-handle-dired-uncache): Flush directory + cache, not only file cache. + (tramp-process-sentinel): New defun. + (tramp-handle-start-file-process): Use it, in order to invalidate + file caches. + +2010-08-03 Leo + + * server.el (server-start): Simplify loop. + +2010-08-02 Stefan Monnier + + * frame.el (screen-height, screen-width, set-screen-width) + (set-screen-height): Remove ancient compatibility aliases. + + * textmodes/fill.el (justify-current-line): Don't add 1 to nspaces + when justifying. It seems useless and harmful for ncols=1 (bug#6738). + + * emacs-lisp/timer.el (timer-event-handler): Protect against timers + that change current buffer. + +2010-08-01 YAMAMOTO Mitsuharu + + * mouse.el (mouse-fixup-help-message): Match "mouse-2" only at the + beginning of the string. Use `string-match-p'. (Bug#6765) + +2010-08-01 Jan Djärv + + * cus-start.el (x-gtk-use-system-tooltips): New variable. + +2010-08-01 Chong Yidong + + * emacs-lisp/package.el (package--list-packages): Fix column alignment. + (package--builtins): Tweak descriptions. + (package-print-package): Upcase descriptions if necessary. + Show all built-in packages in font-lock-builtin-face. + (package-list-packages-internal): Omit "emacs" package. + Show status of built-in packages as "built-in". + +2010-07-31 Chong Yidong + + * mouse.el (mouse-save-then-kill): Doc fix. Deactivate mark + before killing to preserve the primary selection (Bug#6701). + + * term/x-win.el (x-select-text): Doc fix. + +2010-07-31 Nathaniel Flath + + * progmodes/cc-vars.el (c-offsets-alist, c-inside-block-syms) + (objc-font-lock-extra-types): + * progmodes/cc-mode.el (c-basic-common-init): + * progmodes/cc-langs.el (c-make-mode-syntax-table) + (c++-make-template-syntax-table) + (c-identifier-syntax-modifications, c-symbol-start, c-operators) + (c-<-op-cont-regexp, c->-op-cont-regexp, c-class-decl-kwds) + (c-brace-list-decl-kwds, c-modifier-kwds, c-prefix-spec-kwds-re) + (c-type-list-kwds, c-decl-prefix-re, c-opt-type-suffix-key): + * progmodes/cc-fonts.el (c-make-inverse-face) + (c-basic-matchers-after): + * progmodes/cc-engine.el (c-forward-keyword-clause) + (c-forward-<>-arglist, c-forward-<>-arglist-recur) + (c-forward-name, c-forward-type, c-forward-decl-or-cast-1) + (c-guess-continued-construct, c-guess-basic-syntax): + Enhance Java Mode to handle Java 5.0 (Tiger) and Java 6 (Mustang). + The above functions were modified or created. + +2010-07-31 Jan Djärv + + * faces.el (face-all-attributes): Improve documentation (Bug#6767). + +2010-07-31 Eli Zaretskii + + * files.el (bidi-paragraph-direction): Define safe local values. + + * language/hebrew.el ("Hebrew"): Add TUTORIAL.he to + language-info-alist. Remove outdated FIXME in a comment. + +2010-07-31 Alan Mackenzie + + * progmodes/cc-cmds.el (c-mask-paragraph): Fix bug #6688: + Auto-fill broken in C/C++ modes. + +2010-07-29 Jan Djärv + + * menu-bar.el (menu-bar-showhide-tool-bar-menu-customize-enable-left) + (menu-bar-showhide-tool-bar-menu-customize-disable) + (menu-bar-showhide-tool-bar-menu-customize-enable-right) + (menu-bar-showhide-tool-bar-menu-customize-enable-bottom) + (menu-bar-showhide-tool-bar-menu-customize-enable-top): New functions + (menu-bar-showhide-tool-bar-menu): If tool bar is moveable, + make a menu for Options => toolbar that can move it. + +2010-07-29 Chong Yidong + + * emacs-lisp/package-x.el (package--make-rss-entry): + (package-maint-add-news-item, package--update-news) + (package-upload-buffer-internal): New arg ARCHIVE-URL. + + * emacs-lisp/package.el (package-archive-url): Rename from + package-archive-id. + (package-install): Doc fix. + (package-download-single, package-download-tar, package-install) + (package-menu-view-commentary): Callers changed. + +2010-07-29 Michael Albinus + + * net/tramp.el (tramp-handle-start-file-process): Check only for + `remote-tty' process property. + (tramp-open-shell): Don't check for tty. (tramp-open-connection-setup-interactive-shell): Set `remote-tty' - process property. Trace stty settings if `tramp-verbose' >= 9. + process property. + + * progmodes/gdb-mi.el (gdb-init-1): Check also for tty on a remote + host. + +2010-07-28 Chong Yidong + + * emacs-lisp/package.el (package-load-list, package-archives) + (package-archive-contents, package-user-dir) + (package-directory-list, package--builtins, package-alist) + (package-activated-list, package-obsolete-alist): Mark as risky. + +2010-07-28 Phil Hagelberg + + Add support for non-default package repositories. + * emacs-lisp/package.el (package-archive-base): Var deleted. + (package-archives): New variable. + (package-archive-contents): Doc fix. + (package-load-descriptor): Do nothing if descriptor file is missing. + (package--write-file-no-coding): New function. + (package-unpack-single): Use it. + (package-archive-id): New function. + (package-download-single, package-download-tar) + (package-menu-view-commentary): Use it. + (package-installed-p): Make second argument optional. + (package-read-all-archive-contents): New function. + (package-initialize): Use it. + (package-read-archive-contents): Add ARCHIVE argument. + (package--add-to-archive-contents): New function. + (package-install): Don't call package-read-archive-contents. + (package--download-one-archive): Store archive file in a + subdirectory of package-user-dir. + (package-menu-execute): Remove spurious line movement. + +2010-07-28 Jan Djärv + + * cus-start.el (tool-bar-style): Add text-image-horiz. + +2010-07-28 Michael Albinus + + * progmodes/gud.el (gud-common-init): Check for remoteness of + `file', and not of `default-directory'. + +2010-07-28 Michael Albinus + + * net/tramp.el (tramp-methods): Move hostname to the end in all + ssh `tramp-login-args'. + (tramp-verbose): Describe verbose level 9. + (tramp-open-shell): Check for tty if `tramp-verbose' >= 9. + (tramp-open-connection-setup-interactive-shell): Trace stty + settings if `tramp-verbose' >= 9. + (tramp-handle-start-file-process): Implement tty setting. + (Bug#4604, Bug#6360) + + * net/tramp-cmds.el (tramp-bug): Recommend setting of + `tramp-verbose' to 9. + +2010-07-27 Aaron S. Hawley + + * emacs-lisp/re-builder.el (reb-re-syntax, reb-lisp-mode) + (reb-lisp-syntax-p, reb-change-syntax, reb-cook-regexp): + Remove references to package `lisp-re' (bug#4369). + +2010-07-27 Tom Tromey + + * progmodes/js.el (js-mode): + * progmodes/make-mode.el (makefile-mode): + * progmodes/simula.el (simula-mode): + * progmodes/tcl.el (tcl-mode): Derive from prog-mode. + +2010-07-27 Juanma Barranquero + + * help-fns.el (find-lisp-object-file-name): Doc fix (bug#6494). + + * time.el (display-time-day-and-date): Remove spurious * in docstring. + (display-time-world-buffer-name, display-time-world-mode-map): + Fix typos in docstrings. + +2010-07-27 Shyam Karanatt (tiny change) + + * image-mode.el (image-display-size): New function. + (image-forward-hscroll, image-next-line, image-eol, image-eob) + (image-mode-fit-frame): Use it (Bug#6639). + +2010-07-27 Chong Yidong + + * dired.el (dired-buffers-for-dir): Handle list values of + dired-directory (Bug#6636). + +2010-07-26 Sam Steingold + + * mouse.el (mouse-yank-primary, mouse-yank-secondary): + Do not call `x-get-selection' the second time, reuse the value. + +2010-07-26 Daiki Ueno + + * epa-mail.el (epa-mail-mode-map): Add alternative key bindings + which consist of control chars only. Suggested by Richard Stallman. + +2010-07-25 Daiki Ueno + + * epa-file.el (epa-file-insert-file-contents): Check if LOCAL-FILE + exists before passing an error to find-file-not-found-functions + (bug#6723). + +2010-07-23 Lukas Huonker + + * play/tetris.el (tetris-tty-colors, tetris-x-colors, tetris-blank): + Remove leading nil element, adjust values. + (tetris-shapes, tetris-shape-scores): + Change representation of shapes and remove some redundancy. + (tetris-get-shape-cell, tetris-shape-width, tetris-draw-next-shape) + (tetris-draw-shape, tetris-erase-shape, tetris-test-shape): + Adjust for working with new representation of shapes. + (tetris-shape-rotations): New function. + (tetris-move-bottom, tetris-move-left, tetris-move-right) + (tetris-rotate-prev, tetris-rotate-next): + Adjust for working with the new version of tetris-test-shape. + +2010-07-23 Markus Triska + + * progmodes/ps-mode.el: Use comint (bug#5954). + (ps-run-mode-map): Adapt for comint-mode; omit "\r", [return].. + (ps-mode-other-newline): Simplify. + (ps-run-mode): Derive from comint-mode instead of + fundamental-mode, yielding input history etc. + (ps-run-start, ps-run-quit, ps-run-clear, ps-run-region) + (ps-run-send-string): Adapt for comint-mode. + (ps-run-newline): Remove now unneeded function. + +2010-07-23 Michael Albinus + + * net/tramp.el (tramp-methods): Move hostname to the end in all + plink `tramp-login-args'. + +2010-07-23 Michael Albinus + + * net/tramp.el (tramp-open-shell): New defun. + (tramp-find-shell, tramp-open-connection-setup-interactive-shell): + Use it. + +2010-07-23 Michael Albinus + + * net/tramp.el (tramp-file-name-regexp-unified) + (tramp-completion-file-name-regexp-unified): On W32 systems, do + not regard the volume letter as remote filename. (Bug#5447) + +2010-07-23 Juanma Barranquero + + * custom.el (custom-declare-variable): Give a clearer error message + when the docstring is missing (bug#6476). + +2010-07-22 Michael R. Mauger + + * progmodes/sql.el: Version 2.4. Improved Login prompting. + (sql-login-params): New widget definition. + (sql-oracle-login-params, sql-mysql-login-params) + (sql-solid-login-params, sql-sybase-login-params) + (sql-informix-login-params, sql-ingres-login-params) + (sql-ms-login-params, sql-postgres-login-params) + (sql-interbase-login-params, sql-db2-login-params) + (sql-linter-login-params): Use it. + (sql-sqlite-login-params): Use it; Define "database" parameter as + a file name. + (sql-sqlite-program): Change to "sqlite3". + (sql-comint-sqlite): Make sure database name is complete. + (sql-for-each-login): New function. + (sql-connect, sql-save-connection): Use it. + (sql-get-login-ext): New function. + (sql-get-login): Use it. + (sql-make-alternate-buffer-name): Handle :file parameters. + +2010-07-22 Juanma Barranquero + + * dired.el (dired-no-confirm): Document value t and fix defcustom to + accept it (bug#6597). Suggested by Drew Adams . + +2010-07-22 Teemu Likonen (tiny change) + + * dired.el (dired-mode-map): Use command remapping (bug#6632). + +2010-07-22 Lawrence Mitchell + + * term/vt100.el (vt100-wide-mode): Fix :init-value keyword (bug#6620). + +2010-07-21 Michael Albinus + + * net/tramp.el (tramp-get-ls-command) + (tramp-get-ls-command-with-dired): Run tests on "/dev/null" + instead of "/". + +2010-07-20 Michael R. Mauger + + * progmodes/sql.el: Version 2.3. - (sql-connection-alist): Changed keys from symbols to strings; ++ (sql-connection-alist): Change keys from symbols to strings; + enhanced the widget definition. + (sql-mode-menu): Add submenu to select connections. + (sql-interactive-mode-menu): Add "Save Connection" item. + (sql-add-product): Fix menu item. + (sql-get-product-feature): Improved error handling. + (sql--alt-buffer-part, sql--alt-if-not-empty): Removed. + (sql-make-alternate-buffer-name): Simplified. + (sql-product-interactive): Handle missing product. + (sql-connect): Support string keys, minor improvements. + (sql-save-connection): New function. + (sql-connection-menu-filter): New function. + +2010-07-20 Michael Albinus + + * net/tramp.el (tramp-file-name-handler): Trace 'quit. + (tramp-open-connection-setup-interactive-shell): Apply workaround for IRIX64 bug. Move argument of last `tramp-send-command' where it belongs to. + +2010-07-20 Michael Albinus + + * net/tramp.el (tramp-perl-file-attributes) + (tramp-perl-directory-files-and-attributes): Don't pass "$3". (tramp-maybe-open-connection): Use `async-args' and `gw-args' in front of `login-args'. - (tramp-get-ls-command, tramp-get-ls-command-with-dired): Run tests - on "/dev/null" instead of "/". - (tramp-get-ls-command-with-dired): Make test for "--dired" - stronger. - (tramp-set-auto-save-file-modes): Adapt version check. + +2010-07-19 Juanma Barranquero + + * time.el (display-time-world-mode): Define with `define-derived-mode'. + Set `show-trailing-whitespace' to nil. + (display-time-world-display): Simplify. + +2010-07-18 Alan Mackenzie + + Enhance `c-file-style' in file/directory local variables. + * progmodes/cc-mode.el (c-count-cfss): New function. + (c-before-hack-hook): Call `c-set-style' differently according to + whether c-file-style was set in file or directory local + variables. + +2010-07-18 Michael R. Mauger + + * progmodes/sql.el: Version 2.2. + (sql-product, sql-user, sql-database, sql-server, sql-port): + Use defcustom :safe keyword rather than putting safe-local-variable + property. + (sql-password): Use defcustom :risky keyword rather than putting + risky-local-variable property. + (sql-oracle-login-params, sql-sqlite-login-params) + (sql-solid-login-params, sql-sybase-login-params) + (sql-informix-login-params, sql-ingres-login-params) + (sql-ms-login-params, sql-postgres-login-params) + (sql-interbase-login-params, sql-db2-login-params) + (sql-linter-login-params): Add `port' option. + (sql-get-product-feature): Add NO-INDIRECT parameter. + (sql-comint-oracle, sql-comint-sybase) + (sql-comint-informix, sql-comint-sqlite, sql-comint-mysql) + (sql-comint-solid, sql-comint-ingres, sql-comint-ms) + (sql-comint-postgres, sql-comint-interbase, sql-comint-db2) + (sql-comint-linter): Rename sql-connect-* functions to + sql-comint-*. + (sql-product-alist, sql-mode-menu): Rename as above and + :sqli-connect-func to :sqli-comint-func. + (sql-connection): New variable. + (sql-interactive-mode): Set it. + (sql-connection-alist): New variable. + (sql-connect): New function. + (sql--alt-buffer-part, sql--alt-if-not-empty) + (sql-make-alternate-buffer-name): Improved alternative buffer name. + +2010-07-17 Thierry Volpiatto + + * image-mode.el (image-bookmark-make-record): Do not set context + in an image (Bug#6650). + +2010-07-17 Chong Yidong + + * simple.el (select-active-region): New function. + (push-mark-command, set-mark, activate-mark) + (handle-shift-selection): Use it. + (deactivate-mark): Don't check for size of region. + + * mouse.el (mouse-drag-track): Use select-active-region. + +2010-07-17 Michael Albinus + + * net/tramp.el (tramp-get-ls-command-with-dired): Make test for + "--dired" stronger. + +2010-07-17 Chong Yidong + + * term/x-win.el (x-select-enable-primary): Change default to nil. + (x-select-enable-clipboard): Add :version keyword. + + * mouse.el (mouse-drag-copy-region): + * simple.el (select-active-regions): Likewise. + +2010-07-16 Reiner Steib + + * vc/vc.el (vc-coding-system-inherit-eol): New defvar. + (vc-coding-system-for-diff): Use it to decide whether to inherit + from the file the EOL format for reading the diffs of that file. + (Bug#4451) + +2010-07-16 Eli Zaretskii + + * mail/rmailmm.el (rmail-mime-save): Make the temp buffer + unibyte, so compressed attachments are not compressed again. + +2010-07-16 Michael Albinus + + * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired + "/bin/sh" but `tramp-remote-sh' from `tramp-methods'. + (tramp-find-shell): Simplify setting connection property. + (tramp-get-ls-command): Make test for "--color=never" stronger. + +2010-07-15 Simon South + + * progmodes/delphi.el (delphi-previous-indent-of): Indent case + blocks within record declarations (i.e. variant parts) correctly. + +2010-07-15 Simon South + + * progmodes/delphi.el (delphi-token-at): Give newlines precedence + over literal tokens when parsing so newlines aren't "absorbed" by + single-line comments. Corrects the indentation of case blocks + that have a comment on the first line. + +2010-07-14 Karl Fogel + + * bookmark.el (bookmark-load-hook): Fix doc string as suggested + by Drew Adams (Bug#5504). + +2010-07-14 Jan Djärv + + * xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127 + now that Unicode is used (Bug#6594). + +2010-07-14 Chong Yidong + + * term/x-win.el (x-select-enable-clipboard): Default to t. + (x-initialize-window-system): Don't overwrite Paste menu item. + + * simple.el (select-active-regions): Default to t. + (push-mark-command): Don't overwrite primary with empty string. + + * mouse.el: Bind mouse-2 to mouse-yank-primary. + (mouse-drag-copy-region): Default to nil. + + * menu-bar.el (menu-bar-enable-clipboard): Don't overwrite + Cut/Copy/Paste menu bar items. + +2010-07-13 Thierry Volpiatto + + Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975). + Patch applied by Karl Fogel. + + * bookmark.el (bookmark-set): Don't set `bookmark-yank-point' + and `bookmark-current-buffer' if they have been already set in + another buffer (e.g gnus-art). + +2010-07-13 Karl Fogel + Thierry Volpiatto + + Preparation for setting bookmarks in Gnus article buffers (Bug#5975). + + * bookmark.el (bookmark-make-record-default): Allow unneeded + information to be omitted from the record. + + Adjust declarations and calls: + + * info.el (bookmark-make-record-default): Adjust declaration. + (Info-bookmark-make-record): Adjust call. + + * woman.el (bookmark-make-record-default): Adjust declaration. + (woman-bookmark-make-record): Adjust call. + + * man.el (bookmark-make-record-default): Adjust declaration. + (Man-bookmark-make-record): Adjust call. + + * image-mode.el (bookmark-make-record-default): Adjust declaration. + + * doc-view.el (bookmark-make-record-default): Adjust declaration. + +2010-07-13 Karl Fogel + + * bookmark.el (bookmark-show-annotation): Use `when' instead of `if'. + This is also from Thierry Volpiatto's patch in bug #6444. However, + because it was extraneous to the functional change in that patch, + and causes a re-indendation, I am committing it separately. + +2010-07-13 Thierry Volpiatto + + * bookmark.el (bookmark-show-annotation): Ensure annotations show, + e.g. in Info bookmarks, by using `switch-to-buffer-other-window'. + Patch applied by Karl Fogel (Bug#6444). + +2010-07-13 Chong Yidong + + * frame.el (make-frame): Fix typo in 2010-06-30 change (Bug#6625). + +2010-07-13 Adrian Robert + + * term/ns-win.el: Bind M-~ to 'ns-prev-frame (due to Matthew + Dempsky; bug#5084). Remove incorrect binding for S-tab. + (ns-alternatives-map): Change S-tab binding to backtab + (bug#6616). + + * simple.el (normal-erase-is-backspace-setup-frame): Set mode on + under ns. + +2010-07-12 Andreas Schwab + + * language/tai-viet.el ("TaiViet"): Try to fix re-encoding bugs. + (Bug#5806) + + * language/tv-util.el (tai-viet-re): Remove format. + +2010-07-12 Kenichi Handa + + * language/hebrew.el: Remove no-byte-compile declaration. + Change coding: tag to utf-8. Register hebrew-shape-gstring in + composition-function-table for 3-character looking back. + (hebrew-font-get-precomposed): New function. + (hebrew-shape-gstring): Utilize precomposed glyphs if available. + +2010-07-11 Chong Yidong + + * mouse.el (mouse-drag-track): Handle select-active-regions + (Bug#6612). + +2010-07-11 Magnus Henoch + + * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass + empty argument to gvfs-copy. + +2010-07-10 Glenn Morris + + * calendar/calendar.el (calendar-week-end-day): New function. + * calendar/cal-tex.el (cal-tex-cursor-month): Remove unused vars. + Respect calendar-week-start-day. (Bug#6606) + (cal-tex-insert-day-names, cal-tex-insert-blank-days) + (cal-tex-insert-blank-days-at-end): Respect calendar-week-start-day. + (cal-tex-first-blank-p, cal-tex-last-blank-p): Simplify, and + respect calendar-week-start-day. + +2010-07-10 Chong Yidong + + * simple.el (use-region-p): Doc fix (Bug#6607). + +2010-07-10 Aleksei Gusev (tiny change) + + * progmodes/compile.el (compilation-error-regexp-alist-alist): + Add regexps for cucumber and ruby. + +2010-07-08 Daiki Ueno + + * epa-file.el (epa-file-error, epa-file--find-file-not-found-function) + (epa-file-insert-file-contents): Hack to prevent + find-file from opening empty buffer when decryption failed + (bug#6568). + +2010-07-07 Agustín Martín + + * textmodes/ispell.el (ispell-alternate-dictionary): + Use file-readable-p. + Return nil if no word-list is found at default locations. + (ispell-complete-word-dict): Default to nil. + (ispell-command-loop): Use 'word-list' when using lookup-words. + (lookup-words): Use ispell-complete-word-dict or + ispell-alternate-dictionary. Check for word-list availability + and handle errors if needed with better messages (Bug#6539). + (ispell-complete-word): Use ispell-complete-word-dict or + ispell-alternate-dictionary. + +2010-07-07 Christoph Scholtes + + * progmodes/python.el (python-font-lock-keywords): Add Python 2.7 + builtins (BufferError, BytesWarning, WindowsError; callables + bin, bytearray, bytes, format, memoryview, next, print; __package__). + +2010-07-07 Glenn Morris + + * play/zone.el (top-level): Do not require timer, tabify, or cl. + (zone-shift-left): Ignore intangibility, and any errors from + forward-char. + (zone-shift-right): Remove no-op end-of-line. Ignore intangibility. + (zone-pgm-putz-with-case): Use upcase-region rather than inserting, + deleting, and copying text properties. + (zone-line-specs, zone-pgm-stress): Check forward-line exit status. + (zone-pgm-rotate): Handle odd buffers like that of gomoku, where getting + to point-max is hard. + (zone-fret, zone-fill-out-screen): Replace cl's do with dotimes. + (zone-fill-out-screen): Ignore intangibility. + +2010-07-05 Chong Yidong + + * menu-bar.el (menu-bar-mode): + * tool-bar.el (tool-bar-mode): Replace default-frame-alist element + if it has been set. + + * mouse.el (mouse-drag-track): Call mouse-start-end to handle + word/line selection (Bug#6565). + +2010-07-04 Juanma Barranquero + + * net/dbus.el (dbus-send-signal): Declare function. + +2010-07-04 Michael Albinus + + * net/dbus.el: Implement signal "PropertiesChanged" (from D-Bus 1.3.1). + (dbus-register-property): New optional argument EMITS-SIGNAL. + (dbus-property-handler): Send signal "PropertiesChanged" if requested. + +2010-07-03 Chong Yidong + + * mouse.el (mouse-drag-overlay): Variable deleted. + (mouse-move-drag-overlay, mouse-show-mark): Functions deleted. + (mouse--remap-link-click-p): New function. + (mouse-drag-track): Handle dragging by using temporary Transient + Mark mode, instead of a special overlay. + (mouse-kill-ring-save, mouse-save-then-kill): Don't call + mouse-show-mark. + + * mouse-sel.el (mouse-sel-selection-alist): mouse-drag-overlay + deleted. + +2010-07-02 Juri Linkov + + * autoinsert.el (auto-insert-alist): Fix readability + by using dotted pair notation for lambda. + +2010-07-02 Juri Linkov + + * faces.el (read-face-name): Rename arg `string-describing-default' + to `default'. Doc fix. Display the default value in quotes + in the prompt. With empty input, return the `default' arg, + unless the default value is a string (in which case return nil). + (describe-face): Replace the string `default' arg of `read-face-name' + with the symbol `default'. + +2010-07-02 Chong Yidong + + * emulation/viper-cmd.el (viper-delete-backward-char) + (viper-del-backward-char-in-insert) + (viper-del-backward-char-in-replace, viper-change) + (viper-backward-indent): Replace delete-backward-char with + delete-char (Bug#6552). + +2010-07-01 Chong Yidong + + * ruler-mode.el (ruler--save-header-line-format): Fix typos. + +2010-06-30 Chong Yidong + + * frame.el (make-frame): Add default-frame-alist to the PARAMETERS + argument passed to frame-creation-function (Bug#5378). + + * faces.el (x-handle-named-frame-geometry) + (x-handle-reverse-video, x-create-frame-with-faces) + (face-set-after-frame-default, tty-create-frame-with-faces): + Don't separately consult default-frame-alist. It is now passed as the + PARAMETER argument. + +2010-06-30 Andreas Schwab + + * startup.el (command-line): Don't call tool-bar-setup in a + tty-only build. + +2010-06-30 Chong Yidong + + * ruler-mode.el (ruler--save-header-line-format): New fun. + (ruler-mode): Use it as a setter function, so as not to overwrite + ruler-mode-header-line-format-old if Ruler mode is on (Bug#5370). + +2010-06-29 Chong Yidong + + * vc/vc.el (vc-deduce-backend): New fun. Handle diff buffers. + (vc-root-diff, vc-print-root-log, vc-log-incoming) + (vc-log-outgoing): Use it. + (vc-diff-internal): Set diff-vc-backend. + + * vc/diff-mode.el (diff-vc-backend): New var. + +2010-06-28 Jan Djärv + + * dynamic-setting.el (font-setting-change-default-font): + Remove call to message. + +2010-06-28 Kenichi Handa + + * international/quail.el (quail-insert-kbd-layout): Fix the + showing of untranslated characters. + +2010-06-28 Chong Yidong + + * simple.el (delete-active-region): New option. + (delete-backward-char): Implement in Lisp. + (delete-forward-char): New command. + + * mouse.el (mouse-region-delete-keys): Deleted. + (mouse-show-mark): Simplify. + + * bindings.el (global-map): Bind delete and DEL, the former to + delete-forward-char. + +2010-06-27 Lennart Borgman + + * progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB. + (ruby-mode): Bind indent-line-function (Bug#5119). + +2010-06-27 Chong Yidong + + * startup.el (command-line): Recognize "0" X resource value. + +2010-06-27 Chong Yidong + + * startup.el (command-line): Use X resources to set the value of + menu-bar-mode and tool-bar-mode, before calling frame-initialize. + + * menu-bar.el (menu-bar-mode): + * tool-bar.el (tool-bar-mode): Don't change default-frame-alist. + Set init-value to t. + + * frame.el (frame-notice-user-settings): Don't change + default-frame-alist based on menu-bar-mode and tool-bar-mode, or + vice versa (Bug#2249). + +2010-06-26 Eli Zaretskii + + * w32-fns.el (w32-convert-standard-filename): Doc fix. + +2010-06-25 Agustín Martín + + * textmodes/flyspell.el (flyspell-check-previous-highlighted-word): + Make sure `flyspell-word' re-checks word after function run (Bug#6504). + + * textmodes/ispell.el (ispell-init-process): Make sure ispell and + default directories are expanded (Bug#6143). + +2010-06-24 Juri Linkov + + * minibuffer.el (completions-format): Change default from nil to + `horizontal'. Remove `nil' value from :type. Doc fix. (Bug#6459) + +2010-06-24 Juri Linkov + + * vc/vc.el (vc-diff-internal): Set `revert-buffer-function' + buffer-locally to lambda that re-runs the vc diff command. + (Bug#6447) + +2010-06-24 Chong Yidong + + * kmacro.el (kmacro-call-macro): Don't issue hint message if the + echo area is in use (Bug#3412). + +2010-06-22 Glenn Morris + + * textmodes/texinfmt.el (texinfo-format-region) + (texinfo-raise-lower-sections, texinfo-format-separate-node) + (texinfo-itemize-item, texinfo-multitable-item, texinfo-alias) + (texinfo-format-option, texinfo-noindent): + Use line-beginning-position and line-end-position. + + * calc/calc-aent.el, calc/calc-ext.el, calc/calc-lang.el: + * calc/calc-store.el, calc/calc-units.el, calc/calc.el: + * calc/calccomp.el: Add explicit utf-8 coding cookies to files with + utf-8 characters. + +2010-06-21 Karl Fogel + + * play/zone.el (zone-fall-through-ws): Fix next-line -> + forward-line fallout. + +2010-07-06 Chong Yidong + + * mouse.el (mouse-appearance-menu): Add docstring. + + * help.el (describe-key): Print up-event using key-description. + +2010-07-03 Michael Albinus + + * net/zeroconf.el (zeroconf-resolve-service) + (zeroconf-service-resolver-handler): Use `dbus-byte-array-to-string'. + (zeroconf-publish-service): Use `dbus-string-to-byte-array'. + +2010-07-03 Jan Moringen + + * net/zeroconf.el (zeroconf-service-remove-hook): New defun. + +2010-06-30 Dan Nicolaescu + + Avoid displaying files with a nil state in vc-dir. + * vc/vc-dir.el (vc-dir-update): Obey the noinsert argument in all + cases that cause insertion. + (vc-dir-resynch-file): Tell vc-dir-update to avoid inserting files + with a nil state. + +2010-06-30 Chong Yidong + + * xml.el (xml-parse-region): Avoid infloop (Bug#5281). + +2010-06-29 Leo + + * emacs-lisp/rx.el (rx): Doc fix. (Bug#6537) + +2010-06-27 Oleksandr Gavenko (tiny change) + + * generic-x.el (bat-generic-mode): Fix regexp for command line + switches (Bug#5719). + +2010-06-27 Masatake YAMATO + + * htmlfontify.el (hfy-face-attr-for-class): Use append instead + of nconc to avoid pure storage error (Bug#6239). + +2010-06-27 Christoph (tiny change) + + * bookmark.el (bookmark-bmenu-2-window, bookmark-bmenu-other-window) + (bookmark-bmenu-other-window-with-mouse): Remove unnecessary + bindings of bookmark-automatically-show-annotations (Bug#6515). + +2010-06-25 Eli Zaretskii + + * arc-mode.el (archive-zip-extract): Don't quote the file name on + MS-Windows and MS-DOS. (Bug#6467, Bug#6144) + +2010-06-24 Štěpán Němec (tiny change) + + * comint.el (make-comint, make-comint-in-buffer): Mention return + value in the docstrings. (Bug#6498) + +2010-06-24 Yoni Rabkin + + * bs.el (bs-mode-font-lock-keywords): Remove "by" from Dired pattern, + since it is not present when using some non-default switches. + +2010-06-23 Karl Fogel + + * simple.el (compose-mail): Fix doc string to refer to + `compose-mail-user-agent-warnings', instead of to the + nonexistent `compose-mail-check-user-agent'. + +2010-06-21 Alan Mackenzie + + Fix an indentation bug: + + * progmodes/cc-mode.el (c-common-init): Initialise c-new-BEG/END. + (c-neutralize-syntax-in-and-mark-CPP): c-new-BEG/END: Take account + of existing values. + + * progmodes/cc-engine.el (c-clear-<-pair-props-if-match-after) + (c-clear->-pair-props-if-match-before): now return t when they've + cleared properties, nil otherwise. + (c-before-change-check-<>-operators): Set c-new-beg/end correctly + by taking account of the existing value. + + * progmodes/cc-defs.el + (c-clear-char-property-with-value-function): Fix this to clear the + property rather than overwriting it with nil. + +2010-06-20 Chong Yidong + + * emacs-lisp/package.el (package-print-package): Add link to + package description via describe-package. + (describe-package-1): List package requirements. Add button to + perform installation. + (package-menu-describe-package): New command. + + * help-mode.el (help-package): New button type. + +2010-06-19 Chong Yidong + + * emacs-lisp/package.el: Move package-list-packages binding to + menu-bar.el. + (describe-package, describe-package-1, package--dir): New funs. + (package-activate-1): Use package--dir. + + * emacs-lisp/package-x.el (gnus-article-buffer): Require package. + + * help-mode.el (help-package-def): New button type. + + * menu-bar.el: Move package-list-packages binding here from + package.el. + +2010-06-19 Gustav Hållberg (tiny change) + + * descr-text.el (describe-char): Avoid trailing whitespace. (Bug#6423) + +2010-06-18 Stefan Monnier + + * emacs-lisp/edebug.el (edebug-read-list): + Phase out old-style backquotes. + +2010-06-17 Juri Linkov + + * help-mode.el (help-mode): Set buffer-local variable + revert-buffer-function to help-mode-revert-buffer. + (help-mode-revert-buffer): New function. + + * info.el (Info-revert-find-node): Check for major-mode Info-mode + before popping to "*info*" (like in other Info functions). + Keep buffer-name in old-buffer-name. Keep Info-history-forward in + old-history-forward. Pop to old-buffer-name or "*info*" to + recreate the killed buffer. Set Info-history-forward from + old-history-forward. + (Info-breadcrumbs-depth): Add :group and :version. + +2010-06-17 Dan Nicolaescu + + * emacs-lisp/package.el (package-menu-mode-map): Add a menu. + +2010-06-17 Agustín Martín + + * textmodes/ispell.el (ispell-aspell-find-dictionary): Fix regexp + for languages like Portuguese with pt_{BR,PT} and no plain pt. + +2010-06-17 Juanma Barranquero + + * emacs-lisp/package.el (package-menu-mode-map): + Move initialization into declaration. + + * menu-bar.el (menu-bar-options-menu): Fix typo in menu entry. + +2010-06-17 Chong Yidong + + * emacs-lisp/package.el (package-archive-base): Point to + elpa.gnu.org. + (package-enable, package-load-list): New defcustoms. + (package-user-dir, package-directory-list): Turn into defcustoms. + Don't include package-user-dir in package-directory-list. + (package--builtins-base): Don't include Emacs as a "package". + (package-subdirectory-regexp): New var. + (package-load-all-descriptors, package-compute-transaction) + (package-download-transaction): Obey package-load-list. + (package-activate-1): Rename from package-do-activate. + (package-list-packages-internal): Check package-load-list. + (package-load-descriptor, package-generate-autoloads) + (package-unpack, package-unpack-single) + (package--read-archive-file, package-delete): + Use expand-file-name. + + * emacs-lisp/package-x.el: New file. Package uploading + functionality split out from package.el. + + * startup.el (command-line): Load packages after reading init file. + +2010-06-17 Tom Tromey + + * emacs-lisp/package.el: New file. + +2010-06-22 Dan Nicolaescu + + Fix vc-annotate for renamed files when using Git. + * vc/vc-git.el (vc-git-find-revision): Deal with empty results from + ls-files. Doe not pass the object as a file name to cat-file, it + is not a file name. + (vc-git-annotate-command): Pass the file name using -- to avoid + ambiguity with the revision. + (vc-git-previous-revision): Pass a relative file name. + +2010-06-22 Glenn Morris + + * progmodes/js.el (js-mode-map): Use standard capitalization and + ellipses for menu entries. + + * wid-edit.el (widget-complete): Doc fix. + +2010-06-22 Jürgen Hötzel (tiny change) + + * wid-edit.el (widget-complete): Fix typo in 2009-12-02 change. + +2010-06-22 Dan Nicolaescu + + Fix annotating other revisions for renamed files in vc-annotate. + * vc/vc-annotate.el (vc-annotate): Add an optional argument for the + VC backend. Use it when non-nil. + (vc-annotate-warp-revision): Pass the VC backend to vc-annotate. + (Bug#6487). + + Fix vc-annotate-show-changeset-diff-revision-at-line for git. + * vc/vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal): + Do not pass the file name to the 'previous-revision call when we + don't want a file diff. (Bug#6489) + +2010-06-21 Dan Nicolaescu + + Fix finding revisions for renamed files in vc-annotate. + * vc/vc.el (vc-find-revision): Add an optional argument for + the VC backend. Use it when non-nil. + * vc/vc-annotate.el (vc-annotate-find-revision-at-line): Pass the VC + backend to vc-find-revision. (Bug#6487) + +2010-06-21 Dan Nicolaescu + + Fix reading file names in Git annotate buffers. + * vc/vc-git.el (vc-git-annotate-extract-revision-at-line): + Remove trailing whitespace. Suggested by Eric Hanchrow. (Bug#6481) + +2010-06-20 Alan Mackenzie + + * progmodes/cc-mode.el (c-before-hack-hook): When the mode is set + in file local variables, set it first. + +2010-06-19 Glenn Morris + + * descr-text.el (describe-char-unicode-data): Insert separating + space when needed. (Bug#6422) + + * progmodes/idlwave.el (idlwave-action-and-binding): + Fix typo in 2009-12-03 change. (Bug#6450) + +2010-06-17 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexpand-all-1): Put back special + handling for `lambda' (misunderstanding). + +2010-06-16 Jay Belanger + + * calc/calc-poly.el (math-accum-factors): Make sure that + constants aren't distributed after they are factored out. + +2010-06-16 Juri Linkov + + * facemenu.el (list-colors-display): Call `pop-to-buffer' before + `list-colors-print'. (Bug#6332) + + * subr.el (read-quoted-char): Fix up last change (bug#6290). + +2010-06-16 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda' + specially, since it's a macro. Fix up wrong hint passed to maybe-cons. + + * font-lock.el (font-lock-major-mode): Rename from + font-lock-mode-major-mode to distinguish it from + global-font-lock-mode's own font-lock-mode-major-mode (bug#6135). + (font-lock-set-defaults): + * font-core.el (font-lock-default-function): Adjust users. + (font-lock-mode): Don't set it at all. + +2010-06-16 Stefan Monnier + + * vc/vc-annotate.el (vc-annotate): Use vc-read-revision. + +2010-06-16 Glenn Morris + + * calendar/appt.el (appt-time-msg-list): Doc fix. + (appt-check): Let-bind appt-warn-time. + (appt-add): Make the 3rd argument optional. + Simplify argument names. Doc fix. Check for integer WARNTIME. + Only add WARNTIME to the output list if non-nil. + +2010-06-16 Ivan Kanis + + * calendar/appt.el (appt-check): Let the 3rd element of + appt-time-msg-list specify the warning time. + (appt-add): Add new argument with the warning time. (Bug#5176) + +2010-06-16 Bob Rogers + + * vc/vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions + older than version 1.6. (Bug#6361) + +2010-06-16 Helmut Eller + + * emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote', + used by cl-do-arglist. (Bug#6408) + +2010-06-16 Agustín Martín + + * textmodes/ispell.el (ispell-dictionary-base-alist): + Fix portuguese casechars/not-casechars for missing 'çÇ'. + Suggested by Rolando Pereira (bug#6434). + +2010-06-15 Juanma Barranquero + + * facemenu.el (list-colors-sort): Doc fix. + +2010-06-15 Bob Rogers + + * progmodes/sql.el (sql-connect-mysql): Fix typo. + +2010-06-14 Juri Linkov + + Add sort option `list-colors-sort'. (Bug#6332) + * facemenu.el (color-rgb-to-hsv): New function. + (list-colors-sort): New defcustom. + (list-colors-sort-key): New function. + (list-colors-display): Doc fix. Sort list according to the option + `list-colors-sort'. + (list-colors-print): Add HSV values to `help-echo' property of + RGB strings. + +2010-06-14 Juri Linkov + + * compare-w.el: Move to the "vc" subdirectory. + +2010-06-14 Stefan Monnier + + * image-mode.el (image-mode-map): Remap left-char and right-char. + + * nxml/nxml-mode.el (nxml-indent-line): Standardize indent behavior. + +2010-06-12 Chong Yidong + + * term/common-win.el (x-colors): Add all the color names defined + in rgb.txt (Bug#6332). + + * facemenu.el (list-colors-print): Don't print extra names if it + will overflow the window width. + + * vc/log-edit.el (log-edit-font-lock-keywords): Revert 2010-06-02 + change (Bug#6343). + +2010-06-12 Eli Zaretskii + + * files.el (make-directory): Doc fix (bug#6396). + +2010-06-12 Michael Albinus + + * net/tramp.el (tramp-remote-process-environment): Protect version + string by apostroph. + (tramp-shell-prompt-pattern): Do not use a shy group in case of + XEmacs. + (tramp-file-name-for-operation): Add `call-process-region'. (tramp-set-process-query-on-exit-flag): Fix wrong parentheses. - (tramp-handle-process-file): Call the program in a subshell, in - order to preserve working directory. - (tramp-handle-shell-command): Don't use hard-wired "/bin/sh" but - `tramp-remote-sh' from `tramp-methods'. - (tramp-get-ls-command): Make test for "--color=never" stronger. - (tramp-check-for-regexp): Use (forward-line 1). - * net/trampver.el: Update release number. + * net/tramp-compat.el (top): Do not autoload + `tramp-handle-file-remote-p'. Load tramp-util.el and tramp-vc.el + only when `start-file-process' is not bound. + (tramp-advice-file-expand-wildcards): Do not use + `tramp-handle-file-remote-p'. + (tramp-compat-make-temp-file): Handle the case, that + `make-temp-file' has no third argument EXTENSION. + +2010-06-11 Juanma Barranquero + + * makefile.w32-in (WINS_BASIC): Include new directory vc. + + * loadup.el ("vc-hooks", "ediff-hook"): Load from lisp/vc/. + +2010-06-11 Juri Linkov + + * finder.el (finder-known-keywords): Add keyword "vc" + for version control. + + * add-log.el, cvs-status.el, diff.el, diff-mode.el, ediff.el, + * emerge.el, log-edit.el, log-view.el, pcvs.el, smerge-mode.el, + * vc-annotate.el, vc-bzr.el, vc-dir.el, vc-dispatcher.el, vc-git.el, + * vc-hg.el, vc-mtn.el, vc.el: Add keyword "vc". + +2010-06-11 Juri Linkov + + Move version control related files to the "vc" subdirectory. + * add-log.el, cvs-status.el, diff.el, diff-mode.el, ediff-diff.el, + * ediff.el, ediff-help.el, ediff-hook.el, ediff-init.el, + * ediff-merg.el, ediff-mult.el, ediff-ptch.el, ediff-util.el, + * ediff-vers.el, ediff-wind.el, emerge.el, log-edit.el, log-view.el, + * pcvs-defs.el, pcvs.el, pcvs-info.el, pcvs-parse.el, pcvs-util.el, + * smerge-mode.el, vc-annotate.el, vc-arch.el, vc-bzr.el, vc-cvs.el, + * vc-dav.el, vc-dir.el, vc-dispatcher.el, vc.el, vc-git.el, + * vc-hg.el, vc-hooks.el, vc-mtn.el, vc-rcs.el, vc-sccs.el, vc-svn.el: + Move files to the "vc" subdirectory. + +2010-06-11 Chong Yidong + + * comint.el (comint-password-prompt-regexp): Fix 2010-04-10 change + (Bug#6367). + +2010-06-11 Stephen Eglen + + * shell.el: Bind `shell-resync-dirs' to M-RET. + +2010-06-10 Michael Albinus + + * notifications.el: Move file from lisp/net, because it is + supposed to talk locally to the user. + +2010-06-10 Julien Danjou + + * net/notifications.el (notifications-on-action-signal) + (notifications-on-closed-signal): Pass notification id as first + argument to the callback functions. Add docstrings. + (notifications-notify): Fix docstring. + +2010-06-10 Glenn Morris + + * emacs-lisp/authors.el (authors-ignored-files) + (authors-valid-file-names): Add some files. + +2010-06-10 Stefan Monnier + + * net/rcirc.el (rcirc-server-alist, rcirc, rcirc-connect): Resolve + merge conflict, giving preference to the emacs-23 version of the code. + +2010-06-09 Stefan Monnier + + * emacs-lisp/advice.el (ad-compile-function): + Define warning-suppress-types before we let-bind it (bug#6275). + + * vc-dispatcher.el: Rename mode-line-hook to vc-mode-line-hook; + declare it, make it buffer-local and permanent-local (bug#6324). + (vc-resynch-window): Adjust name. + * vc-hooks.el (vc-find-file-hook): Adjust name. + +2010-06-09 Michael Albinus + + * net/notifications.el (notifications-notify): Fix docstring. + +2010-06-09 Juanma Barranquero + + Update to Unicode 6.0.0 beta. + * international/charprop.el: Update copyright. + * international/mule-cmds.el (ucs-names): Update character ranges. + * international/uni-bidi.el: + * international/uni-category.el: + * international/uni-combining.el: + * international/uni-comment.el: + * international/uni-decimal.el: + * international/uni-decomposition.el: + * international/uni-digit.el: + * international/uni-lowercase.el: + * international/uni-mirrored.el: + * international/uni-name.el: + * international/uni-numeric.el: + * international/uni-old-name.el: + * international/uni-titlecase.el: + * international/uni-uppercase.el: Regenerate. + +2010-06-09 Juanma Barranquero + + * emacs-lisp/smie.el (comment-string-strip): Declare function. + (smie-precs-precedence-table): Fix typo in docstring. + + * vc-mtn.el (log-edit-extract-headers): Declare function. + + * vc-hg.el (log-edit-extract-headers): Remove duplicate declaration. + + * net/notifications.el (dbus-register-signal): Declare function. + (notifications-notify): Fix typos and reflow docstring. + +2010-06-09 Dan Nicolaescu + + Improve VC create/retrieve tag/branch. + * vc.el (vc-create-tag): Do not read the directory name for VCs + with repository revision granularity. Adjust the tag/branch + prompt. Reset VC properties. + (vc-retrieve-tag): Do not read the directory name for VCs + with repository revision granularity. Reset VC properties. + +2010-06-09 Julien Danjou + + * net/notifications.el: New file. + +2010-06-09 Dan Nicolaescu + + Add optional support for resetting VC properties. + * vc-dispatcher.el (vc-resynch-window): Add new optional argument, + call vc-file-clearprops when true. + (vc-resynch-buffer): Add new optional argument, pass it down. + (vc-resynch-buffers-in-directory): Likewise. + + Improve support for special markup in the VC commit message. + * vc-mtn.el (vc-mtn-checkin): Add support for Author: and Date: markup. + * vc-hg.el (vc-hg-checkin): Add support for Date:. + * vc-git.el (vc-git-checkin): + * vc-bzr.el (vc-bzr-checkin): Likewise. + +2010-06-09 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-keyword): Remove special case that + can be handled with a ((:before "fn") (:prev "=>" parent)) rule. + +2010-06-07 Martin Pohlack + + * iimage.el: Remove images as soon as the underlying text is modified. + (iimage-modification-hook): New function. + (iimage-mode-buffer): Use it. + +2010-06-07 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-offset-rule): Rename from + smie-indent-offset-after. Add :prev case. Make a bit more generic. + (smie-indent-virtual): Remove `virtual' arg. Update callers. + (smie-indent-keyword): Add handling of open-paren keywords. + (smie-indent-comment-continue): Don't assume comment-continue. + +2010-06-07 Martin Rudalics + + * window.el (pop-to-buffer): Remove the conditional that + compares new-window and old-window, so it will reselect + the selected window unconditionally. + http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00078.html + +2010-06-07 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-offset-after) + (smie-indent-forward-token, smie-indent-backward-token): New functions. + (smie-indent-after-keyword): Use them. + (smie-indent-fixindent): Only applies to the indentation of the BOL. + (smie-indent-keyword): Tweak the black magic. + (smie-indent-comment-continue): Strip comment-continue before use. + (smie-indent-functions): Indent comments before keywords. + +2010-06-06 Juri Linkov + + * isearch.el (isearch-lazy-highlight-search): Fix looping + by checking for empty match. This syncs this loop with the + similar loop in `isearch-search'. (Bug#6362) + +2010-06-05 Juanma Barranquero + + * net/dbus.el (dbus-register-method): Declare function. + (dbus-handle-event, dbus-property-handler): Fix typos in docstrings. + (dbus-introspect): Doc fix. + (dbus-event-bus-name, dbus-introspect-get-interface) + (dbus-introspect-get-argument): Reflow docstrings. + +2010-06-05 Dan Nicolaescu + + vc-log-incoming/vc-log-outgoing fixes for Git. + * vc-git.el (vc-git-log-view-mode): Fix font lock for + incoming/outgoing logs. + (vc-git-log-outgoing, vc-git-log-incoming): Use @{upstream} + instead of vc-git-compute-remote. + (vc-git-compute-remote): Remove. + +2010-06-04 Chong Yidong + + * term/common-win.el (x-colors): Add "dark green" and "dark + turquoise" (Bug#6332). + +2010-06-04 Juri Linkov + + * simple.el (kill-new): Fix logic of kill-do-not-save-duplicates. + Instead of setting `replace' to t and replacing the same string + with itself, don't do certain actions when + kill-do-not-save-duplicates is non-nil and string is equal to car + of kill-ring: don't call menu-bar-update-yank-menu, don't push + interprogram-paste strings to kill-ring, and don't push the input + argument `string' to kill-ring. + http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00072.html + +2010-06-04 Juanma Barranquero + + * subr.el (directory-sep-char): Move from fileio.c and make a defconst. + +2010-06-04 Michael Albinus + + * net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name): Expand "~/". + (tramp-gvfs-handler-mounted-unmounted) + (tramp-gvfs-connection-mounted-p): Handle default-location. + + * net/tramp-smb.el (tramp-smb-handle-delete-directory): Don't try to + move files to trash. + +2010-06-04 Juanma Barranquero + + * international/mule-cmds.el (nonascii-insert-offset) + (nonascii-translation-table): Add obsolescence information. + + * international/mule.el (make-translation-table-from-vector): Doc fix. + +2010-06-03 Glenn Morris + + * desktop.el (desktop-clear-preserve-buffers): + Add "*Warnings*" buffer. (Bug#6336) + +2010-06-03 Dan Nicolaescu + + vc-log-incoming/vc-log-outgoing improvements for Git. + * vc-git.el (vc-git-log-outgoing): Use the same format as the + short log. + (vc-git-log-incoming): Likewise. Run "git fetch" before the log command. + + Add bindings for vc-log-incoming and vc-log-outgoing. + * vc-hooks.el (vc-prefix-map): Add bindings for vc-log-incoming + and vc-log-outgoing. + * vc-dir.el (vc-dir-menu-map): Add menu bindings for vc-log-incoming + and vc-log-outgoing. + +2010-06-03 Chong Yidong + + * net/rcirc.el (rcirc-sort-nicknames): Remove. + (rcirc-handler-366): Always sort nicknames. + +2010-06-03 Juanma Barranquero + + * emacs-lisp/smie.el (comment-continue): Declare for byte-compiler. + +2010-06-03 Chong Yidong + + * net/rcirc.el (rcirc-nickname<, rcirc-sort-nicknames-join): Doc fix. + +2010-06-03 Stefan Monnier + + * net/rcirc.el (rcirc-sort-nicknames): Change default. + (rcirc-sort-nicknames-join): Avoid setq. + +2010-06-03 Deniz Dogan + + * net/rcirc.el (rcirc-sort-nicknames): New custom. + (rcirc-nickname<, rcirc-sort-nicknames-join): New funs. + (rcirc-handler-366): Use them. + +2010-06-03 Stefan Monnier + + Split smie-indent-calculate into more manageable chunks. + * emacs-lisp/smie.el (smie-indent-virtual, smie-indent-fixindent) + (smie-indent-comment, smie-indent-after-keyword, smie-indent-keyword) + (smie-indent-close, smie-indent-comment-continue, smie-indent-bob) + (smie-indent-exps): Extract from smie-indent-calculate. + (smie-indent-functions): New var. + (smie-indent-functions): Use them. + +2010-06-02 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-hanging-p): Use smie-bolp. + (smie-indent-calculate): Simplify and cleanup. + +2010-06-02 Michael Albinus + + * net/tramp-gvfs.el (top): Require url-util. + (tramp-gvfs-mount-point): Remove. + (tramp-gvfs-stringify-dbus-message, tramp-gvfs-send-command): + New defuns. + (with-tramp-dbus-call-method): Format trace message. + (tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file): + Implement backup call, when operation on local files fails. + Use progress reporter. Flush properties of changed files. + (tramp-gvfs-handle-make-directory): Make more traces. + (tramp-gvfs-url-file-name): Hexify file name in url. + (tramp-gvfs-fuse-file-name): Take also prefix (like dav shares) + into account for the resulting file name. + (tramp-gvfs-handler-askquestion): Return dummy mountpoint, when + the answer is "no". See `tramp-gvfs-maybe-open-connection'. + (tramp-gvfs-handler-mounted-unmounted) + (tramp-gvfs-connection-mounted-p): Test also for new mountspec + attribute "default_location". Set "prefix" property. + (tramp-gvfs-mount-spec): Return both prefix and mountspec. + (tramp-gvfs-maybe-open-connection): Test, whether mountpoint + exists. Raise an error, if not (due to a corresponding answer + "no" in interactive questions, for example). + +2010-06-02 Dan Nicolaescu + + * log-edit.el (log-edit-font-lock-keywords): Make group 4 match lax. + +2010-06-01 Juanma Barranquero + + * emacs-lisp/eldoc.el: Add completions for new commands left-* and + right-*. (Bug#6265) + +2010-06-01 Dan Nicolaescu + + Add support for vc-log-incoming, improve vc-log-outgoing for Git. + * vc-git.el (vc-git-compute-remote): New function. + (vc-git-log-outgoing): Use it instead of hard coding a value. + (vc-git-log-incoming): New function. + + Improve state updating for VC tag commands. + * vc.el (vc-create-tag, vc-retrieve-tag): Call vc-resynch-buffer + to update the state of all buffers in the directory. + + * vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539). + +2010-06-01 Stefan Monnier + + * vc-bzr.el (vc-bzr-revision-completion-table): Apply + `file-directory-p' to the filename part rather than to the whole text. + +2010-05-31 Stefan Monnier + + * man.el (Man-completion-table): Let the user type "-k " (bug#6319). + +2010-05-31 Drew Adams + + * files.el (directory-files-no-dot-files-regexp): Doc fix (bug#6298). + +2010-05-31 Juanma Barranquero + + * subr.el (momentary-string-display): Just use read-event to read + the exit event (Bug#6238). + +2010-05-30 Eli Zaretskii + + * international/mule.el (define-coding-system): Doc fix (bug#6313). + +2010-05-30 Juanma Barranquero + + * emulation/cua-base.el: Recognize also `right-word' and `left-word'. + Suggested by Eli Zaretskii . + +2010-05-30 Stefan Monnier + + * minibuffer.el (completion-file-name-table): Don't return a boundary + past the end of `string' (bug#6299). + (completion--file-name-table): Delegate to completion-file-name-table + for the `boundaries' case. + +2010-05-30 Juanma Barranquero + + * emulation/cua-base.el: Recognize `right-char' and `left-char' as + movement commands. + + * progmodes/ada-xref.el (ada-prj-ada-project-path-sep): Set from + `path-separator', but maintain compatibility with Emacs 20.2. + +2010-05-29 Chong Yidong + + * server.el (server-process-filter): Receive parent-id argument + from emacsclient. + (server-create-window-system-frame): New arg. Pass parent-id as + frame parameter. + +2010-05-29 Eli Zaretskii + + Bidi-sensitive word movement with arrow keys. + * subr.el (right-arrow-command, left-arrow-command): Move to + bindings.el. + + * bindings.el (right-char, left-char): Move from subr.el and + rename from right-arrow-command and left-arrow-command. + (right-word, left-word): New functions. + (global-map) : Bind to right-char. + (global-map) : Bind to left-char. + (global-map) : Bind to right-word. + (global-map) : Bind to left-word. + + * ls-lisp.el (ls-lisp-classify-file): New function. + (ls-lisp-insert-directory): Call it if switches include -F (bug#6294). + (ls-lisp-classify): Call ls-lisp-classify-file. + (insert-directory): Remove blanks from switches. + +2010-05-29 Chong Yidong + + * ansi-color.el: Delete unused escape sequences (Bug#6085). + (ansi-color-drop-regexp): New constant. + (ansi-color-apply, ansi-color-filter-region) + (ansi-color-apply-on-region): Delete unrecognized control sequences. + (ansi-color-apply): Build string list before calling concat. + +2010-05-28 Juri Linkov + + * image-dired.el (image-dired-dired-toggle-marked-thumbs): + Replace LOCALP arg of `dired-get-filename' 'no-dir with nil. + (Bug#5270) + +2010-05-28 Michael Albinus + + * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall' + to ignored backtrace functions. + (with-progress-reporter): Expand docstring. + (tramp-handle-delete-file): Implement TRASH argument. + (tramp-get-remote-trash): New defun. + +2010-05-28 Michael Albinus + + * net/tramp-compat.el (tramp-compat-delete-file): + Use `symbol-value' for backward compatibility. + + * net/tramp.el (tramp-handle-make-symbolic-link) + (tramp-handle-load) + (tramp-do-copy-or-rename-file-via-buffer) + (tramp-do-copy-or-rename-file-directly) + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-handle-process-file, tramp-handle-call-process-region) + (tramp-handle-shell-command, tramp-handle-file-local-copy) + (tramp-handle-insert-file-contents, tramp-handle-write-region) + (tramp-delete-temp-file-function): Use `delete-file' instead + of `tramp-compat-delete-file'. + + * net/tramp-fish.el (tramp-fish-handle-delete-directory) + (tramp-fish-handle-make-symbolic-link) + (tramp-fish-handle-process-file): Use `delete-file' instead + of `tramp-compat-delete-file'. + + * net/tramp-ftp.el (tramp-ftp-file-name-handler): + Use `delete-file' instead of `tramp-compat-delete-file'. + + * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg. + (tramp-gvfs-handle-write-region): Use `delete-file' instead of + `tramp-compat-delete-file'. + + * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): + Use `delete-file' instead of `tramp-compat-delete-file'. + + * net/tramp-smb.el (tramp-smb-handle-copy-file) + (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) + (tramp-smb-handle-write-region): Use `delete-file' instead of + `tramp-compat-delete-file'. + (tramp-smb-handle-delete-directory): Use 'trash as arg. + +2010-05-27 Chong Yidong + + * dired.el (dired-delete-file): New arg TRASH. + (dired-internal-do-deletions): New arg TRASH. Use progress reporter. + (dired-do-flagged-delete, dired-do-delete): Use trash. + + * speedbar.el (speedbar-item-delete): Allow trashing. + + * files.el (delete-directory): New arg TRASH. + + * net/ange-ftp.el (ange-ftp-del-tmp-name, ange-ftp-delete-file) + (ange-ftp-rename-remote-to-remote) + (ange-ftp-rename-local-to-remote) + (ange-ftp-rename-remote-to-local, ange-ftp-load) + (ange-ftp-compress, ange-ftp-uncompress): Remove optional arg from + `delete-file'. + (ange-ftp-delete-directory): Add optional arg to `delete-file', to + allow trashing. + + * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to + handle new TRASH arg of `delete-file'. + + * net/tramp.el (tramp-handle-delete-file): Change FORCE arg to TRASH. + (tramp-handle-make-symbolic-link, tramp-handle-load) + (tramp-do-copy-or-rename-file-via-buffer) + (tramp-do-copy-or-rename-file-directly) + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-handle-process-file, tramp-handle-call-process-region) + (tramp-handle-shell-command, tramp-handle-file-local-copy) + (tramp-handle-insert-file-contents, tramp-handle-write-region) + (tramp-delete-temp-file-function): Use null TRASH arg in + tramp-compat-delete-file call. + + * net/tramp-fish.el (tramp-fish-handle-delete-directory) + (tramp-fish-handle-delete-file) + (tramp-fish-handle-make-symbolic-link) + (tramp-fish-handle-process-file): Use null TRASH arg in + `tramp-compat-delete-file' call. + + * net/tramp-ftp.el (tramp-ftp-file-name-handler): Use null TRASH + arg in `tramp-compat-delete-file' call. + + * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg. + (tramp-gvfs-handle-write-region): Use null TRASH arg in + `tramp-compat-delete-file' call. + + * net/tramp-imap.el (tramp-imap-handle-delete-file): Rename arg. + (tramp-imap-do-copy-or-rename-file): Use null TRASH arg in + `tramp-compat-delete-file' call. + + * net/tramp-smb.el (tramp-smb-handle-copy-file) + (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) + (tramp-smb-handle-write-region): Use null TRASH arg in + tramp-compat-delete-file call. + (tramp-smb-handle-delete-directory): Use tramp-compat-delete-file. + (tramp-smb-handle-delete-file): Rename arg. + + * diff.el (diff-sentinel): + * epg.el (epg--make-temp-file, epg-decrypt-string) + (epg-verify-string, epg-sign-string, epg-encrypt-string): + * jka-compr.el (jka-compr-partial-uncompress) + (jka-compr-call-process, jka-compr-write-region): + * server.el (server-sentinel): Remove optional arg from + delete-file, reverting 2010-05-03 change. + +2010-05-27 Chong Yidong + + * progmodes/verilog-mode.el (verilog-type-font-keywords): + Use font-lock-constant-face, not obsolete font-lock-reference-face. + +2010-05-27 Kenichi Handa + + * language/hebrew.el (hebrew-shape-gstring): Check if a glyph + element of GSTRING is nil. + +2010-05-27 Stefan Monnier + + * emacs-lisp/smie.el (smie-forward-token-function) + (smie-backward-token-function): New vars. + (smie-backward-sexp, smie-forward-sexp) + (smie-indent-hanging-p, smie-indent-calculate): Use them. + (smie-default-backward-token): Rename from smie-backward-token and + skip comments. + (smie-default-forward-token): Rename from smie-forward-token and + skip comments. + (smie-next-sexp): Handle nil results from next-token. + (smie-indent-calculate): Add a new case for special `fixindent' comments. + +2010-05-27 Chong Yidong + + * progmodes/verilog-mode.el (verilog-type-font-keywords): + Use font-lock-constant-face, not obsolete font-lock-reference-face. + +2010-05-27 Masatake YAMATO + + * htmlfontify.el (hfy-face-resolve-face): New function. + (hfy-face-to-style): Use it (Bug#6279). + +2010-05-26 Stefan Monnier + + * progmodes/ada-xref.el (ada-gnat-parse-gpr): + * emulation/edt.el (edt-load-keys): Avoid (expand-file-name "."). + +2010-05-26 Glenn Morris + + * emulation/edt.el (edt-load-keys): Use locate-library. + +2010-05-25 Chong Yidong + + * log-edit.el (log-edit-strip-single-file-name): Default to nil. + (log-edit-changelog-entries): Doc fix. + (log-edit-changelog-insert-entries): Args changed. + Rename relative filenames in ChangeLog entries. Delete tabs. + (log-edit-insert-changelog-entries): Reorganize return value of + `log-edit-changelog-entries' to pass filenames to + log-edit-changelog-insert-entries. + +2010-05-25 Thierry Volpiatto + + * dired.el (dired-mode-map): Rebind "\C-t\C-t" from + `image-dired-dired-insert-marked-thumbs' to + `image-dired-dired-toggle-marked-thumbs'. + + * image-dired.el: Require cl when compiling. + (image-dired-dired-toggle-marked-thumbs): Rename from + `image-dired-dired-insert-marked-thumbs'. Add ARG. Doc fix. + Use interactive spec "P". Set LOCALP arg of `dired-get-filename' + to 'no-dir. Skip files whose names don't match + `image-file-name-regexp'. When file has a thumbnail overlay, + delete it. (Bug#5270) + +2010-05-25 Juri Linkov + + * image-mode.el (image-mode): Add image-after-revert-hook to + after-revert-hook. + (image-after-revert-hook): New function. (Bug#5669) + +2010-05-25 Juri Linkov + + * image.el (image-animated-p): When delay between animated images + is 0, set it to 10 (0.1 sec). (Bug#6258) + +2010-05-25 Christian Lynbech (tiny change) + + * net/tramp.el (tramp-handle-insert-directory): Don't use + `forward-word', its default syntax could be changed. + +2010-05-25 Michael Albinus + + * net/tramp.el (tramp-progress-reporter-update): New defun. + (with-progress-reporter): Use it. + (tramp-process-actions): + * net/tramp-gvfs.el (tramp-gvfs-handler-askquestion): + Preserve current message, in order to let progress reporter continue + afterwards. (Bug#6257) + +2010-05-25 Glenn Morris + + * net/rcirc.el (rcirc-default-user-name, rcirc-default-full-name): + Add :version. + +2010-05-25 Ryan Yeske + + * net/rcirc.el (rcirc-default-user-name): Change to "user". + (rcirc-default-full-name): Change to "unknown". + (rcirc-user-name-history): Add variable. + +2010-05-25 Ryan Yeske + Jonathan Rockway + + * net/rcirc.el (rcirc-server-alist): Add :pass. + (rcirc): When prompting for connection parameters, also prompt for + username and password. + (rcirc-connect): Take a PASS argument. If PASS is non-nil, send + value to server when connecting. + +2010-05-25 Stefan Monnier + + * emacs-lisp/smie.el (smie-set-prec2tab): Check override before use. + (smie-merge-prec2s): Pass the tables as separate args. + (smie-bnf-precedence-table): Adjust call accordingly. + (smie-prec2-levels): Set levels at the end. + + Replace Lisp calls to delete-backward-char by delete-char. + * bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el, + * skeleton.el, term.el, time.el, wid-edit.el, woman.el, + * calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el, + * calc/calc.el, emacs-lisp/cl-extra.el, emacs-lips/cl-loaddefs.el, + * emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el, + * eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el, + * gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el, + * language/ethio-util.el, mh-e/mh-alias.el, mh-e/mh-search.el, + * net/imap.el, net/rcirc.el, obsolete/complete.el, play/decipher.el, + * progmodes/ada-mode.el, progmodes/cc-awk.el, progmodes/dcl-mode.el, + * progmodes/ps-mode.el, progmodes/verilog-mode.el, + * progmodes/vhdl-mode.el, textmodes/bibtex.el, textmodes/fill.el, + * textmodes/reftex-auc.el, textmodes/rst.el, textmodes/sgml-mode.el, + * textmodes/table.el, textmodes/texinfmt.el: Replace Lisp calls to + delete-backward-char by calls to delete-char. + +2010-05-25 Kenichi Handa + + * language/hebrew.el (hebrew-shape-gstring): New function. + Register it in composition-function-table for all Hebrew combining + characters. + +2010-05-25 Stefan Monnier + + * epa.el (epa--select-keys): Don't explicitly delete the window since + that can fail (e.g. sole window in frame). Use dedication instead. + +2010-05-24 Uday S Reddy (tiny change) + + * textmodes/fill.el (fill-region): Don't fill past the end (bug#6201). + +2010-05-22 Chong Yidong + + * image.el (image-refresh): Define as an alias for image-flush. + + * image-mode.el (image-toggle-display-image): Caller changed. + +2010-05-21 Juri Linkov + + * progmodes/grep.el (grep-read-files): Fix multi-pattern aliases. + Remove "all" from grep-files-aliases. Split grep-files-aliases by + whitespace, call wildcard-to-regexp on substrings and concat them + with "\\|". (Bug#6114) + +2010-05-21 Alan Mackenzie + + * progmodes/cc-engine.el (c-parse-state-get-strategy): + Replace parameter `here' with `here-' and `here-plus', which sandwich + any pertinent CPP construct. + (c-remove-stale-state-cache-backwards): Fix a bug which happens + when doing (c-parse-state) in a CPP construct: Exclude any "new" + CPP construct from taking part in the scanning. + +2010-05-21 Michael Albinus + + * net/tramp.el (tramp-do-copy-or-rename-file) + (tramp-handle-file-local-copy, tramp-maybe-open-connection): + Tune `with-progress-reporter' messages. + (tramp-handle-vc-registered): + * net/tramp-fish.el (tramp-fish-handle-file-local-copy) + (tramp-fish-handle-insert-file-contents) + (tramp-fish-maybe-open-connection): + * net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): + * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file) + (tramp-imap-handle-insert-file-contents) + (tramp-imap-handle-file-local-copy): Use `with-progress-reporter'. + +2010-05-21 Juanma Barranquero + + * add-log.el (change-log-font-lock-keywords): + Highlight all authors in multi-author entries. + + * smerge-mode.el (smerge-refine-ignore-whitespace) + (smerge-refine-weight-hack, smerge-refine, smerge-makeup-conflict): + Fix typos in docstrings. + (smerge-resolve, smerge-refine-subst): Reflow docstrings. + +2010-05-21 Glenn Morris + + * progmodes/fortran.el (fortran-mode): + * progmodes/f90.el (f90-mode): Derive from prog-mode. + + * loadup.el [CANNOT_DUMP]: Update for bootstrap-emacs no longer + having a relative path in src/Makefile.in. + +2010-05-20 Kevin Ryde + + * help-mode.el (help-make-xrefs): For Info node links turn + newlines into spaces. Link node names with newlines are matched + by help-xref-info-regexp and buttonized, this change ensures they + can be followed successfully with RET. (Bug#6206) + +2010-05-20 Juri Linkov + + * locate.el (locate): Use pop-to-buffer instead of + switch-to-buffer-other-window. (Bug#6204) + +2010-05-20 Juri Linkov + + * replace.el (replace-highlight): Fix lazy-highlighting + for `M-s w str M-% str RET'. + +2009-12-15 Masatake YAMATO + + * isearch.el (isearch-yank-word-or-char): Pull next subword + when `subword-mode' is activated. (Bug#6220) + +2010-05-20 Mark A. Hershberger + + * isearch.el (isearch-update-post-hook): New hook. + (isearch-update): Use the new hook. (Bug#6225) + +2010-05-20 Juri Linkov + + * isearch.el (isearch-mode-map): Bind more keys to isearch-help-map: + [f1], [help], and (char-to-string help-char) instead of "\C-h". + (Bug#6222) + +2010-05-20 Juri Linkov + + * isearch.el (isearch-yank-string): Use isearch-process-search-string. + (Bug#6223) + +2010-05-20 Juri Linkov + + * dired-x.el (dired-jump, dired-jump-other-window): Add arg + FILE-NAME to read from the minibuffer when called interactively + with prefix argument instead of using buffer-file-name. + http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00534.html + + * dired.el: Update autoloads. + +2010-05-20 Chong Yidong + + * nxml/nxml-mode.el (nxml-mode-map): Bind C-c / to + nxml-finish-element, for consistency with SGML mode. + + * progmodes/octave-mod.el (octave-mode-map): Bind C-c / to + octave-close-block. + +2010-05-20 Juanma Barranquero + + * composite.el: Require cl when compiling. + (reference-point-alist, compose-gstring-for-graphic) + (compose-gstring-for-terminal): Fix typos in docstrings. + +2010-05-19 Juri Linkov + + * emacs-lisp/cl-macs.el (window-parameter): Add defsetf with + set-window-parameter. + +2010-05-19 Michael Albinus + + * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute + where appropriate. + (tramp-maybe-open-connection): Use it. + +2010-05-19 Eli Zaretskii + + * simple.el (move-end-of-line): Make sure we are at line beginning + before backing up to end of previous line. + +2010-05-19 Michael Albinus + + * password-cache.el (password-cache-remove): Fix docstring. + + * net/secrets.el: Autoload the widget functions. + (secrets-search-items, secrets-create-item) + (secrets-get-attributes, secrets-expand-item): Attributes will be + stored on the password database without leading ":", as all other + clients do as well. + (secrets-mode): Fix docstring. + (secrets-show-secrets): Provide it as autoloaded command only when + D-Bus support is available. Check existence of Secret Service API. + +2010-05-19 Stefan Monnier + + * indent.el (indent-region): Deactivate region (bug#6200). + +2010-05-19 Glenn Morris + + * vc-dir.el (vc-dir): Don't pop-up-windows. (Bug#6204) + +2010-05-19 Kenichi Handa + + * composite.el: Register compose-gstring-for-graphic in + composition-function-table only for combining characters (Mn, Mc, Me). + +2010-05-18 Jay Belanger + + * calc/calc-trail.el (calc-trail-isearch-forward) + (calc-trail-isearch-backward): Ensure that the new window + point is set correctly. + +2010-05-18 Stefan Monnier + + * subr.el (read-quoted-char): Resolve modifiers after key + remapping (bug#6212). + +2010-05-18 Michael Albinus + + Add visualization code for secrets. + * net/secrets.el (secrets-mode): New major mode. + (secrets-show-secrets, secrets-show-collections) + (secrets-expand-collection, secrets-expand-item) + (secrets-tree-widget-after-toggle-function) + (secrets-tree-widget-show-password): New defuns. + +2010-05-18 Stefan Monnier + + * emacs-lisp/smie.el (smie-next-sexp): Break inf-loop at BOB. + (smie-backward-sexp, smie-forward-sexp): Remove boundary condition now + handled in smie-next-sexp. + (smie-indent-calculate): Provide a starting indentation (so the + recursion is well-founded ;-). + + Fix handling of non-associative equal levels. + * emacs-lisp/smie.el (smie-prec2-levels): Choose distinct levels even + when it's not needed. + (smie-op-left, smie-op-right): New functions. + (smie-next-sexp): New function, extracted from smie-backward-sexp. + Better handle equal levels to distinguish the associative case from + the "multi-keyword construct" case. + (smie-backward-sexp, smie-forward-sexp): Use it. + +2010-05-18 Juanma Barranquero + + * progmodes/prolog.el (smie-indent-basic): Declare for byte-compiler. + + * emacs-lisp/smie.el (smie-precs-precedence-table, smie-backward-sexp) + (smie-forward-sexp, smie-indent-calculate): Fix typos in docstrings. + +2010-05-17 Stefan Monnier + + Provide a simple generic indentation engine and use it for Prolog. + * emacs-lisp/smie.el: New file. + * progmodes/prolog.el (prolog-smie-op-levels) + (prolog-smie-indent-rules): New var. + (prolog-mode-variables): Use them to configure SMIE. + (prolog-indent-line, prolog-indent-level): Remove. + +2010-05-17 Jay Belanger + + * calc/calc-vec.el (math-vector-avg): Put the vector elements in + order before computing the averages. + +2010-05-16 Jay Belanger + + * calc/calc-vec.el (calc-histogram): + (calcFunc-histogram): Allow vectors as inputs. + (math-vector-avg): New function. + + * calc/calc-ext.el (math-group-float): Have the number of digits + being grouped depend on the radix (Bug#6189). + +2010-05-15 Ken Raeburn + + * version.el (emacs-copyright, emacs-version): Don't define here, + now that emacs.c defines it. + +2010-05-15 Eli Zaretskii + + * international/mule-cmds.el (mule-menu-keymap): Fix definition of + "Describe Language Environment" menu item. + + * language/hebrew.el ("Hebrew", "Windows-1255"): Doc fix. + + Bidi-sensitive movement with arrow keys. + * subr.el (right-arrow-command, left-arrow-command): New functions. + + * bindings.el (global-map): Bind them to right and left arrow keys. + + Don't override standard definition of convert-standard-filename. + * files.el (convert-standard-filename): + Call w32-convert-standard-filename and dos-convert-standard-filename on + the corresponding systems. + + * w32-fns.el (w32-convert-standard-filename): Rename from + convert-standard-filename. Doc fix. + + * dos-fns.el (dos-convert-standard-filename): Doc fix. + (convert-standard-filename): Don't defalias. + (register-name-alist, make-register, register-value) + (set-register-value, intdos): Obsolete aliases for the + corresponding dos-* functions and variables. + (dos-intdos): Add a doc string. + +2010-05-15 Jay Belanger + + * calc/calc-aent.el (math-read-token, math-find-user-tokens): + * calc/calc-lang.el (math-read-big-rec, math-lang-read-symbol): + (math-compose-tex-func): + * calc/calccomp.el (math-compose-expr): + * calc/calc-ext.el (math-format-flat-expr-fancy): + * calc/calc-store.el (calc-read-var-name): + * calc/calc-units.el (calc-explain-units-rec): Allow Greek letters. + + * calc/calc.el (var-π, var-φ, var-γ): New variables. + * calc/calc-aent.el (math-read-replacement-list): Add "micro" symbol. + * calc/calc-units.el (math-unit-prefixes): Add mu for micro. + (math-standard-units): Add units. + +2010-05-15 Stefan Monnier + + * progmodes/asm-mode.el (asm-mode): + * progmodes/prolog.el (prolog-mode): Use define-derived-mode. + + * pcomplete.el (pcomplete-completions-at-point): New function, + extracted from pcomplete-std-complete. + (pcomplete-std-complete): Use it. + +2010-05-15 Glenn Morris + + * Makefile.in (setwins, setwins_almost, setwins_for_subdirs): + Remove references to CVS, RCS and Old directories. + +2010-05-14 Jay Belanger + + * calc/calc-bin.el (math-format-twos-complement): Group digits when + appropriate. + +2010-05-14 Stefan Monnier + + * progmodes/sh-script.el (sh-mode-default-syntax-table): Remove. + (sh-mode-syntax-table): Give it a default value instead. + (sh-header-marker): Make buffer-local. + (sh-mode): Move make-local-variable to the corresponding setq. + (sh-add-completer): Avoid gratuitously let-binding a buffer-local var. + Use complete-with-action. + + * simple.el (prog-mode): New (abstract) major mode. + * emacs-lisp/lisp-mode.el (emacs-lisp-mode, lisp-mode): Use it. + * progmodes/sh-script.el (sh-mode): Remove redundant var assignment. + +2010-05-14 Juanma Barranquero + + * progmodes/sql.el (sql-oracle-program): Reflow docstring. + (sql-oracle-scan-on, sql-sybase-program, sql-product-font-lock) + (sql-add-product-keywords, sql-highlight-product, sql-set-product) + (sql-make-alternate-buffer-name, sql-placeholders-filter) + (sql-escape-newlines-filter, sql-input-sender) + (sql-send-magic-terminator, sql-sybase): Fix typos in docstrings. + +2010-05-13 Chong Yidong + + Add TeX open-block and close-block keybindings to SGML, and vice versa. + + * textmodes/tex-mode.el (tex-mode-map): Bind C-c C-t to + latex-open-block and C-c / to latex-close-block. + + * textmodes/sgml-mode.el (sgml-mode-map): Bind C-c C-o to sgml-tag + and C-c C-e to sgml-close-tag. + +2010-05-13 Michael Albinus + + * net/tramp.el (with-progress-reporter): Create reporter object + only when the message would be displayed. Handle nested calls. + (tramp-handle-load, tramp-handle-file-local-copy) + (tramp-handle-insert-file-contents, tramp-handle-write-region) + (tramp-maybe-send-script, tramp-find-shell): + Use `with-progress-reporter'. + (tramp-handle-dired-compress-file, tramp-maybe-open-connection): + Fix message text. + + * net/tramp-smb.el (tramp-smb-handle-copy-file) + (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) + (tramp-smb-handle-write-region, tramp-smb-maybe-open-connection): + Use `with-progress-reporter'. + +2010-05-13 Agustín Martín + + * textmodes/ispell.el (ispell-init-process): Do not kill ispell + process everytime when spellchecking from the minibuffer (bug#6143). + +2010-05-13 Stefan Monnier + + * progmodes/sh-script.el (sh-mode): Use define-derived-mode. + + * dos-fns.el: Add "dos-" prefix for namespace control. + (convert-standard-filename): Define as alias for + dos-convert-standard-filename but only if applicable. + +2010-05-12 Alan Mackenzie + + * progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun): + Push the mark at the start of these functions when appropriate. + +2010-05-12 Stefan Monnier + + * minibuffer.el (completion-cycle-threshold): New custom var. + (completion--do-completion): Use it. + (minibuffer-complete): Use cycling if appropriate. + +2010-05-11 Juanma Barranquero + + * dirtrack.el (dirtrackp): Remove defcustom; don't make automatically + buffer-local (it's an obsolete alias for `dirtrack-mode') (bug#6173). + +2010-05-11 Juri Linkov + + * scroll-all.el (scroll-all-check-to-scroll): + Add `scroll-up-command' and `scroll-down-command' (bug#6164). + +2010-05-11 Stefan Monnier + + * iimage.el (iimage-mode-map): Move initialization into declaration. + (iimage-mode-buffer): Use with-silent-modifications. + Simplify calling convention. Adjust callers. + (iimage-mode): Don't run hook redundantly. + + * minibuffer.el (completion-pcm--pattern->regex): + Fix last change (bug#6160). + +2010-05-10 Juri Linkov + + Remove nodes visited during Isearch from the Info history. + * info.el (Info-isearch-initial-history) + (Info-isearch-initial-history-list): New variables. + (Info-isearch-start): Record initial values of + Info-isearch-initial-history and Info-isearch-initial-history-list. + Add Info-isearch-end to isearch-mode-end-hook. + (Info-isearch-end): New function. + +2010-05-10 Michael Albinus + + * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in + format string, in order to work around a bug in pdksh. + Reported by Gilles Pion . + (tramp-handle-verify-visited-file-modtime): Do not send a command + when the connection is not established. + (tramp-handle-set-file-times): Simplify the check for utc. + +2010-05-10 Juanma Barranquero + + Fix use of `filter-buffer-substring' (rework previous change). + * emulation/cua-base.el (cua--filter-buffer-noprops): New function. + (cua-repeat-replace-region): + * emulation/cua-rect.el (cua--extract-rectangle, cua-incr-rectangle): + * emulation/cua-gmrk.el (cua-copy-region-to-global-mark) + (cua-cut-region-to-global-mark): Use it. + +2010-05-09 Michael R. Mauger + + * progmodes/sql.el: Version 2.1. + (sql-product-alist): Redesign structure of product info. + (sql-product, sql-user, sql-server, sql-database): Safe variables. + (sql-port, sql-port-history): New variables. + (sql-interactive-product): New variable. + (sql-send-terminator): New variable. + (sql-imenu-generic-expression): Add "Types" imenu entry. + (sql-oracle-login-params, sql-sqlite-login-params) + (sql-mysql-login-params, sql-solid-login-params) + (sql-sybase-login-params, sql-informix-login-params) + (sql-ingres-login-params, sql-ms-login-params) + (sql-postgres-login-params, sql-interbase-login-params) + (sql-db2-login-params, sql-linter-login-params) + (sql-oracle-scan-on): New variables. + (sql-mode-map): Add C-c C-i to start interactive mode. + (sql-mode-menu): Update existing menu entries. + (sql-font-lock-keywords-builder): Compile-time font-lock optimization. + (sql-mode-oracle-font-lock-keywords) + (sql-mode-postgres-font-lock-keywords) + (sql-mode-ms-font-lock-keywords) + (sql-mode-sybase-font-lock-keywords) + (sql-mode-informix-font-lock-keywords) + (sql-mode-interbase-font-lock-keywords) + (sql-mode-ingres-font-lock-keywords) + (sql-mode-solid-font-lock-keywords) + (sql-mode-mysql-font-lock-keywords) + (sql-mode-sqlite-font-lock-keywords) + (sql-mode-db2-font-lock-keywords) + (sql-mode-linter-font-lock-keywords): Update initialization to + reduce run-time complexity. + (sql-add-product, sql-del-product): New functions. + (sql-set-product-feature, sql-get-product-feature): New functions. + (sql-product-font-lock): Update product API. + (sql-add-product-keywords): New function. + (sql-highlight-product): Update product API. + (sql-help-list-products): New function. + (sql-help): Dynamically lists free and non-free products. + (sql-get-login): Correct bug in handling history and added + prompt for port. + (sql-copy-column): Copy without properties. + (sqli-input-sender): Apply filters to SQLi input. + (sql-query-placeholders-and-send): Obey `sql-oracle-scan-on' setting. + Implement as a filter. + (sql-escape-newlines-filter): Implement as a filter. + (sql-remove-tabs-filter): New function. + (sql-send-magic-terminator): New function. + (sql-send-string): Implement magic terminator. + (sql-send-region): Use `sql-send-string'. + (sql-interactive-mode): Use product API. + (sql-product-interactive): Use product API. + (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql) + (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase) + (sql-db2, sql-linter): Use `sql-product-interactive'. + (sql-connect): New function. + (sql-connect-oracle, sql-connect-sybase, sql-connect-informix) + (sql-connect-sqlite, sql-connect-mysql, sql-connect-solid) + (sql-connect-ingres, sql-connect-ms, sql-connect-postgres) + (sql-connect-interbase, sql-connect-db2, sql-connect-linter): + Use `sql-connect'. + +2010-05-09 Stefan Monnier + + * minibuffer.el (completion-pcm-complete-word-inserts-delimiters): + New custom variable. + (completion-pcm--string->pattern): Use it. + (completion-pcm--pattern->regex, completion-pcm--pattern->string): + Make it handle any symbol as `any'. + (completion-pcm--merge-completions): Extract common suffix for the new + `prefix' symbol as well. + (completion-substring--all-completions): Use the new `prefix' symbol. + +2010-05-09 Michael Albinus + + * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if + not bound. + (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT. + (tramp-compat-funcall): New defmacro. + (tramp-compat-line-beginning-position) + (tramp-compat-line-end-position) + (tramp-compat-temporary-file-directory) + (tramp-compat-make-temp-file, tramp-compat-file-attributes) + (tramp-compat-copy-file, tramp-compat-copy-directory) + (tramp-compat-delete-file, tramp-compat-delete-directory) + (tramp-compat-number-sequence, tramp-compat-process-running-p) + * net/tramp.el (top, with-progress-reporter) + (tramp-rfn-eshadow-setup-minibuffer) + (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times) + (tramp-handle-dired-compress-file, tramp-handle-shell-command) + (tramp-completion-mode-p, tramp-check-for-regexp) + (tramp-open-connection-setup-interactive-shell) + (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd) + (tramp-time-diff, tramp-coding-system-change-eol-conversion) + (tramp-set-process-query-on-exit-flag, tramp-unload-tramp) + * net/tramp-cmds.el (tramp-cleanup-all-connections) + (tramp-reporter-dump-variable, tramp-load-report-modules) + (tramp-append-tramp-buffers) + * net/tramp-gvfs.el (tramp-gvfs-handle-file-selinux-context): Use it. + + * net/tramp-imap.el (top): Autoload `epg-make-context'. + +2010-05-08 Stefan Monnier + + * progmodes/compile.el (compilation-buffer-modtime): Rename from + buffer-modtime. Adjust users. + +2010-05-08 Chong Yidong + + * international/mule.el (auto-coding-alist): Only purecopy + car of each item, not the whole list (Bug#6083). + +2010-05-08 Chong Yidong + + * progmodes/js.el (js-mode): Make paragraph variables local before + calling c-setup-paragraph-variables (Bug#6071). + +2010-05-08 Eli Zaretskii + + * composite.el (compose-region, reference-point-alist): Fix typos + in the doc strings. + +2010-05-08 Alexander Klimov (tiny change) + + * calc/calc-graph.el (calc-graph-plot): Use the proper form for + gnuplot's "set" command. + +2010-05-08 Juanma Barranquero + + * abbrev.el (last-abbrev-text): Doc fix. + (abbrev-prefix-mark): Don't escape parenthesis. + +2010-05-08 Andreas Schwab + + * composite.el (find-composition): Doc fix. + +2010-05-08 Juanma Barranquero + + * progmodes/sql.el (sql-electric-stuff): Fix typo in tag. + (sql-oracle-program, sql-sqlite-options) + (sql-query-placeholders-and-send): Doc fixes. + (sql-set-product, sql-interactive-mode): Reflow docstrings. + (sql-imenu-generic-expression, sql-buffer) + (sql-mode-ansi-font-lock-keywords, sql-mode-oracle-font-lock-keywords) + (sql-mode-postgres-font-lock-keywords, sql-mode-ms-font-lock-keywords) + (sql-mode-sybase-font-lock-keywords) + (sql-mode-informix-font-lock-keywords) + (sql-mode-interbase-font-lock-keywords) + (sql-mode-ingres-font-lock-keywords, sql-mode-solid-font-lock-keywords) + (sql-mode-mysql-font-lock-keywords, sql-mode-sqlite-font-lock-keywords) + (sql-mode-db2-font-lock-keywords, sql-mode-font-lock-keywords) + (sql-product-feature, sql-highlight-product) + (comint-line-beginning-position, sql-rename-buffer) + (sql-toggle-pop-to-buffer-after-send-region sql-oracle) + (sql-sybase, sql-informix, sql-sqlite, sql-mysql, sql-solid) + (sql-ingres, sql-ms, sql-postgres, sql-interbase, sql-db2, sql-linter): + Fix typos in docstrings. + +2010-05-08 Juri Linkov + + * info.el (Info-fontify-node): Put Info-breadcrumbs to the `display' + property instead of `invisible' and `after-string' (bug#5998). + +2010-05-08 Juri Linkov + + * image-mode.el (image-mode-as-text): Fix typo in docstring. + +2010-05-08 Juanma Barranquero + + * filecache.el (file-cache-add-directory-list) + (file-cache-add-directory-recursively): Fix typos in docstrings. + +2010-05-08 Kenichi Handa + + * language/indian.el (gurmukhi-composable-pattern): Fix typo. + (gujarati-composable-pattern): Fix typo. + +2010-05-08 Kenichi Handa + + * language/indian.el (oriya-composable-pattern) + (tamil-composable-pattern, malayalam-composable-pattern): + Add two-part vowels to "v" (vowel sign). + +2010-05-08 Chong Yidong + + * files.el (copy-directory): Handle symlinks (Bug#5982). + +2010-05-08 Dan Nicolaescu + + * vc-hg.el (vc-hg-state): Use HGRCPATH, not HGRC. + (vc-hg-working-revision): Likewise. Use hg parents, not hg parent + (Bug#5846). + +2010-05-08 Glenn Morris + + * emacs-lisp/lisp.el (lisp-completion-at-point): Give it a doc string. + + * minibuffer.el (completion-at-point): Doc fix. + +2010-05-08 Stefan Monnier + + * electric.el (Electric-command-loop): Minor tweak. + + * ebuff-menu.el (electric-buffer-list): Try and make it behave a bit + better with dedicated windows. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-07 Deniz Dogan (tiny change) + Stefan Monnier + + Highlight vendor specific properties. + * textmodes/css-mode.el (css-proprietary-nmstart-re): New var. + (css-proprietary-property): New face. + (css-font-lock-keywords): Use them. + +2010-05-07 Eli Zaretskii -2010-08-26 Magnus Henoch + * cus-start.el (all): Add native condition for tool-bar-* symbols. - * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass - empty argument to gvfs-copy. +2010-05-07 Stefan Monnier -2010-08-26 Chong Yidong + * textmodes/dns-mode.el (auto-mode-alist): Add entry for .zone files. + * files.el (auto-mode-alist): Remove redundant entries. - * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to - handle new TRASH arg of `delete-file'. + * files.el (auto-save-mode): Move to simple.el to fix bootstrap. + * simple.el (auto-save-mode): Move from files.el. + * minibuffer.el (completion--common-suffix): Fix copy&paste error. -2010-08-26 Christian Lynbech (tiny change) +2010-05-07 Christian von Roques (tiny change) - * net/tramp.el (tramp-handle-insert-directory): Don't use - `forward-word', its default syntax could be changed. + * epg.el (epg-key-capablity-alist): Add "D" flag (Bug#5592). -2010-08-26 Toru TSUNEYOSHI +2010-05-07 Katsumi Yamaoka + + * mail/binhex.el (binhex-decode-region-internal) + * mail/uudecode.el (uudecode-decode-region-internal) + * net/dns.el (dns-read-string-name, dns-write, dns-read) + (dns-read-type, dns-query) + * pgg-parse.el (pgg-parse-armor) + * pgg.el (pgg-verify-region) + * sha1.el (sha1-string-external): Don't run set-buffer-multibyte for + XEmacs. + + * net/imap.el (imap-disable-multibyte): Redefine it as a macro. + +2010-05-07 Juanma Barranquero + + * progmodes/cperl-mode.el (cperl-mode-unload-function): New function. + + Fix use of `filter-buffer-substring' (4th arg NOPROPS removed). + * emulation/cua-base.el (cua-repeat-replace-region): + * emulation/cua-gmrk.el (cua-copy-region-to-global-mark) + (cua-cut-region-to-global-mark): + Remove text properties with `set-text-properties'. + +2010-05-06 Michael Albinus + + * net/tramp.el (top, with-progress-reporter): + Use `symbol-function' inside `funcall'. + + * net/tramp-compat.el (tramp-compat-file-attributes) + (tramp-compat-delete-file, tramp-compat-delete-directory): + Handle only `wrong-number-of-arguments' error. + + * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Fix typo. + (tramp-gvfs-handle-file-selinux-context): Use `symbol-function' + inside `funcall'. + +2010-05-06 Stefan Monnier + + * minibuffer.el (completion--sreverse, completion--common-suffix): + New functions. + (completion-pcm--merge-completions): Extract common suffix when safe. + + * emacs-lisp/easy-mmode.el (define-minor-mode): + Make :variable more flexible. + * files.el (auto-save-mode): Use it to define using define-minor-mode. + +2010-05-05 Juri Linkov + + Add `slow' and `history' tags to the desktop data. + + * info.el (Info-virtual-nodes) [*Index*]: Add `slow' tag. + (Info-virtual-files) [*Apropos*]: Add `slow' tag. + (Info-finder-find-node): Require `finder.el' to be able + to restore node from the desktop. + (Info-desktop-buffer-misc-data): Save all nodes. Save additional + data `Info-history' and `slow' tag in the assoc list. + (Info-restore-desktop-buffer): Don't restore nodes with the + `slow' tag. Restore `Info-history'. + +2010-05-05 Michael Albinus + + Add FORCE argument to `delete-file'. + + * net/ange-ftp.el (ange-ftp-del-tmp-name): Make it a defun, + forcing to delete the temporary file. + (ange-ftp-delete-file): Add FORCE arg. + (ange-ftp-rename-remote-to-remote) + (ange-ftp-rename-local-to-remote, ange-ftp-rename-remote-to-local) + (ange-ftp-load, ange-ftp-compress, ange-ftp-uncompress): + Force file deletion. + + * net/tramp-compat.el (tramp-compat-delete-file): New defun. + + * net/tramp.el (tramp-handle-delete-file): Add FORCE arg. + (tramp-handle-make-symbolic-link, tramp-handle-load) + (tramp-do-copy-or-rename-file-via-buffer) + (tramp-do-copy-or-rename-file-directly) + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-handle-process-file, tramp-handle-call-process-region) + (tramp-handle-shell-command, tramp-handle-file-local-copy) + (tramp-handle-insert-file-contents, tramp-handle-write-region) + (tramp-delete-temp-file-function): Use `tramp-compat-delete-file'. + + * net/tramp-fish.el (tramp-fish-handle-delete-file): Add FORCE arg. + (tramp-fish-handle-make-symbolic-link) + (tramp-fish-handle-process-file): Use `tramp-compat-delete-file'. + + * net/tramp-ftp.el (tramp-ftp-file-name-handler): + Use `tramp-compat-delete-file'. + + * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Add FORCE arg. + (tramp-gvfs-handle-write-region): Use `tramp-compat-delete-file'. + + * net/tramp-imap.el (tramp-imap-handle-delete-file): Add FORCE arg. + (tramp-imap-do-copy-or-rename-file): Use `tramp-compat-delete-file'. + + * net/tramp-smb.el (tramp-smb-handle-delete-file): Add FORCE arg. + (tramp-smb-handle-copy-file, tramp-smb-handle-file-local-copy) + (tramp-smb-handle-rename-file, tramp-smb-handle-write-region): + Use `tramp-compat-delete-file'. + +2010-05-05 Stefan Monnier + + Minor cleanups. + * subr.el (add-minor-mode): Use push. + * mail/supercite.el (sc-electric-mode): Use more descriptive arg name. + * emulation/edt.el (edt-select-mode): Simplify. + + Use define-minor-mode in more cases. + * term/tvi970.el (tvi970-set-keypad-mode): + * simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode) + (normal-erase-is-backspace-mode): + * scroll-bar.el (scroll-bar-mode): Use it and define-minor-mode. + (set-scroll-bar-mode-1): (Re)move to its sole caller. + (get-scroll-bar-mode): New function. + * emacs-lisp/cl-macs.el (eq): Handle a non-variable first arg. + + Use define-minor-mode for less obvious cases. + * emacs-lisp/easy-mmode.el (define-minor-mode): Add :variable keyword. + * emacs-lisp/cl-macs.el (terminal-parameter, eq): Add setf method. + * international/iso-ascii.el (iso-ascii-mode): + * frame.el (auto-raise-mode, auto-lower-mode): + * composite.el (global-auto-composition-mode): Use define-minor-mode. + +2010-05-04 Michael Albinus + + * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args' + in order to see error messages for failed logins. + +2010-05-03 Chong Yidong + + * diff.el (diff-sentinel): + + * epg.el (epg--make-temp-file, epg-decrypt-string) + (epg-verify-string, epg-sign-string, epg-encrypt-string): + + * jka-compr.el (jka-compr-partial-uncompress) + (jka-compr-call-process, jka-compr-write-region, jka-compr-load): + + * server.el (server-sentinel): Use delete-file's new FORCE arg + (Bug#6070). + +2010-05-03 Stefan Monnier + + Use define-minor-mode where applicable. + * view.el (view-mode): + * type-break.el (type-break-query-mode) + (type-break-mode-line-message-mode): + * textmodes/reftex.el (reftex-mode): + * term/vt100.el (vt100-wide-mode): + * tar-mode.el (tar-subfile-mode): + * savehist.el (savehist-mode): + * ibuf-ext.el (ibuffer-auto-mode): + * composite.el (auto-composition-mode): + * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode): + Use define-minor-mode. + (vhdl-mode): Use static mode-line format. + (vhdl-mode-line-update): Delete. + (vhdl-create-mode-menu, vhdl-activate-customizations) + (vhdl-hs-minor-mode): Don't bother calling it. + +2010-05-02 Stefan Monnier + + * simple.el (with-wrapper-hook): Move. + (buffer-substring-filters): Mark obsolete. + (filter-buffer-substring-functions): New variable. + (filter-buffer-substring): Use it. Remove unused arg `noprops'. + +2010-05-01 Toru TSUNEYOSHI Michael Albinus Implement compression for inline methods. diff --cc lisp/dired.el index 8012fcb472d,08f2e28d05e..56030feae8b --- a/lisp/dired.el +++ b/lisp/dired.el @@@ -3557,7 -3532,7 +3558,7 @@@ Ask means pop up a menu for the user t ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff - ;;;;;; dired-diff) "dired-aux" "dired-aux.el" "1628b7a7d379fb4da8ae4bf29faad4b5") -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "03cf081d2aac54764123d2407c3196a2") ++;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2e8658304f56098052e312d01c8763a2") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ diff --cc lisp/mail/rmail.el index ffb52683bd7,3f5660e82cb..139b7cf926a --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@@ -4289,7 -4290,7 +4289,7 @@@ With prefix argument N moves forward N ;;;*** - ;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "ec0bed149baed671125f623e5b012f6f") -;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "222ca7c1e672a08e5799e5a72fb25049") ++;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "b1ce015fd919b54cc7b1d0b2155489f9") ;;; Generated autoloads from rmailmm.el (autoload 'rmail-mime "rmailmm" "\ diff --cc lisp/mouse.el index 40e0c14c064,243e7179678..aa5dadf84ff --- a/lisp/mouse.el +++ b/lisp/mouse.el @@@ -2130,5 -2602,11 +2132,4 @@@ choose a font. (provide 'mouse) - ;; arch-tag: 9a710ce1-914a-4923-9b81-697f7bf82ab3 -;; This file contains the functionality of the old mldrag.el. -(defalias 'mldrag-drag-mode-line 'mouse-drag-mode-line) -(defalias 'mldrag-drag-vertical-line 'mouse-drag-vertical-line) -(make-obsolete 'mldrag-drag-mode-line 'mouse-drag-mode-line "21.1") -(make-obsolete 'mldrag-drag-vertical-line 'mouse-drag-vertical-line "21.1") -(provide 'mldrag) - ;;; mouse.el ends here diff --cc lisp/net/tramp-sh.el index 1501868a6b5,00000000000..92f6c2a0335 mode 100644,000000..100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@@ -1,5038 -1,0 +1,5042 @@@ +;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections + +;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, +;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +;; (copyright statements below in code to be updated with the above notice) + +;; Author: Kai Großjohann +;; 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 . + +;;; Code: + +(eval-when-compile (require 'cl)) ; ignore-errors +(require 'tramp) +(require 'shell) + +;; Pacify byte-compiler. The function is needed on XEmacs only. I'm +;; not sure at all that this is the right way to do it, but let's hope +;; it works for now, and wait for a guru to point out the Right Way to +;; achieve this. +;;(eval-when-compile +;; (unless (fboundp 'dired-insert-set-properties) +;; (fset 'dired-insert-set-properties 'ignore))) +;; Gerd suggests this: +(eval-when-compile (require 'dired)) +;; Note that dired is required at run-time, too, when it is needed. +;; It is only needed on XEmacs for the function +;; `dired-insert-set-properties'. + +(defcustom tramp-inline-compress-start-size 4096 + "*The minimum size of compressing where inline transfer. +When inline transfer, compress transfered data of file +whose size is this value or above (up to `tramp-copy-size-limit'). +If it is nil, no compression at all will be applied." + :group 'tramp + :type '(choice (const nil) integer)) + +(defcustom tramp-copy-size-limit 10240 + "*The maximum file size where inline copying is preferred over an out-of-the-band copy. +If it is nil, inline out-of-the-band copy will be used without a check." + :group 'tramp + :type '(choice (const nil) integer)) + +;;;###tramp-autoload +(defcustom tramp-terminal-type "dumb" + "*Value of TERM environment variable for logging in to remote host. +Because Tramp wants to parse the output of the remote shell, it is easily +confused by ANSI color escape sequences and suchlike. Often, shell init +files conditionalize this setup based on the TERM environment variable." + :group 'tramp + :type 'string) + +;; ksh on OpenBSD 4.5 requires, that $PS1 contains a `#' character for +;; root users. It uses the `$' character for other users. In order +;; to guarantee a proper prompt, we use "#$" for the prompt. + +(defvar tramp-end-of-output + (format + "///%s#$" + (md5 (concat (prin1-to-string process-environment) (current-time-string)))) + "String used to recognize end of output. +The '$' character at the end is quoted; the string cannot be +detected as prompt when being sent on echoing hosts, therefore.") + +;;;###tramp-autoload +(defconst tramp-initial-end-of-output "#$ " + "Prompt when establishing a connection.") + +;; Initialize `tramp-methods' with the supported methods. +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("rcp" + (tramp-login-program "rsh") + (tramp-login-args (("%h") ("-l" "%u"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "rcp") + (tramp-copy-args (("%k" "-p") ("-r"))) + (tramp-copy-keep-date t) + (tramp-copy-recursive t))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("remcp" + (tramp-login-program "remsh") + (tramp-login-args (("%h") ("-l" "%u"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "rcp") + (tramp-copy-args (("%k" "-p"))) + (tramp-copy-keep-date t))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("scp" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "scp") + (tramp-copy-args (("-P" "%p") ("%k" "-p") ("-q") ("-r"))) + (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-autoload +(add-to-list 'tramp-methods + '("scp1" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-1") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "scp") + (tramp-copy-args (("-1") ("-P" "%p") ("%k" "-p") ("-q") ("-r"))) + (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-autoload +(add-to-list 'tramp-methods + '("scp2" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-2") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "scp") + (tramp-copy-args (("-2") ("-P" "%p") ("%k" "-p") ("-q") ("-r"))) + (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-autoload +(add-to-list 'tramp-methods + '("scpc" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-o" "ControlPath=%t.%%r@%%h:%%p") + ("-o" "ControlMaster=yes") + ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "scp") + (tramp-copy-args (("-P" "%p") ("%k" "-p") ("-q") + ("-o" "ControlPath=%t.%%r@%%h:%%p") + ("-o" "ControlMaster=auto"))) + (tramp-copy-keep-date t) + (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") + ("-o" "UserKnownHostsFile=/dev/null") + ("-o" "StrictHostKeyChecking=no"))) + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("scpx" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("-t" "-t") + ("%h") ("/bin/sh"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "scp") + (tramp-copy-args (("%k" "-p"))) + (tramp-copy-keep-date t) + (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") + ("-o" "UserKnownHostsFile=/dev/null") + ("-o" "StrictHostKeyChecking=no"))) + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("sftp" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "sftp"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("rsync" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "rsync") + (tramp-copy-args (("-e" "ssh") ("%k" "-t") ("-r"))) + (tramp-copy-keep-date t) + (tramp-copy-keep-tmpfile t) + (tramp-copy-recursive t))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + `("rsyncc" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-o" "ControlPath=%t.%%r@%%h:%%p") + ("-o" "ControlMaster=yes") + ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "rsync") + (tramp-copy-args (("%k" "-t") ("-r"))) + (tramp-copy-env (("RSYNC_RSH") + (,(concat + "ssh" + " -o ControlPath=%t.%%r@%%h:%%p" + " -o ControlMaster=auto")))) + (tramp-copy-keep-date t) + (tramp-copy-keep-tmpfile t) + (tramp-copy-recursive t))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("rsh" + (tramp-login-program "rsh") + (tramp-login-args (("%h") ("-l" "%u"))) + (tramp-remote-sh "/bin/sh"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("remsh" + (tramp-login-program "remsh") + (tramp-login-args (("%h") ("-l" "%u"))) + (tramp-remote-sh "/bin/sh"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("ssh" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") + ("-o" "UserKnownHostsFile=/dev/null") + ("-o" "StrictHostKeyChecking=no"))) + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("ssh1" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-1") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") + ("-o" "UserKnownHostsFile=/dev/null") + ("-o" "StrictHostKeyChecking=no"))) + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("ssh2" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-2") ("-e" "none") ("%h"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") + ("-o" "UserKnownHostsFile=/dev/null") + ("-o" "StrictHostKeyChecking=no"))) + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("sshx" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("-t" "-t") + ("%h") ("/bin/sh"))) + (tramp-async-args (("-q"))) + (tramp-remote-sh "/bin/sh") + (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") + ("-o" "UserKnownHostsFile=/dev/null") + ("-o" "StrictHostKeyChecking=no"))) + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("telnet" + (tramp-login-program "telnet") + (tramp-login-args (("%h") ("%p"))) + (tramp-remote-sh "/bin/sh") + (tramp-default-port 23))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("su" + (tramp-login-program "su") + (tramp-login-args (("-") ("%u"))) + (tramp-remote-sh "/bin/sh"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("sudo" + (tramp-login-program "sudo") + (tramp-login-args (("-u" "%u") ("-s") ("-H") ("-p" "Password:"))) + (tramp-remote-sh "/bin/sh"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("krlogin" + (tramp-login-program "krlogin") + (tramp-login-args (("%h") ("-l" "%u") ("-x"))) + (tramp-remote-sh "/bin/sh"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("plink" + (tramp-login-program "plink") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) + (tramp-remote-sh "/bin/sh") + (tramp-password-end-of-line "xy") ;see docstring for "xy" + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("plink1" + (tramp-login-program "plink") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-1" "-ssh") ("%h"))) + (tramp-remote-sh "/bin/sh") + (tramp-password-end-of-line "xy") ;see docstring for "xy" + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + `("plinkx" + (tramp-login-program "plink") + ;; ("%h") must be a single element, see + ;; `tramp-compute-multi-hops'. + (tramp-login-args (("-load") ("%h") ("-t") + (,(format + "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" + tramp-terminal-type + tramp-initial-end-of-output)) + ("/bin/sh"))) + (tramp-remote-sh "/bin/sh"))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("pscp" + (tramp-login-program "plink") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "pscp") + (tramp-copy-args (("-P" "%p") ("-scp") ("%k" "-p") + ("-q") ("-r"))) + (tramp-copy-keep-date t) + (tramp-copy-recursive t) + (tramp-password-end-of-line "xy") ;see docstring for "xy" + (tramp-default-port 22))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("psftp" + (tramp-login-program "plink") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) + (tramp-remote-sh "/bin/sh") + (tramp-copy-program "pscp") + (tramp-copy-args (("-P" "%p") ("-sftp") ("%k" "-p") + ("-q") ("-r"))) + (tramp-copy-keep-date t) + (tramp-copy-recursive t) + (tramp-password-end-of-line "xy"))) ;see docstring for "xy" +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("fcp" + (tramp-login-program "fsh") + (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i"))) + (tramp-remote-sh "/bin/sh -i") + (tramp-copy-program "fcp") + (tramp-copy-args (("%k" "-p"))) + (tramp-copy-keep-date t))) + +(add-to-list 'tramp-default-method-alist + `(,tramp-local-host-regexp "\\`root\\'" "su")) + +(add-to-list 'tramp-default-user-alist + '("\\`su\\(do\\)?\\'" nil "root")) +(add-to-list 'tramp-default-user-alist + `("\\`r\\(em\\)?\\(cp\\|sh\\)\\|telnet\\|plink1?\\'" + nil ,(user-login-name))) + +(defconst tramp-completion-function-alist-rsh + '((tramp-parse-rhosts "/etc/hosts.equiv") + (tramp-parse-rhosts "~/.rhosts")) + "Default list of (FUNCTION FILE) pairs to be examined for rsh methods.") + +(defconst tramp-completion-function-alist-ssh + '((tramp-parse-rhosts "/etc/hosts.equiv") + (tramp-parse-rhosts "/etc/shosts.equiv") + (tramp-parse-shosts "/etc/ssh_known_hosts") + (tramp-parse-sconfig "/etc/ssh_config") + (tramp-parse-shostkeys "/etc/ssh2/hostkeys") + (tramp-parse-sknownhosts "/etc/ssh2/knownhosts") + (tramp-parse-rhosts "~/.rhosts") + (tramp-parse-rhosts "~/.shosts") + (tramp-parse-shosts "~/.ssh/known_hosts") + (tramp-parse-sconfig "~/.ssh/config") + (tramp-parse-shostkeys "~/.ssh2/hostkeys") + (tramp-parse-sknownhosts "~/.ssh2/knownhosts")) + "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.") + +(defconst tramp-completion-function-alist-telnet + '((tramp-parse-hosts "/etc/hosts")) + "Default list of (FUNCTION FILE) pairs to be examined for telnet methods.") + +(defconst tramp-completion-function-alist-su + '((tramp-parse-passwd "/etc/passwd")) + "Default list of (FUNCTION FILE) pairs to be examined for su methods.") + +(defconst tramp-completion-function-alist-putty + '((tramp-parse-putty + "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions")) + "Default list of (FUNCTION REGISTRY) pairs to be examined for putty methods.") + +(tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh) +(tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh) +(tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "scpc" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "rsyncc" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) +(tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) +(tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "ssh1_old" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "ssh2_old" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "telnet" tramp-completion-function-alist-telnet) +(tramp-set-completion-function "su" tramp-completion-function-alist-su) +(tramp-set-completion-function "sudo" tramp-completion-function-alist-su) +(tramp-set-completion-function "krlogin" tramp-completion-function-alist-rsh) +(tramp-set-completion-function "plink" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "plink1" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "plinkx" tramp-completion-function-alist-putty) +(tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh) +(tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh) + +;; "getconf PATH" yields: +;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin +;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin +;; GNU/Linux (Debian, Suse): /bin:/usr/bin +;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! +;; IRIX64: /usr/bin +(defcustom tramp-remote-path + '(tramp-default-remote-path "/usr/sbin" "/usr/local/bin" + "/local/bin" "/local/freeware/bin" "/local/gnu/bin" + "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin") + "*List of directories to search for executables on remote host. +For every remote host, this variable will be set buffer local, +keeping the list of existing directories on that host. + +You can use `~' in this list, but when searching for a shell which groks +tilde expansion, all directory names starting with `~' will be ignored. + +`Default Directories' represent the list of directories given by +the command \"getconf PATH\". It is recommended to use this +entry on top of this list, because these are the default +directories for POSIX compatible commands. + +`Private Directories' are the settings of the $PATH environment, +as given in your `~/.profile'." + :group 'tramp + :type '(repeat (choice + (const :tag "Default Directories" tramp-default-remote-path) + (const :tag "Private Directories" tramp-own-remote-path) + (string :tag "Directory")))) + +(defcustom tramp-remote-process-environment + `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_ALL=C" + ,(format "TERM=%s" tramp-terminal-type) + "EMACS=t" ;; Deprecated. + ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) + "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" + "autocorrect=" "correct=") + + "*List of environment variables to be set on the remote host. + +Each element should be a string of the form ENVVARNAME=VALUE. An +entry ENVVARNAME= diables the corresponding environment variable, +which might have been set in the init files like ~/.profile. + +Special handling is applied to the PATH environment, which should +not be set here. Instead of, it should be set via `tramp-remote-path'." + :group 'tramp + :type '(repeat string)) + +(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 +matching the shell file name and ARGS is a string specifying the +arguments. + +This variable is only used when Tramp needs to start up another shell +for tilde expansion. The extra arguments should typically prevent the +shell from reading its init file." + :group 'tramp + ;; This might be the wrong way to test whether the widget type + ;; `alist' is available. Who knows the right way to test it? + :type (if (get 'alist 'widget-type) + '(alist :key-type string :value-type string) + '(repeat (cons string string)))) + +(defconst tramp-actions-before-shell + '((tramp-login-prompt-regexp tramp-action-login) + (tramp-password-prompt-regexp tramp-action-password) + (tramp-wrong-passwd-regexp tramp-action-permission-denied) + (shell-prompt-pattern tramp-action-succeed) + (tramp-shell-prompt-pattern tramp-action-succeed) + (tramp-yesno-prompt-regexp tramp-action-yesno) + (tramp-yn-prompt-regexp tramp-action-yn) + (tramp-terminal-prompt-regexp tramp-action-terminal) + (tramp-process-alive-regexp tramp-action-process-alive)) + "List of pattern/action pairs. +Whenever a pattern matches, the corresponding action is performed. +Each item looks like (PATTERN ACTION). + +The PATTERN should be a symbol, a variable. The value of this +variable gives the regular expression to search for. Note that the +regexp must match at the end of the buffer, \"\\'\" is implicitly +appended to it. + +The ACTION should also be a symbol, but a function. When the +corresponding PATTERN matches, the ACTION function is called.") + +(defconst tramp-actions-copy-out-of-band + '((tramp-password-prompt-regexp tramp-action-password) + (tramp-wrong-passwd-regexp tramp-action-permission-denied) + (tramp-copy-failed-regexp tramp-action-permission-denied) + (tramp-process-alive-regexp tramp-action-out-of-band)) + "List of pattern/action pairs. +This list is used for copying/renaming with out-of-band methods. + +See `tramp-actions-before-shell' for more info.") + +(defconst tramp-uudecode + "(echo begin 600 /tmp/tramp.$$; tail +2) | uudecode +cat /tmp/tramp.$$ +rm -f /tmp/tramp.$$" + "Shell function to implement `uudecode' to standard output. +Many systems support `uudecode -o /dev/stdout' or `uudecode -o -' +for this or `uudecode -p', but some systems don't, and for them +we have this shell function.") + +(defconst tramp-perl-file-truename + "%s -e ' +use File::Spec; +use Cwd \"realpath\"; + +sub recursive { + my ($volume, @dirs) = @_; + my $real = realpath(File::Spec->catpath( + $volume, File::Spec->catdir(@dirs), \"\")); + if ($real) { + my ($vol, $dir) = File::Spec->splitpath($real, 1); + return ($vol, File::Spec->splitdir($dir)); + } + else { + my $last = pop(@dirs); + ($volume, @dirs) = recursive($volume, @dirs); + push(@dirs, $last); + return ($volume, @dirs); + } +} + +$result = realpath($ARGV[0]); +if (!$result) { + my ($vol, $dir) = File::Spec->splitpath($ARGV[0], 1); + ($vol, @dirs) = recursive($vol, File::Spec->splitdir($dir)); + + $result = File::Spec->catpath($vol, File::Spec->catdir(@dirs), \"\"); +} + +if ($ARGV[0] =~ /\\/$/) { + $result = $result . \"/\"; +} + +print \"\\\"$result\\\"\\n\"; +' \"$1\" 2>/dev/null" + "Perl script to produce output suitable for use with `file-truename' +on the remote file system. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled.") + +(defconst tramp-perl-file-name-all-completions + "%s -e 'sub case { + my $str = shift; + if ($ARGV[2]) { + return lc($str); + } + else { + return $str; + } +} +opendir(d, $ARGV[0]) || die(\"$ARGV[0]: $!\\nfail\\n\"); +@files = readdir(d); closedir(d); +foreach $f (@files) { + if (case(substr($f, 0, length($ARGV[1]))) eq case($ARGV[1])) { + if (-d \"$ARGV[0]/$f\") { + print \"$f/\\n\"; + } + else { + print \"$f\\n\"; + } + } +} +print \"ok\\n\" +' \"$1\" \"$2\" \"$3\" 2>/dev/null" + "Perl script to produce output suitable for use with +`file-name-all-completions' on the remote file system. Escape +sequence %s is replaced with name of Perl binary. This string is +passed to `format', so percent characters need to be doubled.") + +;; Perl script to implement `file-attributes' in a Lisp `read'able +;; output. If you are hacking on this, note that you get *no* output +;; unless this spits out a complete line, including the '\n' at the +;; end. +;; The device number is returned as "-1", because there will be a virtual +;; device number set in `tramp-sh-handle-file-attributes'. +(defconst tramp-perl-file-attributes + "%s -e ' +@stat = lstat($ARGV[0]); +if (!@stat) { + print \"nil\\n\"; + exit 0; +} +if (($stat[2] & 0170000) == 0120000) +{ + $type = readlink($ARGV[0]); + $type = \"\\\"$type\\\"\"; +} +elsif (($stat[2] & 0170000) == 040000) +{ + $type = \"t\"; +} +else +{ + $type = \"nil\" +}; +$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; +$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; +printf( + \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) -1)\\n\", + $type, + $stat[3], + $uid, + $gid, + $stat[8] >> 16 & 0xffff, + $stat[8] & 0xffff, + $stat[9] >> 16 & 0xffff, + $stat[9] & 0xffff, + $stat[10] >> 16 & 0xffff, + $stat[10] & 0xffff, + $stat[7], + $stat[2], + $stat[1] >> 16 & 0xffff, + $stat[1] & 0xffff +);' \"$1\" \"$2\" 2>/dev/null" + "Perl script to produce output suitable for use with `file-attributes' +on the remote file system. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled.") + +(defconst tramp-perl-directory-files-and-attributes + "%s -e ' +chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), exit(); +opendir(DIR,\".\") or printf(\"\\\"Cannot open directory $ARGV[0]: $''!''\\\"\\n\"), exit(); +@list = readdir(DIR); +closedir(DIR); +$n = scalar(@list); +printf(\"(\\n\"); +for($i = 0; $i < $n; $i++) +{ + $filename = $list[$i]; + @stat = lstat($filename); + if (($stat[2] & 0170000) == 0120000) + { + $type = readlink($filename); + $type = \"\\\"$type\\\"\"; + } + elsif (($stat[2] & 0170000) == 040000) + { + $type = \"t\"; + } + else + { + $type = \"nil\" + }; + $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; + $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; + printf( + \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) (%%u . %%u))\\n\", + $filename, + $type, + $stat[3], + $uid, + $gid, + $stat[8] >> 16 & 0xffff, + $stat[8] & 0xffff, + $stat[9] >> 16 & 0xffff, + $stat[9] & 0xffff, + $stat[10] >> 16 & 0xffff, + $stat[10] & 0xffff, + $stat[7], + $stat[2], + $stat[1] >> 16 & 0xffff, + $stat[1] & 0xffff, + $stat[0] >> 16 & 0xffff, + $stat[0] & 0xffff); +} +printf(\")\\n\");' \"$1\" \"$2\" 2>/dev/null" + "Perl script implementing `directory-files-attributes' as Lisp `read'able +output. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled.") + +;; These two use base64 encoding. +(defconst tramp-perl-encode-with-module + "%s -MMIME::Base64 -0777 -ne 'print encode_base64($_)' 2>/dev/null" + "Perl program to use for encoding a file. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled. +This implementation requires the MIME::Base64 Perl module to be installed +on the remote host.") + +(defconst tramp-perl-decode-with-module + "%s -MMIME::Base64 -0777 -ne 'print decode_base64($_)' 2>/dev/null" + "Perl program to use for decoding a file. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled. +This implementation requires the MIME::Base64 Perl module to be installed +on the remote host.") + +(defconst tramp-perl-encode + "%s -e ' +# This script contributed by Juanma Barranquero . +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. +use strict; + +my %%trans = do { + my $i = 0; + map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)} + split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/); +}; + +binmode(\\*STDIN); + +# We read in chunks of 54 bytes, to generate output lines +# of 72 chars (plus end of line) +$/ = \\54; + +while (my $data = ) { + my $pad = q(); + + # Only for the last chunk, and only if did not fill the last three-byte packet + if (eof) { + my $mod = length($data) %% 3; + $pad = q(=) x (3 - $mod) if $mod; + } + + # Not the fastest method, but it is simple: unpack to binary string, split + # by groups of 6 bits and convert back from binary to byte; then map into + # the translation table + print + join q(), + map($trans{$_}, + (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)), + $pad, + qq(\\n); +}' 2>/dev/null" + "Perl program to use for encoding a file. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled.") + +(defconst tramp-perl-decode + "%s -e ' +# This script contributed by Juanma Barranquero . +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. +use strict; + +my %%trans = do { + my $i = 0; + map {($_, substr(unpack(q(B8), chr $i++), 2, 6))} + split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/) +}; + +my %%bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255; + +binmode(\\*STDOUT); + +# We are going to accumulate into $pending to accept any line length +# (we do not check they are <= 76 chars as the RFC says) +my $pending = q(); + +while (my $data = ) { + chomp $data; + + # If we find one or two =, we have reached the end and + # any following data is to be discarded + my $finished = $data =~ s/(==?).*/$1/; + $pending .= $data; + + my $len = length($pending); + my $chunk = substr($pending, 0, $len & ~3); + $pending = substr($pending, $len & ~3 + 1); + + # Easy method: translate from chars to (pregenerated) six-bit packets, join, + # split in 8-bit chunks and convert back to char. + print join q(), + map $bytes{$_}, + ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g); + + last if $finished; +}' 2>/dev/null" + "Perl program to use for decoding a file. +Escape sequence %s is replaced with name of Perl binary. +This string is passed to `format', so percent characters need to be doubled.") + +(defconst tramp-vc-registered-read-file-names + "echo \"(\" +while read file; do + if %s \"$file\"; then + echo \"(\\\"$file\\\" \\\"file-exists-p\\\" t)\" + else + echo \"(\\\"$file\\\" \\\"file-exists-p\\\" nil)\" + fi + if %s \"$file\"; then + echo \"(\\\"$file\\\" \\\"file-readable-p\\\" t)\" + else + echo \"(\\\"$file\\\" \\\"file-readable-p\\\" nil)\" + fi +done +echo \")\"" + "Script to check existence of VC related files. +It must be send formatted with two strings; the tests for file +existence, and file readability. Input shall be read via +here-document, otherwise the command could exceed maximum length +of command line.") + +(defconst tramp-file-mode-type-map + '((0 . "-") ; Normal file (SVID-v2 and XPG2) + (1 . "p") ; fifo + (2 . "c") ; character device + (3 . "m") ; multiplexed character device (v7) + (4 . "d") ; directory + (5 . "?") ; Named special file (XENIX) + (6 . "b") ; block device + (7 . "?") ; multiplexed block device (v7) + (8 . "-") ; regular file + (9 . "n") ; network special file (HP-UX) + (10 . "l") ; symlink + (11 . "?") ; ACL shadow inode (Solaris, not userspace) + (12 . "s") ; socket + (13 . "D") ; door special (Solaris) + (14 . "w")) ; whiteout (BSD) + "A list of file types returned from the `stat' system call. +This is used to map a mode number to a permission string.") + +;; New handlers should be added here. The following operations can be +;; handled using the normal primitives: file-name-sans-versions, +;; get-file-buffer. +(defconst tramp-sh-file-name-handler-alist + '((load . tramp-handle-load) + (make-symbolic-link . tramp-sh-handle-make-symbolic-link) + (file-name-as-directory . tramp-handle-file-name-as-directory) + (file-name-directory . tramp-handle-file-name-directory) + (file-name-nondirectory . tramp-handle-file-name-nondirectory) + (file-truename . tramp-sh-handle-file-truename) + (file-exists-p . tramp-sh-handle-file-exists-p) + (file-directory-p . tramp-sh-handle-file-directory-p) + (file-executable-p . tramp-sh-handle-file-executable-p) + (file-readable-p . tramp-sh-handle-file-readable-p) + (file-regular-p . tramp-handle-file-regular-p) + (file-symlink-p . tramp-handle-file-symlink-p) + (file-writable-p . tramp-sh-handle-file-writable-p) + (file-ownership-preserved-p . tramp-sh-handle-file-ownership-preserved-p) + (file-newer-than-file-p . tramp-sh-handle-file-newer-than-file-p) + (file-attributes . tramp-sh-handle-file-attributes) + (file-modes . tramp-handle-file-modes) + (directory-files . tramp-handle-directory-files) + (directory-files-and-attributes + . tramp-sh-handle-directory-files-and-attributes) + (file-name-all-completions . tramp-sh-handle-file-name-all-completions) + (file-name-completion . tramp-handle-file-name-completion) + (add-name-to-file . tramp-sh-handle-add-name-to-file) + (copy-file . tramp-sh-handle-copy-file) + (copy-directory . tramp-sh-handle-copy-directory) + (rename-file . tramp-sh-handle-rename-file) + (set-file-modes . tramp-sh-handle-set-file-modes) + (set-file-times . tramp-sh-handle-set-file-times) + (make-directory . tramp-sh-handle-make-directory) + (delete-directory . tramp-sh-handle-delete-directory) + (delete-file . tramp-sh-handle-delete-file) + (directory-file-name . tramp-handle-directory-file-name) + ;; `executable-find' is not official yet. + (executable-find . tramp-sh-handle-executable-find) + (start-file-process . tramp-sh-handle-start-file-process) + (process-file . tramp-sh-handle-process-file) + (shell-command . tramp-sh-handle-shell-command) + (insert-directory . tramp-sh-handle-insert-directory) + (expand-file-name . tramp-sh-handle-expand-file-name) + (substitute-in-file-name . tramp-handle-substitute-in-file-name) + (file-local-copy . tramp-sh-handle-file-local-copy) + (file-remote-p . tramp-handle-file-remote-p) + (insert-file-contents . tramp-handle-insert-file-contents) + (insert-file-contents-literally + . tramp-sh-handle-insert-file-contents-literally) + (write-region . tramp-sh-handle-write-region) + (find-backup-file-name . tramp-handle-find-backup-file-name) + (make-auto-save-file-name . tramp-sh-handle-make-auto-save-file-name) + (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) + (dired-compress-file . tramp-sh-handle-dired-compress-file) + (dired-recursive-delete-directory + . tramp-sh-handle-dired-recursive-delete-directory) + (dired-uncache . tramp-handle-dired-uncache) + (set-visited-file-modtime . tramp-sh-handle-set-visited-file-modtime) + (verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime) + (file-selinux-context . tramp-sh-handle-file-selinux-context) + (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context) + (vc-registered . tramp-sh-handle-vc-registered)) + "Alist of handler functions. +Operations not mentioned here will be handled by the normal Emacs functions.") + +;; This must be the last entry, because `identity' always matches. +;;;###tramp-autoload +(add-to-list 'tramp-foreign-file-name-handler-alist + '(identity . tramp-sh-file-name-handler) 'append) + +;;; File Name Handler Functions: + +(defun tramp-sh-handle-make-symbolic-link + (filename linkname &optional ok-if-already-exists) + "Like `make-symbolic-link' for Tramp files. +If LINKNAME is a non-Tramp file, it is used verbatim as the target of +the symlink. If LINKNAME is a Tramp file, only the localname component is +used as the target of the symlink. + +If LINKNAME is a Tramp file and the localname component is relative, then +it is expanded first, before the localname component is taken. Note that +this can give surprising results if the user/host for the source and +target of the symlink differ." + (with-parsed-tramp-file-name linkname l + (let ((ln (tramp-get-remote-ln l)) + (cwd (tramp-run-real-handler + 'file-name-directory (list l-localname)))) + (unless ln + (tramp-error + l 'file-error + "Making a symbolic link. ln(1) does not exist on the remote host.")) + + ;; Do the 'confirm if exists' thing. + (when (file-exists-p linkname) + ;; What to do? + (if (or (null ok-if-already-exists) ; not allowed to exist + (and (numberp ok-if-already-exists) + (not (yes-or-no-p + (format + "File %s already exists; make it a link anyway? " + l-localname))))) + (tramp-error + l 'file-already-exists "File %s already exists" l-localname) + (delete-file linkname))) + + ;; If FILENAME is a Tramp name, use just the localname component. + (when (tramp-tramp-file-p filename) + (setq filename + (tramp-file-name-localname + (tramp-dissect-file-name (expand-file-name filename))))) + + (tramp-flush-file-property l (file-name-directory l-localname)) + (tramp-flush-file-property l l-localname) + + ;; Right, they are on the same host, regardless of user, method, etc. + ;; We now make the link on the remote machine. This will occur as the user + ;; that FILENAME belongs to. + (tramp-send-command-and-check + l + (format + "cd %s && %s -sf %s %s" + (tramp-shell-quote-argument cwd) + ln + (tramp-shell-quote-argument filename) + (tramp-shell-quote-argument l-localname)) + t)))) + +(defun tramp-sh-handle-file-truename (filename &optional counter prev-dirs) + "Like `file-truename' for Tramp files." + (with-parsed-tramp-file-name (expand-file-name filename) nil + (with-file-property v localname "file-truename" + (let ((result nil)) ; result steps in reverse order + (tramp-message v 4 "Finding true name for `%s'" filename) + (cond + ;; Use GNU readlink --canonicalize-missing where available. + ((tramp-get-remote-readlink v) + (setq result + (tramp-send-command-and-read + v + (format "echo \"\\\"`%s --canonicalize-missing %s`\\\"\"" + (tramp-get-remote-readlink v) + (tramp-shell-quote-argument localname))))) + + ;; Use Perl implementation. + ((and (tramp-get-remote-perl v) + (tramp-get-connection-property v "perl-file-spec" nil) + (tramp-get-connection-property v "perl-cwd-realpath" nil)) + (tramp-maybe-send-script + v tramp-perl-file-truename "tramp_perl_file_truename") + (setq result + (tramp-send-command-and-read + v + (format "tramp_perl_file_truename %s" + (tramp-shell-quote-argument localname))))) + + ;; Do it yourself. We bind `directory-sep-char' here for + ;; XEmacs on Windows, which would otherwise use backslash. + (t (let* ((directory-sep-char ?/) + (steps (tramp-compat-split-string localname "/")) + (localnamedir (tramp-run-real-handler + 'file-name-as-directory (list localname))) + (is-dir (string= localname localnamedir)) + (thisstep nil) + (numchase 0) + ;; Don't make the following value larger than + ;; necessary. People expect an error message in a + ;; timely fashion when something is wrong; + ;; otherwise they might think that Emacs is hung. + ;; Of course, correctness has to come first. + (numchase-limit 20) + symlink-target) + (while (and steps (< numchase numchase-limit)) + (setq thisstep (pop steps)) + (tramp-message + v 5 "Check %s" + (mapconcat 'identity + (append '("") (reverse result) (list thisstep)) + "/")) + (setq symlink-target + (nth 0 (file-attributes + (tramp-make-tramp-file-name + method user host + (mapconcat 'identity + (append '("") + (reverse result) + (list thisstep)) + "/"))))) + (cond ((string= "." thisstep) + (tramp-message v 5 "Ignoring step `.'")) + ((string= ".." thisstep) + (tramp-message v 5 "Processing step `..'") + (pop result)) + ((stringp symlink-target) + ;; It's a symlink, follow it. + (tramp-message v 5 "Follow symlink to %s" symlink-target) + (setq numchase (1+ numchase)) + (when (file-name-absolute-p symlink-target) + (setq result nil)) + ;; If the symlink was absolute, we'll get a string like + ;; "/user@host:/some/target"; extract the + ;; "/some/target" part from it. + (when (tramp-tramp-file-p symlink-target) + (unless (tramp-equal-remote filename symlink-target) + (tramp-error + v 'file-error + "Symlink target `%s' on wrong host" symlink-target)) + (setq symlink-target localname)) + (setq steps + (append (tramp-compat-split-string + symlink-target "/") + steps))) + (t + ;; It's a file. + (setq result (cons thisstep result))))) + (when (>= numchase numchase-limit) + (tramp-error + v 'file-error + "Maximum number (%d) of symlinks exceeded" numchase-limit)) + (setq result (reverse result)) + ;; Combine list to form string. + (setq result + (if result + (mapconcat 'identity (cons "" result) "/") + "/")) + (when (and is-dir (or (string= "" result) + (not (string= (substring result -1) "/")))) + (setq result (concat result "/")))))) + + (tramp-message v 4 "True name of `%s' is `%s'" filename result) + (tramp-make-tramp-file-name method user host result))))) + +;; Basic functions. + +(defun tramp-sh-handle-file-exists-p (filename) + "Like `file-exists-p' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-exists-p" + (or (not (null (tramp-get-file-property + v localname "file-attributes-integer" nil))) + (not (null (tramp-get-file-property + v localname "file-attributes-string" nil))) + (tramp-send-command-and-check + v + (format + "%s %s" + (tramp-get-file-exists-command v) + (tramp-shell-quote-argument localname))))))) + +;; CCC: This should check for an error condition and signal failure +;; when something goes wrong. +;; Daniel Pittman +(defun tramp-sh-handle-file-attributes (filename &optional id-format) + "Like `file-attributes' for Tramp files." + (unless id-format (setq id-format 'integer)) + ;; Don't modify `last-coding-system-used' by accident. + (let ((last-coding-system-used last-coding-system-used)) + (with-parsed-tramp-file-name (expand-file-name filename) nil + (with-file-property v localname (format "file-attributes-%s" id-format) + (save-excursion + (tramp-convert-file-attributes + v + (cond + ((tramp-get-remote-stat v) + (tramp-do-file-attributes-with-stat v localname id-format)) + ((tramp-get-remote-perl v) + (tramp-do-file-attributes-with-perl v localname id-format)) + (t + (tramp-do-file-attributes-with-ls v localname id-format))))))))) + +(defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) + "Implement `file-attributes' for Tramp files using the ls(1) command." + (let (symlinkp dirp + res-inode res-filemodes res-numlinks + res-uid res-gid res-size res-symlink-target) + (tramp-message vec 5 "file attributes with ls: %s" localname) + (tramp-send-command + vec + (format "(%s %s || %s -h %s) && %s %s %s" + (tramp-get-file-exists-command vec) + (tramp-shell-quote-argument localname) + (tramp-get-test-command vec) + (tramp-shell-quote-argument localname) + (tramp-get-ls-command vec) + (if (eq id-format 'integer) "-ildn" "-ild") + (tramp-shell-quote-argument localname))) + ;; parse `ls -l' output ... + (with-current-buffer (tramp-get-buffer vec) + (when (> (buffer-size) 0) + (goto-char (point-min)) + ;; ... inode + (setq res-inode + (condition-case err + (read (current-buffer)) + (invalid-read-syntax + (when (and (equal (cadr err) + "Integer constant overflow in reader") + (string-match + "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'" + (car (cddr err)))) + (let* ((big (read (substring (car (cddr err)) 0 + (match-beginning 1)))) + (small (read (match-string 1 (car (cddr err))))) + (twiddle (/ small 65536))) + (cons (+ big twiddle) + (- small (* twiddle 65536)))))))) + ;; ... file mode flags + (setq res-filemodes (symbol-name (read (current-buffer)))) + ;; ... number links + (setq res-numlinks (read (current-buffer))) + ;; ... uid and gid + (setq res-uid (read (current-buffer))) + (setq res-gid (read (current-buffer))) + (if (eq id-format 'integer) + (progn + (unless (numberp res-uid) (setq res-uid -1)) + (unless (numberp res-gid) (setq res-gid -1))) + (progn + (unless (stringp res-uid) (setq res-uid (symbol-name res-uid))) + (unless (stringp res-gid) (setq res-gid (symbol-name res-gid))))) + ;; ... size + (setq res-size (read (current-buffer))) + ;; From the file modes, figure out other stuff. + (setq symlinkp (eq ?l (aref res-filemodes 0))) + (setq dirp (eq ?d (aref res-filemodes 0))) + ;; if symlink, find out file name pointed to + (when symlinkp + (search-forward "-> ") + (setq res-symlink-target (buffer-substring (point) (point-at-eol)))) + ;; return data gathered + (list + ;; 0. t for directory, string (name linked to) for symbolic + ;; link, or nil. + (or dirp res-symlink-target) + ;; 1. Number of links to file. + res-numlinks + ;; 2. File uid. + res-uid + ;; 3. File gid. + res-gid + ;; 4. Last access time, as a list of two integers. First + ;; integer has high-order 16 bits of time, second has low 16 + ;; bits. + ;; 5. Last modification time, likewise. + ;; 6. Last status change time, likewise. + '(0 0) '(0 0) '(0 0) ;CCC how to find out? + ;; 7. Size in bytes (-1, if number is out of range). + res-size + ;; 8. File modes, as a string of ten letters or dashes as in ls -l. + res-filemodes + ;; 9. t if file's gid would change if file were deleted and + ;; recreated. Will be set in `tramp-convert-file-attributes' + t + ;; 10. inode number. + res-inode + ;; 11. Device number. Will be replaced by a virtual device number. + -1 + ))))) + +(defun tramp-do-file-attributes-with-perl + (vec localname &optional id-format) + "Implement `file-attributes' for Tramp files using a Perl script." + (tramp-message vec 5 "file attributes with perl: %s" localname) + (tramp-maybe-send-script + vec tramp-perl-file-attributes "tramp_perl_file_attributes") + (tramp-send-command-and-read + vec + (format "tramp_perl_file_attributes %s %s" + (tramp-shell-quote-argument localname) id-format))) + +(defun tramp-do-file-attributes-with-stat + (vec localname &optional id-format) + "Implement `file-attributes' for Tramp files using stat(1) command." + (tramp-message vec 5 "file attributes with stat: %s" localname) + (tramp-send-command-and-read + vec + (format + ;; On Opsware, pdksh (which is the true name of ksh there) doesn't + ;; parse correctly the sequence "((". Therefore, we add a space. + "( (%s %s || %s -h %s) && %s -c '((\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)' %s || echo nil)" + (tramp-get-file-exists-command vec) + (tramp-shell-quote-argument localname) + (tramp-get-test-command vec) + (tramp-shell-quote-argument localname) + (tramp-get-remote-stat vec) + (if (eq id-format 'integer) "%u" "\"%U\"") + (if (eq id-format 'integer) "%g" "\"%G\"") + (tramp-shell-quote-argument localname)))) + +(defun tramp-sh-handle-set-visited-file-modtime (&optional time-list) + "Like `set-visited-file-modtime' for Tramp files." + (unless (buffer-file-name) + (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file" + (buffer-name))) + (if time-list + (tramp-run-real-handler 'set-visited-file-modtime (list time-list)) + (let ((f (buffer-file-name)) + coding-system-used) + (with-parsed-tramp-file-name f nil + (let* ((attr (file-attributes f)) + ;; '(-1 65535) means file doesn't exists yet. + (modtime (or (nth 5 attr) '(-1 65535)))) + (when (boundp 'last-coding-system-used) + (setq coding-system-used (symbol-value 'last-coding-system-used))) + ;; We use '(0 0) as a don't-know value. See also + ;; `tramp-do-file-attributes-with-ls'. + (if (not (equal modtime '(0 0))) + (tramp-run-real-handler 'set-visited-file-modtime (list modtime)) + (progn + (tramp-send-command + v + (format "%s -ild %s" + (tramp-get-ls-command v) + (tramp-shell-quote-argument localname))) + (setq attr (buffer-substring (point) + (progn (end-of-line) (point))))) + (tramp-set-file-property + v localname "visited-file-modtime-ild" attr)) + (when (boundp 'last-coding-system-used) + (set 'last-coding-system-used coding-system-used)) + nil))))) + +;; This function makes the same assumption as +;; `tramp-sh-handle-set-visited-file-modtime'. +(defun tramp-sh-handle-verify-visited-file-modtime (buf) + "Like `verify-visited-file-modtime' for Tramp files. +At the time `verify-visited-file-modtime' calls this function, we +already know that the buffer is visiting a file and that +`visited-file-modtime' does not return 0. Do not call this +function directly, unless those two cases are already taken care +of." + (with-current-buffer buf + (let ((f (buffer-file-name))) + ;; There is no file visiting the buffer, or the buffer has no + ;; recorded last modification time, or there is no established + ;; connection. + (if (or (not f) + (eq (visited-file-modtime) 0) + (not (tramp-file-name-handler 'file-remote-p f nil 'connected))) + t + (with-parsed-tramp-file-name f nil + (let* ((remote-file-name-inhibit-cache t) + (attr (file-attributes f)) + (modtime (nth 5 attr)) + (mt (visited-file-modtime))) + + (cond + ;; File exists, and has a known modtime. + ((and attr (not (equal modtime '(0 0)))) + (< (abs (tramp-time-diff + modtime + ;; For compatibility, deal with both the old + ;; (HIGH . LOW) and the new (HIGH LOW) return + ;; values of `visited-file-modtime'. + (if (atom (cdr mt)) + (list (car mt) (cdr mt)) + mt))) + 2)) + ;; Modtime has the don't know value. + (attr + (tramp-send-command + v + (format "%s -ild %s" + (tramp-get-ls-command v) + (tramp-shell-quote-argument localname))) + (with-current-buffer (tramp-get-buffer v) + (setq attr (buffer-substring + (point) (progn (end-of-line) (point))))) + (equal + attr + (tramp-get-file-property + v localname "visited-file-modtime-ild" ""))) + ;; If file does not exist, say it is not modified if and + ;; only if that agrees with the buffer's record. + (t (equal mt '(-1 65535)))))))))) + +(defun tramp-sh-handle-set-file-modes (filename mode) + "Like `set-file-modes' for Tramp files." + (with-parsed-tramp-file-name filename nil + (tramp-flush-file-property v localname) + ;; FIXME: extract the proper text from chmod's stderr. + (tramp-barf-unless-okay + v + (format "chmod %s %s" + (tramp-compat-decimal-to-octal mode) + (tramp-shell-quote-argument localname)) + "Error while changing file's mode %s" filename))) + +(defun tramp-sh-handle-set-file-times (filename &optional time) + "Like `set-file-times' for Tramp files." + (if (file-remote-p filename) + (with-parsed-tramp-file-name filename nil + (tramp-flush-file-property v localname) + (let ((time (if (or (null time) (equal time '(0 0))) + (current-time) + time)) + ;; With GNU Emacs, `format-time-string' has an optional + ;; parameter UNIVERSAL. This is preferred, because we + ;; could handle the case when the remote host is located + ;; in a different time zone as the local host. + (utc (not (featurep 'xemacs)))) + (tramp-send-command-and-check + v (format "%s touch -t %s %s" + (if utc "TZ=UTC; export TZ;" "") + (if utc + (format-time-string "%Y%m%d%H%M.%S" time t) + (format-time-string "%Y%m%d%H%M.%S" time)) + (tramp-shell-quote-argument localname))))) + + ;; We handle also the local part, because in older Emacsen, + ;; without `set-file-times', this function is an alias for this. + ;; We are local, so we don't need the UTC settings. + (zerop + (tramp-compat-call-process + "touch" nil nil nil "-t" + (format-time-string "%Y%m%d%H%M.%S" time) + (tramp-shell-quote-argument filename))))) + +(defun tramp-set-file-uid-gid (filename &optional uid gid) + "Set the ownership for FILENAME. +If UID and GID are provided, these values are used; otherwise uid +and gid of the corresponding user is taken. Both parameters must be integers." + ;; Modern Unices allow chown only for root. So we might need + ;; another implementation, see `dired-do-chown'. OTOH, it is mostly + ;; working with su(do)? when it is needed, so it shall succeed in + ;; the majority of cases. + ;; Don't modify `last-coding-system-used' by accident. + (let ((last-coding-system-used last-coding-system-used)) + (if (file-remote-p filename) + (with-parsed-tramp-file-name filename nil + (if (and (zerop (user-uid)) (tramp-local-host-p v)) + ;; If we are root on the local host, we can do it directly. + (tramp-set-file-uid-gid localname uid gid) + (let ((uid (or (and (integerp uid) uid) + (tramp-get-remote-uid v 'integer))) + (gid (or (and (integerp gid) gid) + (tramp-get-remote-gid v 'integer)))) + (tramp-send-command + v (format + "chown %d:%d %s" uid gid + (tramp-shell-quote-argument localname)))))) + + ;; We handle also the local part, because there doesn't exist + ;; `set-file-uid-gid'. On W32 "chown" might not work. + (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer))) + (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer)))) + (tramp-compat-call-process + "chown" nil nil nil + (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) + +(defun tramp-remote-selinux-p (vec) + "Check, whether SELINUX is enabled on the remote host." + (with-connection-property (tramp-get-connection-process vec) "selinux-p" + (let ((result (tramp-find-executable + vec "getenforce" (tramp-get-remote-path vec) t t))) + (and result + (string-equal + (tramp-send-command-and-read + vec (format "echo \\\"`%S`\\\"" result)) + "Enforcing"))))) + +(defun tramp-sh-handle-file-selinux-context (filename) + "Like `file-selinux-context' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-selinux-context" + (let ((context '(nil nil nil nil)) + (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):" + "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)"))) + (when (and (tramp-remote-selinux-p v) + (tramp-send-command-and-check + v (format + "%s -d -Z %s" + (tramp-get-ls-command v) + (tramp-shell-quote-argument localname)))) + (with-current-buffer (tramp-get-connection-buffer v) + (goto-char (point-min)) + (when (re-search-forward regexp (point-at-eol) t) + (setq context (list (match-string 1) (match-string 2) + (match-string 3) (match-string 4)))))) + ;; Return the context. + context)))) + +(defun tramp-sh-handle-set-file-selinux-context (filename context) + "Like `set-file-selinux-context' for Tramp files." + (with-parsed-tramp-file-name filename nil + (if (and (consp context) + (tramp-remote-selinux-p v) + (tramp-send-command-and-check + v (format "chcon %s %s %s %s %s" + (if (stringp (nth 0 context)) + (format "--user=%s" (nth 0 context)) "") + (if (stringp (nth 1 context)) + (format "--role=%s" (nth 1 context)) "") + (if (stringp (nth 2 context)) + (format "--type=%s" (nth 2 context)) "") + (if (stringp (nth 3 context)) + (format "--range=%s" (nth 3 context)) "") + (tramp-shell-quote-argument localname)))) + (tramp-set-file-property v localname "file-selinux-context" context) + (tramp-set-file-property v localname "file-selinux-context" 'undef))) + ;; We always return nil. + nil) + +;; Simple functions using the `test' command. + +(defun tramp-sh-handle-file-executable-p (filename) + "Like `file-executable-p' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-executable-p" + ;; Examine `file-attributes' cache to see if request can be + ;; satisfied without remote operation. + (or (tramp-check-cached-permissions v ?x) + (tramp-run-test "-x" filename))))) + +(defun tramp-sh-handle-file-readable-p (filename) + "Like `file-readable-p' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-readable-p" + ;; Examine `file-attributes' cache to see if request can be + ;; satisfied without remote operation. + (or (tramp-check-cached-permissions v ?r) + (tramp-run-test "-r" filename))))) + +;; When the remote shell is started, it looks for a shell which groks +;; tilde expansion. Here, we assume that all shells which grok tilde +;; expansion will also provide a `test' command which groks `-nt' (for +;; newer than). If this breaks, tell me about it and I'll try to do +;; something smarter about it. +(defun tramp-sh-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) + ;; We are sure both files exist at this point. + (t + (save-excursion + ;; We try to get the mtime of both files. If they are not + ;; equal to the "dont-know" value, then we subtract the times + ;; and obtain the result. + (let ((fa1 (file-attributes file1)) + (fa2 (file-attributes file2))) + (if (and (not (equal (nth 5 fa1) '(0 0))) + (not (equal (nth 5 fa2) '(0 0)))) + (> 0 (tramp-time-diff (nth 5 fa2) (nth 5 fa1))) + ;; If one of them is the dont-know value, then we can + ;; still try to run a shell command on the remote host. + ;; However, this only works if both files are Tramp + ;; files and both have the same method, same user, same + ;; host. + (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 + "Files %s and %s must have same method, user, host" + file1 file2))) + (with-parsed-tramp-file-name file1 nil + (tramp-run-test2 + (tramp-get-test-nt-command v) file1 file2)))))))) + +;; Functions implemented using the basic functions above. + +(defun tramp-sh-handle-file-directory-p (filename) + "Like `file-directory-p' for Tramp files." + ;; Care must be taken that this function returns `t' for symlinks + ;; pointing to directories. Surely the most obvious implementation + ;; would be `test -d', but that returns false for such symlinks. + ;; CCC: Stefan Monnier says that `test -d' follows symlinks. And + ;; I now think he's right. So we could be using `test -d', couldn't + ;; we? + ;; + ;; Alternatives: `cd %s', `test -d %s' + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-directory-p" + (tramp-run-test "-d" filename)))) + +(defun tramp-sh-handle-file-writable-p (filename) + "Like `file-writable-p' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-writable-p" + (if (file-exists-p filename) + ;; Examine `file-attributes' cache to see if request can be + ;; satisfied without remote operation. + (or (tramp-check-cached-permissions v ?w) + (tramp-run-test "-w" filename)) + ;; If file doesn't exist, check if directory is writable. + (and (tramp-run-test "-d" (file-name-directory filename)) + (tramp-run-test "-w" (file-name-directory filename))))))) + +(defun tramp-sh-handle-file-ownership-preserved-p (filename) + "Like `file-ownership-preserved-p' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-ownership-preserved-p" + (let ((attributes (file-attributes filename))) + ;; Return t if the file doesn't exist, since it's true that no + ;; information would be lost by an (attempted) delete and create. + (or (null attributes) + (= (nth 2 attributes) (tramp-get-remote-uid v 'integer))))))) + +;; Directory listings. + +(defun tramp-sh-handle-directory-files-and-attributes + (directory &optional full match nosort id-format) + "Like `directory-files-and-attributes' for Tramp files." + (unless id-format (setq id-format 'integer)) + (when (file-directory-p directory) + (setq directory (expand-file-name directory)) + (let* ((temp + (copy-tree + (with-parsed-tramp-file-name directory nil + (with-file-property + v localname + (format "directory-files-and-attributes-%s" id-format) + (save-excursion + (mapcar + (lambda (x) + (cons (car x) + (tramp-convert-file-attributes v (cdr x)))) + (cond + ((tramp-get-remote-stat v) + (tramp-do-directory-files-and-attributes-with-stat + v localname id-format)) + ((tramp-get-remote-perl v) + (tramp-do-directory-files-and-attributes-with-perl + v localname id-format))))))))) + result item) + + (while temp + (setq item (pop temp)) + (when (or (null match) (string-match match (car item))) + (when full + (setcar item (expand-file-name (car item) directory))) + (push item result))) + + (if nosort + result + (sort result (lambda (x y) (string< (car x) (car y)))))))) + +(defun tramp-do-directory-files-and-attributes-with-perl + (vec localname &optional id-format) + "Implement `directory-files-and-attributes' for Tramp files using a Perl script." + (tramp-message vec 5 "directory-files-and-attributes with perl: %s" localname) + (tramp-maybe-send-script + vec tramp-perl-directory-files-and-attributes + "tramp_perl_directory_files_and_attributes") + (let ((object + (tramp-send-command-and-read + vec + (format "tramp_perl_directory_files_and_attributes %s %s" + (tramp-shell-quote-argument localname) id-format)))) + (when (stringp object) (tramp-error vec 'file-error object)) + object)) + +(defun tramp-do-directory-files-and-attributes-with-stat + (vec localname &optional id-format) + "Implement `directory-files-and-attributes' for Tramp files using stat(1) command." + (tramp-message vec 5 "directory-files-and-attributes with stat: %s" localname) + (tramp-send-command-and-read + vec + (format + (concat + ;; We must care about filenames with spaces, or starting with + ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, + ;; but it does not work on all remote systems. Therefore, we + ;; quote the filenames via sed. + "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | xargs " + "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'); " + "echo \")\"") + (tramp-shell-quote-argument localname) + (tramp-get-ls-command vec) + (tramp-get-remote-stat vec) + (if (eq id-format 'integer) "%u" "\"%U\"") + (if (eq id-format 'integer) "%g" "\"%G\"")))) + +;; This function should return "foo/" for directories and "bar" for +;; files. +(defun tramp-sh-handle-file-name-all-completions (filename directory) + "Like `file-name-all-completions' for Tramp files." + (unless (save-match-data (string-match "/" filename)) + (with-parsed-tramp-file-name (expand-file-name directory) nil + + (all-completions + filename + (mapcar + 'list + (or + ;; Try cache entries for filename, filename with last + ;; character removed, filename with last two characters + ;; removed, ..., and finally the empty string - all + ;; concatenated to the local directory name. + (let ((remote-file-name-inhibit-cache + (or remote-file-name-inhibit-cache + tramp-completion-reread-directory-timeout))) + + ;; This is inefficient for very long filenames, pity + ;; `reduce' is not available... + (car + (apply + 'append + (mapcar + (lambda (x) + (let ((cache-hit + (tramp-get-file-property + v + (concat localname (substring filename 0 x)) + "file-name-all-completions" + nil))) + (when cache-hit (list cache-hit)))) + (tramp-compat-number-sequence (length filename) 0 -1))))) + + ;; Cache expired or no matching cache entry found so we need + ;; to perform a remote operation. + (let (result) + ;; Get a list of directories and files, including reliably + ;; tagging the directories with a trailing '/'. Because I + ;; rock. --daniel@danann.net + + ;; Changed to perform `cd' in the same remote op and only + ;; get entries starting with `filename'. Capture any `cd' + ;; error messages. Ensure any `cd' and `echo' aliases are + ;; ignored. + (tramp-send-command + v + (if (tramp-get-remote-perl v) + (progn + (tramp-maybe-send-script + v tramp-perl-file-name-all-completions + "tramp_perl_file_name_all_completions") + (format "tramp_perl_file_name_all_completions %s %s %d" + (tramp-shell-quote-argument localname) + (tramp-shell-quote-argument filename) + (if (symbol-value + ;; `read-file-name-completion-ignore-case' + ;; is introduced with Emacs 22.1. + (if (boundp + 'read-file-name-completion-ignore-case) + 'read-file-name-completion-ignore-case + 'completion-ignore-case)) + 1 0))) + + (format (concat + "(\\cd %s 2>&1 && (%s %s -a 2>/dev/null" + ;; `ls' with wildcard might fail with `Argument + ;; list too long' error in some corner cases; if + ;; `ls' fails after `cd' succeeded, chances are + ;; that's the case, so let's retry without + ;; wildcard. This will return "too many" entries + ;; but that isn't harmful. + " || %s -a 2>/dev/null)" + " | while read f; do" + " if %s -d \"$f\" 2>/dev/null;" + " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done" + " && \\echo ok) || \\echo fail") + (tramp-shell-quote-argument localname) + (tramp-get-ls-command v) + ;; When `filename' is empty, just `ls' without + ;; filename argument is more efficient than `ls *' + ;; for very large directories and might avoid the + ;; `Argument list too long' error. + ;; + ;; With and only with wildcard, we need to add + ;; `-d' to prevent `ls' from descending into + ;; sub-directories. + (if (zerop (length filename)) + "." + (concat (tramp-shell-quote-argument filename) "* -d")) + (tramp-get-ls-command v) + (tramp-get-test-command v)))) + + ;; Now grab the output. + (with-current-buffer (tramp-get-buffer v) + (goto-char (point-max)) + + ;; Check result code, found in last line of output + (forward-line -1) + (if (looking-at "^fail$") + (progn + ;; Grab error message from line before last line + ;; (it was put there by `cd 2>&1') + (forward-line -1) + (tramp-error + v 'file-error + "tramp-sh-handle-file-name-all-completions: %s" + (buffer-substring (point) (point-at-eol)))) + ;; For peace of mind, if buffer doesn't end in `fail' + ;; then it should end in `ok'. If neither are in the + ;; buffer something went seriously wrong on the remote + ;; side. + (unless (looking-at "^ok$") + (tramp-error + v 'file-error + "\ +tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" + (tramp-shell-quote-argument localname) (buffer-string)))) + + (while (zerop (forward-line -1)) + (push (buffer-substring (point) (point-at-eol)) result))) + + ;; Because the remote op went through OK we know the + ;; directory we `cd'-ed to exists + (tramp-set-file-property + v localname "file-exists-p" t) + + ;; Because the remote op went through OK we know every + ;; file listed by `ls' exists. + (mapc (lambda (entry) + (tramp-set-file-property + v (concat localname entry) "file-exists-p" t)) + result) + + ;; Store result in the cache + (tramp-set-file-property + v (concat localname filename) + "file-name-all-completions" + result)))))))) + +;; cp, mv and ln + +(defun tramp-sh-handle-add-name-to-file + (filename newname &optional ok-if-already-exists) + "Like `add-name-to-file' for Tramp files." + (unless (tramp-equal-remote filename newname) + (with-parsed-tramp-file-name + (if (tramp-tramp-file-p filename) filename newname) nil + (tramp-error + v 'file-error + "add-name-to-file: %s" + "only implemented for same method, same user, same host"))) + (with-parsed-tramp-file-name filename v1 + (with-parsed-tramp-file-name newname v2 + (let ((ln (when v1 (tramp-get-remote-ln v1)))) + (when (and (not ok-if-already-exists) + (file-exists-p newname) + (not (numberp ok-if-already-exists)) + (y-or-n-p + (format + "File %s already exists; make it a new name anyway? " + newname))) + (tramp-error + v2 'file-error + "add-name-to-file: file %s already exists" newname)) + (tramp-flush-file-property v2 (file-name-directory v2-localname)) + (tramp-flush-file-property v2 v2-localname) + (tramp-barf-unless-okay + v1 + (format "%s %s %s" ln (tramp-shell-quote-argument v1-localname) + (tramp-shell-quote-argument v2-localname)) + "error with add-name-to-file, see buffer `%s' for details" + (buffer-name)))))) + +(defun tramp-sh-handle-copy-file + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) + "Like `copy-file' for Tramp files." + (setq filename (expand-file-name filename)) + (setq newname (expand-file-name newname)) + (cond + ;; At least one file a Tramp file? + ((or (tramp-tramp-file-p filename) + (tramp-tramp-file-p newname)) + (tramp-do-copy-or-rename-file + 'copy filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context)) + ;; Compat section. + (preserve-selinux-context + (tramp-run-real-handler + 'copy-file + (list filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context))) + (preserve-uid-gid + (tramp-run-real-handler + 'copy-file + (list filename newname ok-if-already-exists keep-date preserve-uid-gid))) + (t + (tramp-run-real-handler + 'copy-file (list filename newname ok-if-already-exists keep-date))))) + +(defun tramp-sh-handle-copy-directory + (dirname newname &optional keep-date parents) + "Like `copy-directory' for Tramp files." + (let ((t1 (tramp-tramp-file-p dirname)) + (t2 (tramp-tramp-file-p newname))) + (with-parsed-tramp-file-name (if t1 dirname newname) nil + (if (and (tramp-get-method-parameter method 'tramp-copy-recursive) + ;; When DIRNAME and NEWNAME are remote, they must have + ;; the same method. + (or (null t1) (null t2) + (string-equal + (tramp-file-name-method (tramp-dissect-file-name dirname)) + (tramp-file-name-method (tramp-dissect-file-name newname))))) + ;; scp or rsync DTRT. + (progn + (setq dirname (directory-file-name (expand-file-name dirname)) + newname (directory-file-name (expand-file-name newname))) + (if (and (file-directory-p newname) + (not (string-equal (file-name-nondirectory dirname) + (file-name-nondirectory newname)))) + (setq newname + (expand-file-name + (file-name-nondirectory dirname) newname))) + (if (not (file-directory-p (file-name-directory newname))) + (make-directory (file-name-directory newname) parents)) + (tramp-do-copy-or-rename-file-out-of-band + 'copy dirname newname keep-date)) + ;; We must do it file-wise. + (tramp-run-real-handler + 'copy-directory (list dirname newname keep-date parents))) + + ;; When newname did exist, we have wrong cached values. + (when t2 + (with-parsed-tramp-file-name newname nil + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-file-property v localname)))))) + +(defun tramp-sh-handle-rename-file + (filename newname &optional ok-if-already-exists) + "Like `rename-file' for Tramp files." + ;; Check if both files are local -- invoke normal rename-file. + ;; Otherwise, use Tramp from local system. + (setq filename (expand-file-name filename)) + (setq newname (expand-file-name newname)) + ;; At least one file a Tramp file? + (if (or (tramp-tramp-file-p filename) + (tramp-tramp-file-p newname)) + (tramp-do-copy-or-rename-file + 'rename filename newname ok-if-already-exists t t) + (tramp-run-real-handler + 'rename-file (list filename newname ok-if-already-exists)))) + +(defun tramp-do-copy-or-rename-file + (op filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) + "Copy or rename a remote file. +OP must be `copy' or `rename' and indicates the operation to perform. +FILENAME specifies the file to copy or rename, NEWNAME is the name of +the new file (for copy) or the new name of the file (for rename). +OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already. +KEEP-DATE means to make sure that NEWNAME has the same timestamp +as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep +the uid and gid if both files are on the same host. +PRESERVE-SELINUX-CONTEXT activates selinux commands. + +This function is invoked by `tramp-sh-handle-copy-file' and +`tramp-sh-handle-rename-file'. It is an error if OP is neither +of `copy' and `rename'. FILENAME and NEWNAME must be absolute +file names." + (unless (memq op '(copy rename)) + (error "Unknown operation `%s', must be `copy' or `rename'" op)) + (let ((t1 (tramp-tramp-file-p filename)) + (t2 (tramp-tramp-file-p newname)) + (context (and preserve-selinux-context + (apply 'file-selinux-context (list filename)))) + pr tm) + + (with-parsed-tramp-file-name (if t1 filename newname) nil + (when (and (not ok-if-already-exists) (file-exists-p newname)) + (tramp-error + v 'file-already-exists "File %s already exists" newname)) + + (with-progress-reporter + v 0 (format "%s %s to %s" + (if (eq op 'copy) "Copying" "Renaming") + filename newname) + + (cond + ;; Both are Tramp files. + ((and t1 t2) + (with-parsed-tramp-file-name filename v1 + (with-parsed-tramp-file-name newname v2 + (cond + ;; Shortcut: if method, host, user are the same for + ;; both files, we invoke `cp' or `mv' on the remote + ;; host directly. + ((tramp-equal-remote filename newname) + (tramp-do-copy-or-rename-file-directly + op filename newname + ok-if-already-exists keep-date preserve-uid-gid)) + + ;; Try out-of-band operation. + ((tramp-method-out-of-band-p + v1 (nth 7 (file-attributes (file-truename filename)))) + (tramp-do-copy-or-rename-file-out-of-band + op filename newname keep-date)) + + ;; No shortcut was possible. So we copy the file + ;; first. If the operation was `rename', we go back + ;; and delete the original file (if the copy was + ;; successful). The approach is simple-minded: we + ;; create a new buffer, insert the contents of the + ;; source file into it, then write out the buffer to + ;; the target file. The advantage is that it doesn't + ;; matter which filename handlers are used for the + ;; source and target file. + (t + (tramp-do-copy-or-rename-file-via-buffer + op filename newname keep-date)))))) + + ;; One file is a Tramp file, the other one is local. + ((or t1 t2) + (cond + ;; Fast track on local machine. + ((tramp-local-host-p v) + (tramp-do-copy-or-rename-file-directly + op filename newname + ok-if-already-exists keep-date preserve-uid-gid)) + + ;; If the Tramp file has an out-of-band method, the + ;; corresponding copy-program can be invoked. + ((tramp-method-out-of-band-p + v (nth 7 (file-attributes (file-truename filename)))) + (tramp-do-copy-or-rename-file-out-of-band + op filename newname keep-date)) + + ;; Use the inline method via a Tramp buffer. + (t (tramp-do-copy-or-rename-file-via-buffer + op filename newname keep-date)))) + + (t + ;; One of them must be a Tramp file. + (error "Tramp implementation says this cannot happen"))) + + ;; Handle `preserve-selinux-context'. + (when context (apply 'set-file-selinux-context (list newname context))) + + ;; In case of `rename', we must flush the cache of the source file. + (when (and t1 (eq op 'rename)) + (with-parsed-tramp-file-name filename v1 + (tramp-flush-file-property v1 (file-name-directory localname)) + (tramp-flush-file-property v1 localname))) + + ;; When newname did exist, we have wrong cached values. + (when t2 + (with-parsed-tramp-file-name newname v2 + (tramp-flush-file-property v2 (file-name-directory localname)) + (tramp-flush-file-property v2 localname))))))) + +(defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date) + "Use an Emacs buffer to copy or rename a file. +First arg OP is either `copy' or `rename' and indicates the operation. +FILENAME is the source file, NEWNAME the target file. +KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." + (with-temp-buffer + ;; We must disable multibyte, because binary data shall not be + ;; converted. + (set-buffer-multibyte nil) + (let ((coding-system-for-read 'binary) + (jka-compr-inhibit t)) + (insert-file-contents-literally filename)) + ;; We don't want the target file to be compressed, so we let-bind + ;; `jka-compr-inhibit' to t. + (let ((coding-system-for-write 'binary) + (jka-compr-inhibit t)) + (write-region (point-min) (point-max) newname))) + ;; KEEP-DATE handling. + (when keep-date (set-file-times newname (nth 5 (file-attributes filename)))) + ;; Set the mode. + (set-file-modes newname (tramp-default-file-modes filename)) + ;; If the operation was `rename', delete the original file. + (unless (eq op 'copy) (delete-file filename))) + +(defun tramp-do-copy-or-rename-file-directly + (op filename newname ok-if-already-exists keep-date preserve-uid-gid) + "Invokes `cp' or `mv' on the remote system. +OP must be one of `copy' or `rename', indicating `cp' or `mv', +respectively. FILENAME specifies the file to copy or rename, +NEWNAME is the name of the new file (for copy) or the new name of +the file (for rename). Both files must reside on the same host. +KEEP-DATE means to make sure that NEWNAME has the same timestamp +as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep +the uid and gid from FILENAME." + (let ((t1 (tramp-tramp-file-p filename)) + (t2 (tramp-tramp-file-p newname)) + (file-times (nth 5 (file-attributes filename))) + (file-modes (tramp-default-file-modes filename))) + (with-parsed-tramp-file-name (if t1 filename newname) nil + (let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p") + ((eq op 'copy) "cp -f") + ((eq op 'rename) "mv -f") + (t (tramp-error + v 'file-error + "Unknown operation `%s', must be `copy' or `rename'" + op)))) + (localname1 + (if t1 + (tramp-file-name-handler 'file-remote-p filename 'localname) + filename)) + (localname2 + (if t2 + (tramp-file-name-handler 'file-remote-p newname 'localname) + newname)) + (prefix (file-remote-p (if t1 filename newname))) + cmd-result) + + (cond + ;; Both files are on a remote host, with same user. + ((and t1 t2) + (setq cmd-result + (tramp-send-command-and-check + v (format "%s %s %s" cmd + (tramp-shell-quote-argument localname1) + (tramp-shell-quote-argument localname2)))) + (with-current-buffer (tramp-get-buffer v) + (goto-char (point-min)) + (unless + (or + (and keep-date + ;; Mask cp -f error. + (re-search-forward + tramp-operation-not-permitted-regexp nil t)) + cmd-result) + (tramp-error-with-buffer + nil v 'file-error + "Copying directly failed, see buffer `%s' for details." + (buffer-name))))) + + ;; We are on the local host. + ((or t1 t2) + (cond + ;; We can do it directly. + ((let (file-name-handler-alist) + (and (file-readable-p localname1) + (file-writable-p (file-name-directory localname2)) + (or (file-directory-p localname2) + (file-writable-p localname2)))) + (if (eq op 'copy) + (tramp-compat-copy-file + localname1 localname2 ok-if-already-exists + keep-date preserve-uid-gid) + (tramp-run-real-handler + 'rename-file (list localname1 localname2 ok-if-already-exists)))) + + ;; We can do it directly with `tramp-send-command' + ((and (file-readable-p (concat prefix localname1)) + (file-writable-p + (file-name-directory (concat prefix localname2))) + (or (file-directory-p (concat prefix localname2)) + (file-writable-p (concat prefix localname2)))) + (tramp-do-copy-or-rename-file-directly + op (concat prefix localname1) (concat prefix localname2) + ok-if-already-exists keep-date t) + ;; We must change the ownership to the local user. + (tramp-set-file-uid-gid + (concat prefix localname2) + (tramp-get-local-uid 'integer) + (tramp-get-local-gid 'integer))) + + ;; We need a temporary file in between. + (t + ;; Create the temporary file. + (let ((tmpfile (tramp-compat-make-temp-file localname1))) + (unwind-protect + (progn + (cond + (t1 + (tramp-barf-unless-okay + v (format + "%s %s %s" cmd + (tramp-shell-quote-argument localname1) + (tramp-shell-quote-argument tmpfile)) + "Copying directly failed, see buffer `%s' for details." + (tramp-get-buffer v)) + ;; We must change the ownership as remote user. + ;; Since this does not work reliable, we also + ;; give read permissions. + (set-file-modes + (concat prefix tmpfile) + (tramp-compat-octal-to-decimal "0777")) + (tramp-set-file-uid-gid + (concat prefix tmpfile) + (tramp-get-local-uid 'integer) + (tramp-get-local-gid 'integer))) + (t2 + (if (eq op 'copy) + (tramp-compat-copy-file + localname1 tmpfile t + keep-date preserve-uid-gid) + (tramp-run-real-handler + 'rename-file + (list localname1 tmpfile t))) + ;; We must change the ownership as local user. + ;; Since this does not work reliable, we also + ;; give read permissions. + (set-file-modes + tmpfile (tramp-compat-octal-to-decimal "0777")) + (tramp-set-file-uid-gid + tmpfile + (tramp-get-remote-uid v 'integer) + (tramp-get-remote-gid v 'integer)))) + + ;; Move the temporary file to its destination. + (cond + (t2 + (tramp-barf-unless-okay + v (format + "cp -f -p %s %s" + (tramp-shell-quote-argument tmpfile) + (tramp-shell-quote-argument localname2)) + "Copying directly failed, see buffer `%s' for details." + (tramp-get-buffer v))) + (t1 + (tramp-run-real-handler + 'rename-file + (list tmpfile localname2 ok-if-already-exists))))) + + ;; Save exit. + (ignore-errors (delete-file tmpfile))))))))) + + ;; Set the time and mode. Mask possible errors. + (ignore-errors + (when keep-date + (set-file-times newname file-times) + (set-file-modes newname file-modes)))))) + +(defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date) + "Invoke rcp program to copy. +The method used must be an out-of-band method." + (let* ((t1 (tramp-tramp-file-p filename)) + (t2 (tramp-tramp-file-p newname)) + (orig-vec (tramp-dissect-file-name (if t1 filename newname))) + copy-program copy-args copy-env copy-keep-date port spec + source target) + + (with-parsed-tramp-file-name (if t1 filename newname) nil + (if (and t1 t2) + + ;; Both are Tramp files. We shall optimize it, when the + ;; methods for filename and newname are the same. + (let* ((dir-flag (file-directory-p filename)) + (tmpfile (tramp-compat-make-temp-file localname dir-flag))) + (if dir-flag + (setq tmpfile + (expand-file-name + (file-name-nondirectory newname) tmpfile))) + (unwind-protect + (progn + (tramp-do-copy-or-rename-file-out-of-band + op filename tmpfile keep-date) + (tramp-do-copy-or-rename-file-out-of-band + 'rename tmpfile newname keep-date)) + ;; Save exit. + (ignore-errors + (if dir-flag + (tramp-compat-delete-directory + (expand-file-name ".." tmpfile) 'recursive) + (delete-file tmpfile))))) + + ;; Set variables for computing the prompt for reading + ;; password. + (setq tramp-current-method (tramp-file-name-method v) + tramp-current-user (tramp-file-name-user v) + tramp-current-host (tramp-file-name-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 (if t1 (tramp-make-copy-program-file-name v) filename) + target (funcall + (if (and (file-directory-p filename) + (string-equal + (file-name-nondirectory filename) + (file-name-nondirectory newname))) + 'file-name-directory + 'identity) + (if t2 (tramp-make-copy-program-file-name v) newname))) + + ;; Check for port number. Until now, there's no need for handling + ;; like method, user, host. + (setq host (tramp-file-name-real-host v) + port (tramp-file-name-port v) + port (or (and port (number-to-string port)) "")) + + ;; Compose copy command. + (setq spec (format-spec-make + ?h host ?u user ?p port + ?t (tramp-get-connection-property + (tramp-get-connection-process v) "temp-file" "") + ?k (if keep-date " " "")) + copy-program (tramp-get-method-parameter + method 'tramp-copy-program) + copy-keep-date (tramp-get-method-parameter + method 'tramp-copy-keep-date) + copy-args + (delete + ;; " " has either been a replacement of "%k" (when + ;; keep-date argument is non-nil), or a replacemtent + ;; for the whole keep-date sublist. + " " + (dolist + (x + (tramp-get-method-parameter method 'tramp-copy-args) + copy-args) + (setq copy-args + (append + copy-args + (let ((y (mapcar (lambda (z) (format-spec z spec)) x))) + (if (zerop (length (car y))) '(" ") y)))))) + copy-env + (delq + nil + (mapcar + (lambda (x) + (setq x (mapcar (lambda (y) (format-spec y spec)) x)) + (unless (member "" x) (mapconcat 'identity x " "))) + (tramp-get-method-parameter method 'tramp-copy-env)))) + + ;; Check for program. + (when (and (fboundp 'executable-find) + (not (let ((default-directory + (tramp-compat-temporary-file-directory))) + (executable-find copy-program)))) + (tramp-error + v 'file-error "Cannot find copy program: %s" copy-program)) + + (with-temp-buffer + (unwind-protect + ;; The default directory must be remote. + (let ((default-directory + (file-name-directory (if t1 filename newname))) + (process-environment (copy-sequence process-environment))) + ;; Set the transfer process properties. + (tramp-set-connection-property + v "process-name" (buffer-name (current-buffer))) + (tramp-set-connection-property + v "process-buffer" (current-buffer)) + (while copy-env + (tramp-message + orig-vec 5 "%s=\"%s\"" (car copy-env) (cadr copy-env)) + (setenv (pop copy-env) (pop copy-env))) + + ;; Use an asynchronous process. By this, password can + ;; be handled. The default directory must be local, in + ;; order to apply the correct `copy-program'. We don't + ;; set a timeout, because the copying of large files can + ;; last longer than 60 secs. + (let ((p (let ((default-directory + (tramp-compat-temporary-file-directory))) + (apply 'start-process + (tramp-get-connection-name v) + (tramp-get-connection-buffer v) + copy-program + (append copy-args (list source target)))))) + (tramp-message + orig-vec 6 "%s" + (mapconcat 'identity (process-command p) " ")) + (tramp-compat-set-process-query-on-exit-flag p nil) + (tramp-process-actions p v tramp-actions-copy-out-of-band))) + + ;; Reset the transfer process properties. + (tramp-message orig-vec 6 "%s" (buffer-string)) + (tramp-set-connection-property v "process-name" nil) + (tramp-set-connection-property v "process-buffer" nil))) + + ;; Handle KEEP-DATE argument. + (when (and keep-date (not copy-keep-date)) + (set-file-times newname (nth 5 (file-attributes filename)))) + + ;; Set the mode. + (unless (and keep-date copy-keep-date) + (ignore-errors + (set-file-modes newname (tramp-default-file-modes filename))))) + + ;; If the operation was `rename', delete the original file. + (unless (eq op 'copy) + (if (file-regular-p filename) + (delete-file filename) + (tramp-compat-delete-directory filename 'recursive)))))) + +(defun tramp-sh-handle-make-directory (dir &optional parents) + "Like `make-directory' for Tramp files." + (setq dir (expand-file-name dir)) + (with-parsed-tramp-file-name dir nil + (tramp-flush-directory-property v (file-name-directory localname)) + (save-excursion + (tramp-barf-unless-okay + v (format "%s %s" + (if parents "mkdir -p" "mkdir") + (tramp-shell-quote-argument localname)) + "Couldn't make directory %s" dir)))) + +(defun tramp-sh-handle-delete-directory (directory &optional recursive) + "Like `delete-directory' for Tramp files." + (setq directory (expand-file-name directory)) + (with-parsed-tramp-file-name directory nil + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-directory-property v localname) + (tramp-barf-unless-okay + v (format "%s %s" + (if recursive "rm -rf" "rmdir") + (tramp-shell-quote-argument localname)) + "Couldn't delete %s" directory))) + +(defun tramp-sh-handle-delete-file (filename &optional trash) + "Like `delete-file' for Tramp files." + (setq filename (expand-file-name filename)) + (with-parsed-tramp-file-name filename nil + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-file-property v localname) + (tramp-barf-unless-okay + v (format "%s %s" + (or (and trash (tramp-get-remote-trash v)) "rm -f") + (tramp-shell-quote-argument localname)) + "Couldn't delete %s" filename))) + +;; Dired. + +;; CCC: This does not seem to be enough. Something dies when +;; we try and delete two directories under Tramp :/ +(defun tramp-sh-handle-dired-recursive-delete-directory (filename) + "Recursively delete the directory given. +This is like `dired-recursive-delete-directory' for Tramp files." + (with-parsed-tramp-file-name filename nil + ;; Run a shell command 'rm -r ' + ;; Code shamelessly stolen from the dired implementation and, um, hacked :) + (unless (file-exists-p filename) + (tramp-error v 'file-error "No such directory: %s" filename)) + ;; Which is better, -r or -R? (-r works for me ) + (tramp-send-command + v + (format "rm -rf %s" (tramp-shell-quote-argument localname)) + ;; Don't read the output, do it explicitely. + nil t) + ;; Wait for the remote system to return to us... + ;; This might take a while, allow it plenty of time. + (tramp-wait-for-output (tramp-get-connection-process v) 120) + ;; Make sure that it worked... + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-directory-property v localname) + (and (file-exists-p filename) + (tramp-error + v 'file-error "Failed to recursively delete %s" filename)))) + +(defun tramp-sh-handle-dired-compress-file (file &rest ok-flag) + "Like `dired-compress-file' for Tramp files." + ;; OK-FLAG is valid for XEmacs only, but not implemented. + ;; Code stolen mainly from dired-aux.el. + (with-parsed-tramp-file-name file nil + (tramp-flush-file-property v localname) + (save-excursion + (let ((suffixes + (if (not (featurep 'xemacs)) + ;; Emacs case + (symbol-value 'dired-compress-file-suffixes) + ;; XEmacs has `dired-compression-method-alist', which is + ;; transformed into `dired-compress-file-suffixes' structure. + (mapcar + (lambda (x) + (list (concat (regexp-quote (nth 1 x)) "\\'") + nil + (mapconcat 'identity (nth 3 x) " "))) + (symbol-value 'dired-compression-method-alist)))) + suffix) + ;; See if any suffix rule matches this file name. + (while suffixes + (let (case-fold-search) + (if (string-match (car (car suffixes)) localname) + (setq suffix (car suffixes) suffixes nil)) + (setq suffixes (cdr suffixes)))) + + (cond ((file-symlink-p file) + nil) + ((and suffix (nth 2 suffix)) + ;; We found an uncompression rule. + (with-progress-reporter v 0 (format "Uncompressing %s" file) + (when (tramp-send-command-and-check + v (concat (nth 2 suffix) " " + (tramp-shell-quote-argument localname))) + ;; `dired-remove-file' is not defined in XEmacs. + (tramp-compat-funcall 'dired-remove-file file) + (string-match (car suffix) file) + (concat (substring file 0 (match-beginning 0)))))) + (t + ;; We don't recognize the file as compressed, so compress it. + ;; Try gzip. + (with-progress-reporter v 0 (format "Compressing %s" file) + (when (tramp-send-command-and-check + v (concat "gzip -f " + (tramp-shell-quote-argument localname))) + ;; `dired-remove-file' is not defined in XEmacs. + (tramp-compat-funcall 'dired-remove-file file) + (cond ((file-exists-p (concat file ".gz")) + (concat file ".gz")) + ((file-exists-p (concat file ".z")) + (concat file ".z")) + (t nil)))))))))) + +(defun tramp-sh-handle-insert-directory + (filename switches &optional wildcard full-directory-p) + "Like `insert-directory' for Tramp files." + (setq filename (expand-file-name filename)) + (with-parsed-tramp-file-name filename nil + (if (and (featurep 'ls-lisp) + (not (symbol-value 'ls-lisp-use-insert-directory-program))) + (tramp-run-real-handler + 'insert-directory (list filename switches wildcard full-directory-p)) + (when (stringp switches) + (setq switches (split-string switches))) + (when (and (member "--dired" switches) + (not (tramp-get-ls-command-with-dired v))) + (setq switches (delete "--dired" switches))) + (when wildcard + (setq wildcard (tramp-run-real-handler + 'file-name-nondirectory (list localname))) + (setq localname (tramp-run-real-handler + 'file-name-directory (list localname)))) + (unless full-directory-p + (setq switches (add-to-list 'switches "-d" 'append))) + (setq switches (mapconcat 'tramp-shell-quote-argument switches " ")) + (when wildcard + (setq switches (concat switches " " wildcard))) + (tramp-message + v 4 "Inserting directory `ls %s %s', wildcard %s, fulldir %s" + switches filename (if wildcard "yes" "no") + (if full-directory-p "yes" "no")) + ;; If `full-directory-p', we just say `ls -l FILENAME'. + ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'. + (if full-directory-p + (tramp-send-command + v + (format "%s %s %s 2>/dev/null" + (tramp-get-ls-command v) + switches + (if wildcard + localname + (tramp-shell-quote-argument (concat localname "."))))) + (tramp-barf-unless-okay + v + (format "cd %s" (tramp-shell-quote-argument + (tramp-run-real-handler + 'file-name-directory (list localname)))) + "Couldn't `cd %s'" + (tramp-shell-quote-argument + (tramp-run-real-handler 'file-name-directory (list localname)))) + (tramp-send-command + v + (format "%s %s %s" + (tramp-get-ls-command v) + switches + (if (or wildcard + (zerop (length + (tramp-run-real-handler + 'file-name-nondirectory (list localname))))) + "" + (tramp-shell-quote-argument + (tramp-run-real-handler + 'file-name-nondirectory (list localname))))))) + (let ((beg (point))) + ;; We cannot use `insert-buffer-substring' because the Tramp + ;; buffer changes its contents before insertion due to calling + ;; `expand-file' and alike. + (insert + (with-current-buffer (tramp-get-buffer v) + (buffer-string))) + + ;; Check for "--dired" output. + (forward-line -2) + (when (looking-at "//SUBDIRED//") + (forward-line -1)) + (when (looking-at "//DIRED//\\s-+") + (let ((databeg (match-end 0)) + (end (point-at-eol))) + ;; Now read the numeric positions of file names. + (goto-char databeg) + (while (< (point) end) + (let ((start (+ beg (read (current-buffer)))) + (end (+ beg (read (current-buffer))))) + (if (memq (char-after end) '(?\n ?\ )) + ;; End is followed by \n or by " -> ". + (put-text-property start end 'dired-filename t)))))) + ;; Remove trailing lines. + (goto-char (point-at-bol)) + (while (looking-at "//") + (forward-line 1) + (delete-region (match-beginning 0) (point))) + + ;; The inserted file could be from somewhere else. + (when (and (not wildcard) (not full-directory-p)) + (goto-char (point-max)) + (when (file-symlink-p filename) + (goto-char (search-backward "->" beg 'noerror))) + (search-backward + (if (zerop (length (file-name-nondirectory filename))) + "." + (file-name-nondirectory filename)) + beg 'noerror) + (replace-match (file-relative-name filename) t)) + + (goto-char (point-max)))))) + +;; Canonicalization of file names. + +(defun tramp-sh-handle-expand-file-name (name &optional dir) + "Like `expand-file-name' for Tramp files. +If the localname part of the given filename starts with \"/../\" then +the result will be a local, non-Tramp, filename." + ;; If DIR is not given, use DEFAULT-DIRECTORY or "/". + (setq dir (or dir default-directory "/")) + ;; Unless NAME is absolute, concat DIR and NAME. + (unless (file-name-absolute-p name) + (setq name (concat (file-name-as-directory dir) name))) + ;; If NAME is not a Tramp file, run the real handler. + (if (not (tramp-connectable-p name)) + (tramp-run-real-handler 'expand-file-name (list name nil)) + ;; Dissect NAME. + (with-parsed-tramp-file-name name nil + (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) + (setq localname (concat "~/" localname))) + ;; Tilde expansion if necessary. This needs a shell which + ;; groks tilde expansion! The function `tramp-find-shell' is + ;; supposed to find such a shell on the remote host. Please + ;; tell me about it when this doesn't work on your system. + (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) + (let ((uname (match-string 1 localname)) + (fname (match-string 2 localname))) + ;; We cannot simply apply "~/", because under sudo "~/" is + ;; expanded to the local user home directory but to the + ;; root home directory. On the other hand, using always + ;; the default user name for tilde expansion is not + ;; appropriate either, because ssh and companions might + ;; use a user name from the config file. + (when (and (string-equal uname "~") + (string-match "\\`su\\(do\\)?\\'" method)) + (setq uname (concat uname user))) + (setq uname + (with-connection-property v uname + (tramp-send-command + v (format "cd %s; pwd" (tramp-shell-quote-argument uname))) + (with-current-buffer (tramp-get-buffer v) + (goto-char (point-min)) + (buffer-substring (point) (point-at-eol))))) + (setq localname (concat uname fname)))) + ;; There might be a double slash, for example when "~/" + ;; expands to "/". Remove this. + (while (string-match "//" localname) + (setq localname (replace-match "/" t t localname))) + ;; No tilde characters in file name, do normal + ;; `expand-file-name' (this does "/./" and "/../"). We bind + ;; `directory-sep-char' here for XEmacs on Windows, which would + ;; otherwise use backslash. `default-directory' is bound, + ;; because on Windows there would be problems with UNC shares or + ;; Cygwin mounts. + (let ((directory-sep-char ?/) + (default-directory (tramp-compat-temporary-file-directory))) + (tramp-make-tramp-file-name + method user host + (tramp-drop-volume-letter + (tramp-run-real-handler + 'expand-file-name (list localname)))))))) + +;;; Remote commands: + +(defun tramp-sh-handle-executable-find (command) + "Like `executable-find' for Tramp files." + (with-parsed-tramp-file-name default-directory nil + (tramp-find-executable v command (tramp-get-remote-path v) t))) + +(defun tramp-process-sentinel (proc event) + "Flush file caches." + (unless (memq (process-status proc) '(run open)) + (let ((vec (tramp-get-connection-property proc "vector" nil))) + (when vec + (tramp-message vec 5 "Sentinel called: `%s' `%s'" proc event) + (tramp-flush-directory-property vec ""))))) + +;; We use BUFFER also as connection buffer during setup. Because of +;; this, its original contents must be saved, and restored once +;; connection has been setup. +(defun tramp-sh-handle-start-file-process (name buffer program &rest args) + "Like `start-file-process' for Tramp files." + (with-parsed-tramp-file-name default-directory nil - (unwind-protect - ;; When PROGRAM is nil, we just provide a tty. - (let ((command - (when (stringp program) - (format "cd %s; exec %s" - (tramp-shell-quote-argument localname) - (mapconcat 'tramp-shell-quote-argument - (cons program args) " ")))) - (tramp-process-connection-type - (or (null program) tramp-process-connection-type)) - (name1 name) - (i 0)) - (unless buffer - ;; BUFFER can be nil. We use a temporary buffer. - (setq buffer (generate-new-buffer tramp-temp-buffer-name))) - (while (get-process name1) - ;; NAME must be unique as process name. - (setq i (1+ i) - name1 (format "%s<%d>" name i))) - (setq name name1) - ;; Set the new process properties. - (tramp-set-connection-property v "process-name" name) - (tramp-set-connection-property v "process-buffer" buffer) - ;; Activate narrowing in order to save BUFFER contents. - ;; Clear also the modification time; otherwise we might be - ;; interrupted by `verify-visited-file-modtime'. - (with-current-buffer (tramp-get-connection-buffer v) - (clear-visited-file-modtime) - (narrow-to-region (point-max) (point-max))) - (if command - ;; Send the command. - (tramp-send-command v command nil t) ; nooutput - ;; Check, whether a pty is associated. - (tramp-maybe-open-connection v) - (unless (tramp-compat-process-get - (tramp-get-connection-process v) 'remote-tty) - (tramp-error - v 'file-error "pty association is not supported for `%s'" name))) - (let ((p (tramp-get-connection-process v))) - ;; Set sentinel and query flag for this process. - (tramp-set-connection-property p "vector" v) - (set-process-sentinel p 'tramp-process-sentinel) - (tramp-compat-set-process-query-on-exit-flag p t) - ;; Return process. - p)) - ;; Save exit. - (with-current-buffer (tramp-get-connection-buffer v) - (if (string-match tramp-temp-buffer-name (buffer-name)) - (progn - (set-process-buffer (tramp-get-connection-process v) nil) - (kill-buffer (current-buffer))) - (widen) - (goto-char (point-max)))) - (tramp-set-connection-property v "process-name" nil) - (tramp-set-connection-property v "process-buffer" nil)))) ++ ;; When PROGRAM is nil, we just provide a tty. ++ (let ((command ++ (when (stringp program) ++ (format "cd %s; exec %s" ++ (tramp-shell-quote-argument localname) ++ (mapconcat 'tramp-shell-quote-argument ++ (cons program args) " ")))) ++ (tramp-process-connection-type ++ (or (null program) tramp-process-connection-type)) ++ (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) ++ (name1 name) ++ (i 0)) ++ (unwind-protect ++ (save-excursion ++ (save-restriction ++ (unless buffer ++ ;; BUFFER can be nil. We use a temporary buffer. ++ (setq buffer (generate-new-buffer tramp-temp-buffer-name))) ++ (while (get-process name1) ++ ;; NAME must be unique as process name. ++ (setq i (1+ i) ++ name1 (format "%s<%d>" name i))) ++ (setq name name1) ++ ;; Set the new process properties. ++ (tramp-set-connection-property v "process-name" name) ++ (tramp-set-connection-property v "process-buffer" buffer) ++ ;; Activate narrowing in order to save BUFFER contents. ++ ;; Clear also the modification time; otherwise we might ++ ;; be interrupted by `verify-visited-file-modtime'. ++ (with-current-buffer (tramp-get-connection-buffer v) ++ (let ((buffer-undo-list t)) ++ (clear-visited-file-modtime) ++ (narrow-to-region (point-max) (point-max)) ++ (if command ++ ;; Send the command. ++ (tramp-send-command v command nil t) ; nooutput ++ ;; Check, whether a pty is associated. ++ (tramp-maybe-open-connection v) ++ (unless (tramp-compat-process-get ++ (tramp-get-connection-process v) 'remote-tty) ++ (tramp-error ++ v 'file-error ++ "pty association is not supported for `%s'" name))))) ++ (let ((p (tramp-get-connection-process v))) ++ ;; Set sentinel and query flag for this process. ++ (tramp-set-connection-property p "vector" v) ++ (set-process-sentinel p 'tramp-process-sentinel) ++ (tramp-compat-set-process-query-on-exit-flag p t) ++ ;; Return process. ++ p))) ++ ;; Save exit. ++ (with-current-buffer (tramp-get-connection-buffer v) ++ (if (string-match tramp-temp-buffer-name (buffer-name)) ++ (progn ++ (set-process-buffer (tramp-get-connection-process v) nil) ++ (kill-buffer (current-buffer))) ++ (set-buffer-modified-p bmp))) ++ (tramp-set-connection-property v "process-name" nil) ++ (tramp-set-connection-property v "process-buffer" nil))))) + +(defun tramp-sh-handle-process-file + (program &optional infile destination display &rest args) + "Like `process-file' for Tramp files." + ;; The implementation is not complete yet. + (when (and (numberp destination) (zerop destination)) + (error "Implementation does not handle immediate return")) + + (with-parsed-tramp-file-name default-directory nil + (let (command input tmpinput stderr tmpstderr outbuf ret) + ;; Compute command. + (setq command (mapconcat 'tramp-shell-quote-argument + (cons program args) " ")) + ;; Determine input. + (if (null infile) + (setq input "/dev/null") + (setq infile (expand-file-name infile)) + (if (tramp-equal-remote default-directory infile) + ;; INFILE is on the same remote host. + (setq input (with-parsed-tramp-file-name infile nil localname)) + ;; INFILE must be copied to remote host. + (setq input (tramp-make-tramp-temp-file v) + tmpinput (tramp-make-tramp-file-name method user host input)) + (copy-file infile tmpinput t))) + (when input (setq command (format "%s <%s" command input))) + + ;; Determine output. + (cond + ;; Just a buffer. + ((bufferp destination) + (setq outbuf destination)) + ;; A buffer name. + ((stringp destination) + (setq outbuf (get-buffer-create destination))) + ;; (REAL-DESTINATION ERROR-DESTINATION) + ((consp destination) + ;; output. + (cond + ((bufferp (car destination)) + (setq outbuf (car destination))) + ((stringp (car destination)) + (setq outbuf (get-buffer-create (car destination)))) + ((car destination) + (setq outbuf (current-buffer)))) + ;; stderr. + (cond + ((stringp (cadr destination)) + (setcar (cdr destination) (expand-file-name (cadr destination))) + (if (tramp-equal-remote default-directory (cadr destination)) + ;; stderr is on the same remote host. + (setq stderr (with-parsed-tramp-file-name + (cadr destination) nil localname)) + ;; stderr must be copied to remote host. The temporary + ;; file must be deleted after execution. + (setq stderr (tramp-make-tramp-temp-file v) + tmpstderr (tramp-make-tramp-file-name + method user host stderr)))) + ;; stderr to be discarded. + ((null (cadr destination)) + (setq stderr "/dev/null")))) + ;; 't + (destination + (setq outbuf (current-buffer)))) + (when stderr (setq command (format "%s 2>%s" command stderr))) + + ;; Send the command. It might not return in time, so we protect + ;; it. Call it in a subshell, in order to preserve working + ;; directory. + (condition-case nil + (unwind-protect + (setq ret + (if (tramp-send-command-and-check + v (format "\\cd %s; %s" + (tramp-shell-quote-argument localname) + command) + t t) + 0 1)) + ;; We should show the output anyway. + (when outbuf + (with-current-buffer outbuf + (insert + (with-current-buffer (tramp-get-connection-buffer v) + (buffer-string)))) + (when display (display-buffer outbuf)))) + ;; When the user did interrupt, we should do it also. We use + ;; return code -1 as marker. + (quit + (kill-buffer (tramp-get-connection-buffer v)) + (setq ret -1)) + ;; Handle errors. + (error + (kill-buffer (tramp-get-connection-buffer v)) + (setq ret 1))) + + ;; Provide error file. + (when tmpstderr (rename-file tmpstderr (cadr destination) t)) + + ;; Cleanup. We remove all file cache values for the connection, + ;; because the remote process could have changed them. + (when tmpinput (delete-file tmpinput)) + + ;; `process-file-side-effects' has been introduced with GNU + ;; Emacs 23.2. If set to `nil', no remote file will be changed + ;; by `program'. If it doesn't exist, we assume its default + ;; value 't'. + (unless (and (boundp 'process-file-side-effects) + (not (symbol-value 'process-file-side-effects))) + (tramp-flush-directory-property v "")) + + ;; Return exit status. + (if (equal ret -1) + (keyboard-quit) + ret)))) + +(defun tramp-sh-handle-call-process-region + (start end program &optional delete buffer display &rest args) + "Like `call-process-region' for Tramp files." + (let ((tmpfile (tramp-compat-make-temp-file ""))) + (write-region start end tmpfile) + (when delete (delete-region start end)) + (unwind-protect + (apply 'call-process program tmpfile buffer display args) + (delete-file tmpfile)))) + +(defun tramp-sh-handle-shell-command + (command &optional output-buffer error-buffer) + "Like `shell-command' for Tramp files." + (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command)) + ;; We cannot use `shell-file-name' and `shell-command-switch', + ;; they are variables of the local host. + (args (list + (tramp-get-method-parameter + (tramp-file-name-method + (tramp-dissect-file-name default-directory)) + 'tramp-remote-sh) + "-c" (substring command 0 asynchronous))) + current-buffer-p + (output-buffer + (cond + ((bufferp output-buffer) output-buffer) + ((stringp output-buffer) (get-buffer-create output-buffer)) + (output-buffer + (setq current-buffer-p t) + (current-buffer)) + (t (get-buffer-create + (if asynchronous + "*Async Shell Command*" + "*Shell Command Output*"))))) + (error-buffer + (cond + ((bufferp error-buffer) error-buffer) + ((stringp error-buffer) (get-buffer-create error-buffer)))) + (buffer + (if (and (not asynchronous) error-buffer) + (with-parsed-tramp-file-name default-directory nil + (list output-buffer (tramp-make-tramp-temp-file v))) + output-buffer)) + (p (get-buffer-process output-buffer))) + + ;; Check whether there is another process running. Tramp does not + ;; support 2 (asynchronous) processes in parallel. + (when p + (if (yes-or-no-p "A command is running. Kill it? ") + (ignore-errors (kill-process p)) + (error "Shell command in progress"))) + + (if current-buffer-p + (progn + (barf-if-buffer-read-only) + (push-mark nil t)) + (with-current-buffer output-buffer + (setq buffer-read-only nil) + (erase-buffer))) + + (if (and (not current-buffer-p) (integerp asynchronous)) + (prog1 + ;; Run the process. + (apply 'start-file-process "*Async Shell*" buffer args) + ;; Display output. + (pop-to-buffer output-buffer) + (setq mode-line-process '(":%s")) + (shell-mode)) + + (prog1 + ;; Run the process. + (apply 'process-file (car args) nil buffer nil (cdr args)) + ;; Insert error messages if they were separated. + (when (listp buffer) + (with-current-buffer error-buffer + (insert-file-contents (cadr buffer))) + (delete-file (cadr buffer))) + (if current-buffer-p + ;; This is like exchange-point-and-mark, but doesn't + ;; activate the mark. It is cleaner to avoid activation, + ;; even though the command loop would deactivate the mark + ;; because we inserted text. + (goto-char (prog1 (mark t) + (set-marker (mark-marker) (point) + (current-buffer)))) + ;; There's some output, display it. + (when (with-current-buffer output-buffer (> (point-max) (point-min))) + (if (functionp 'display-message-or-buffer) + (tramp-compat-funcall 'display-message-or-buffer output-buffer) + (pop-to-buffer output-buffer)))))))) + +(defun tramp-sh-handle-file-local-copy (filename) + "Like `file-local-copy' for Tramp files." + (with-parsed-tramp-file-name filename nil + (unless (file-exists-p filename) + (tramp-error + v 'file-error + "Cannot make local copy of non-existing file `%s'" filename)) + + (let* ((size (nth 7 (file-attributes (file-truename filename)))) + (rem-enc (tramp-get-inline-coding v "remote-encoding" size)) + (loc-dec (tramp-get-inline-coding v "local-decoding" size)) + (tmpfile (tramp-compat-make-temp-file filename))) + + (condition-case err + (cond + ;; `copy-file' handles direct copy and out-of-band methods. + ((or (tramp-local-host-p v) + (tramp-method-out-of-band-p v size)) + (copy-file filename tmpfile t t)) + + ;; Use inline encoding for file transfer. + (rem-enc + (save-excursion + (with-progress-reporter + v 3 (format "Encoding remote file %s" filename) + (tramp-barf-unless-okay + v (format rem-enc (tramp-shell-quote-argument localname)) + "Encoding remote file failed")) + + (if (functionp loc-dec) + ;; If local decoding is a function, we call it. We + ;; must disable multibyte, because + ;; `uudecode-decode-region' doesn't handle it + ;; correctly. + (with-temp-buffer + (set-buffer-multibyte nil) + (insert-buffer-substring (tramp-get-buffer v)) + (with-progress-reporter + v 3 (format "Decoding remote file %s with function %s" + filename loc-dec) + (funcall loc-dec (point-min) (point-max)) + ;; Unset `file-name-handler-alist'. Otherwise, + ;; epa-file gets confused. + (let (file-name-handler-alist + (coding-system-for-write 'binary)) + (write-region (point-min) (point-max) tmpfile)))) + + ;; If tramp-decoding-function is not defined for this + ;; method, we invoke tramp-decoding-command instead. + (let ((tmpfile2 (tramp-compat-make-temp-file filename))) + ;; Unset `file-name-handler-alist'. Otherwise, + ;; epa-file gets confused. + (let (file-name-handler-alist + (coding-system-for-write 'binary)) + (write-region (point-min) (point-max) tmpfile2)) + (with-progress-reporter + v 3 (format "Decoding remote file %s with command %s" + filename loc-dec) + (unwind-protect + (tramp-call-local-coding-command + loc-dec tmpfile2 tmpfile) + (delete-file tmpfile2))))) + + ;; Set proper permissions. + (set-file-modes tmpfile (tramp-default-file-modes filename)) + ;; Set local user ownership. + (tramp-set-file-uid-gid tmpfile))) + + ;; Oops, I don't know what to do. + (t (tramp-error + v 'file-error "Wrong method specification for `%s'" method))) + + ;; Error handling. + ((error quit) + (delete-file tmpfile) + (signal (car err) (cdr err)))) + + (run-hooks 'tramp-handle-file-local-copy-hook) + tmpfile))) + +;; This is needed for XEmacs only. Code stolen from files.el. +(defun tramp-sh-handle-insert-file-contents-literally + (filename &optional visit beg end replace) + "Like `insert-file-contents-literally' for Tramp files." + (let ((format-alist nil) + (after-insert-file-functions nil) + (coding-system-for-read 'no-conversion) + (coding-system-for-write 'no-conversion) + (find-buffer-file-type-function + (if (fboundp 'find-buffer-file-type) + (symbol-function 'find-buffer-file-type) + nil)) + (inhibit-file-name-handlers '(jka-compr-handler image-file-handler)) + (inhibit-file-name-operation 'insert-file-contents)) + (unwind-protect + (progn + (fset 'find-buffer-file-type (lambda (filename) t)) + (insert-file-contents filename visit beg end replace)) + ;; Save exit. + (if find-buffer-file-type-function + (fset 'find-buffer-file-type find-buffer-file-type-function) + (fmakunbound 'find-buffer-file-type))))) + +(defun tramp-sh-handle-make-auto-save-file-name () + "Like `make-auto-save-file-name' for Tramp files. +Returns a file name in `tramp-auto-save-directory' for autosaving this file." + (let ((tramp-auto-save-directory tramp-auto-save-directory) + (buffer-file-name + (tramp-subst-strs-in-string + '(("_" . "|") + ("/" . "_a") + (":" . "_b") + ("|" . "__") + ("[" . "_l") + ("]" . "_r")) + (buffer-file-name)))) + ;; File name must be unique. This is ensured with Emacs 22 (see + ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for + ;; all other cases we must do it ourselves. + (when (boundp 'auto-save-file-name-transforms) + (mapc + (lambda (x) + (when (and (string-match (car x) buffer-file-name) + (not (car (cddr x)))) + (setq tramp-auto-save-directory + (or tramp-auto-save-directory + (tramp-compat-temporary-file-directory))))) + (symbol-value 'auto-save-file-name-transforms))) + ;; Create directory. + (when tramp-auto-save-directory + (setq buffer-file-name + (expand-file-name buffer-file-name tramp-auto-save-directory)) + (unless (file-exists-p tramp-auto-save-directory) + (make-directory tramp-auto-save-directory t))) + ;; Run plain `make-auto-save-file-name'. There might be an advice when + ;; it is not a magic file name operation (since Emacs 22). + ;; We must deactivate it temporarily. + (if (not (ad-is-active 'make-auto-save-file-name)) + (tramp-run-real-handler 'make-auto-save-file-name nil) + ;; else + (ad-deactivate 'make-auto-save-file-name) + (prog1 + (tramp-run-real-handler 'make-auto-save-file-name nil) + (ad-activate 'make-auto-save-file-name))))) + +;; CCC grok LOCKNAME +(defun tramp-sh-handle-write-region + (start end filename &optional append visit lockname confirm) + "Like `write-region' for Tramp files." + (setq filename (expand-file-name filename)) + (with-parsed-tramp-file-name filename nil + ;; Following part commented out because we don't know what to do about + ;; file locking, and it does not appear to be a problem to ignore it. + ;; Ange-ftp ignores it, too. + ;; (when (and lockname (stringp lockname)) + ;; (setq lockname (expand-file-name lockname))) + ;; (unless (or (eq lockname nil) + ;; (string= lockname filename)) + ;; (error + ;; "tramp-sh-handle-write-region: LOCKNAME must be nil or equal FILENAME")) + + ;; XEmacs takes a coding system as the seventh argument, not `confirm'. + (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename)) + (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename)) + (tramp-error v 'file-error "File not overwritten"))) + + (let ((uid (or (nth 2 (tramp-compat-file-attributes filename 'integer)) + (tramp-get-remote-uid v 'integer))) + (gid (or (nth 3 (tramp-compat-file-attributes filename 'integer)) + (tramp-get-remote-gid v 'integer)))) + + (if (and (tramp-local-host-p v) + ;; `file-writable-p' calls `file-expand-file-name'. We + ;; cannot use `tramp-run-real-handler' therefore. + (let (file-name-handler-alist) + (and + (file-writable-p (file-name-directory localname)) + (or (file-directory-p localname) + (file-writable-p localname))))) + ;; Short track: if we are on the local host, we can run directly. + (tramp-run-real-handler + 'write-region + (list start end localname append 'no-message lockname confirm)) + + (let ((modes (save-excursion (tramp-default-file-modes filename))) + ;; We use this to save the value of + ;; `last-coding-system-used' after writing the tmp + ;; file. At the end of the function, we set + ;; `last-coding-system-used' to this saved value. This + ;; way, any intermediary coding systems used while + ;; talking to the remote shell or suchlike won't hose + ;; this variable. This approach was snarfed from + ;; ange-ftp.el. + coding-system-used + ;; Write region into a tmp file. This isn't really + ;; needed if we use an encoding function, but currently + ;; we use it always because this makes the logic + ;; simpler. + (tmpfile (or tramp-temp-buffer-file-name + (tramp-compat-make-temp-file filename)))) + + ;; If `append' is non-nil, we copy the file locally, and let + ;; the native `write-region' implementation do the job. + (when append (copy-file filename tmpfile 'ok)) + + ;; We say `no-message' here because we don't want the + ;; visited file modtime data to be clobbered from the temp + ;; file. We call `set-visited-file-modtime' ourselves later + ;; on. We must ensure that `file-coding-system-alist' + ;; matches `tmpfile'. + (let (file-name-handler-alist + (file-coding-system-alist + (tramp-find-file-name-coding-system-alist filename tmpfile))) + (condition-case err + (tramp-run-real-handler + 'write-region + (list start end tmpfile append 'no-message lockname confirm)) + ((error quit) + (setq tramp-temp-buffer-file-name nil) + (delete-file tmpfile) + (signal (car err) (cdr err)))) + + ;; Now, `last-coding-system-used' has the right value. Remember it. + (when (boundp 'last-coding-system-used) + (setq coding-system-used + (symbol-value 'last-coding-system-used)))) + + ;; The permissions of the temporary file should be set. If + ;; filename does not exist (eq modes nil) it has been + ;; renamed to the backup file. This case `save-buffer' + ;; handles permissions. + ;; Ensure, that it is still readable. + (when modes + (set-file-modes + tmpfile + (logior (or modes 0) (tramp-compat-octal-to-decimal "0400")))) + + ;; This is a bit lengthy due to the different methods + ;; possible for file transfer. First, we check whether the + ;; method uses an rcp program. If so, we call it. + ;; Otherwise, both encoding and decoding command must be + ;; specified. However, if the method _also_ specifies an + ;; encoding function, then that is used for encoding the + ;; contents of the tmp file. + (let* ((size (nth 7 (file-attributes tmpfile))) + (rem-dec (tramp-get-inline-coding v "remote-decoding" size)) + (loc-enc (tramp-get-inline-coding v "local-encoding" size))) + (cond + ;; `copy-file' handles direct copy and out-of-band methods. + ((or (tramp-local-host-p v) + (tramp-method-out-of-band-p v size)) + (if (and (not (stringp start)) + (= (or end (point-max)) (point-max)) + (= (or start (point-min)) (point-min)) + (tramp-get-method-parameter + method 'tramp-copy-keep-tmpfile)) + (progn + (setq tramp-temp-buffer-file-name tmpfile) + (condition-case err + ;; We keep the local file for performance + ;; reasons, useful for "rsync". + (copy-file tmpfile filename t) + ((error quit) + (setq tramp-temp-buffer-file-name nil) + (delete-file tmpfile) + (signal (car err) (cdr err))))) + (setq tramp-temp-buffer-file-name nil) + ;; Don't rename, in order to keep context in SELinux. + (unwind-protect + (copy-file tmpfile filename t) + (delete-file tmpfile)))) + + ;; Use inline file transfer. + (rem-dec + ;; Encode tmpfile. + (unwind-protect + (with-temp-buffer + (set-buffer-multibyte nil) + ;; Use encoding function or command. + (if (functionp loc-enc) + (with-progress-reporter + v 3 (format "Encoding region using function `%s'" + loc-enc) + (let ((coding-system-for-read 'binary)) + (insert-file-contents-literally tmpfile)) + ;; The following `let' is a workaround for the + ;; base64.el that comes with pgnus-0.84. If + ;; both of the following conditions are + ;; satisfied, it tries to write to a local + ;; file in default-directory, but at this + ;; point, default-directory is remote. + ;; (`call-process-region' can't write to + ;; remote files, it seems.) The file in + ;; question is a tmp file anyway. + (let ((default-directory + (tramp-compat-temporary-file-directory))) + (funcall loc-enc (point-min) (point-max)))) + + (with-progress-reporter + v 3 (format "Encoding region using command `%s'" + loc-enc) + (unless (zerop (tramp-call-local-coding-command + loc-enc tmpfile t)) + (tramp-error + v 'file-error + (concat "Cannot write to `%s', " + "local encoding command `%s' failed") + filename loc-enc)))) + + ;; Send buffer into remote decoding command which + ;; writes to remote file. Because this happens on + ;; the remote host, we cannot use the function. + (with-progress-reporter + v 3 + (format "Decoding region into remote file %s" filename) + (goto-char (point-max)) + (unless (bolp) (newline)) + (tramp-send-command + v + (format + (concat rem-dec " <<'EOF'\n%sEOF") + (tramp-shell-quote-argument localname) + (buffer-string))) + (tramp-barf-unless-okay + v nil + "Couldn't write region to `%s', decode using `%s' failed" + filename rem-dec) + ;; When `file-precious-flag' is set, the region is + ;; written to a temporary file. Check that the + ;; checksum is equal to that from the local tmpfile. + (when file-precious-flag + (erase-buffer) + (and + ;; cksum runs locally, if possible. + (zerop (tramp-compat-call-process "cksum" tmpfile t)) + ;; cksum runs remotely. + (tramp-send-command-and-check + v + (format + "cksum <%s" (tramp-shell-quote-argument localname))) + ;; ... they are different. + (not + (string-equal + (buffer-string) + (with-current-buffer (tramp-get-buffer v) + (buffer-string)))) + (tramp-error + v 'file-error + (concat "Couldn't write region to `%s'," + " decode using `%s' failed") + filename rem-dec))))) + + ;; Save exit. + (delete-file tmpfile))) + + ;; That's not expected. + (t + (tramp-error + v 'file-error + (concat "Method `%s' should specify both encoding and " + "decoding command or an rcp program") + method)))) + + ;; Make `last-coding-system-used' have the right value. + (when coding-system-used + (set 'last-coding-system-used coding-system-used)))) + + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-file-property v localname) + + ;; We must protect `last-coding-system-used', now we have set it + ;; to its correct value. + (let (last-coding-system-used (need-chown t)) + ;; Set file modification time. + (when (or (eq visit t) (stringp visit)) + (let ((file-attr (file-attributes filename))) + (set-visited-file-modtime + ;; We must pass modtime explicitely, because filename can + ;; be different from (buffer-file-name), f.e. if + ;; `file-precious-flag' is set. + (nth 5 file-attr)) + (when (and (eq (nth 2 file-attr) uid) + (eq (nth 3 file-attr) gid)) + (setq need-chown nil)))) + + ;; Set the ownership. + (when need-chown + (tramp-set-file-uid-gid filename uid gid)) + (when (or (eq visit t) (null visit) (stringp visit)) + (tramp-message v 0 "Wrote %s" filename)) + (run-hooks 'tramp-handle-write-region-hook))))) + +(defvar tramp-vc-registered-file-names nil + "List used to collect file names, which are checked during `vc-registered'.") + +;; VC backends check for the existence of various different special +;; files. This is very time consuming, because every single check +;; requires a remote command (the file cache must be invalidated). +;; Therefore, we apply a kind of optimization. We install the file +;; name handler `tramp-vc-file-name-handler', which does nothing but +;; remembers all file names for which `file-exists-p' or +;; `file-readable-p' has been applied. A first run of `vc-registered' +;; is performed. Afterwards, a script is applied for all collected +;; file names, using just one remote command. The result of this +;; script is used to fill the file cache with actual values. Now we +;; can reset the file name handlers, and we make a second run of +;; `vc-registered', which returns the expected result without sending +;; any other remote command. +(defun tramp-sh-handle-vc-registered (file) + "Like `vc-registered' for Tramp files." + (tramp-compat-with-temp-message "" + (with-parsed-tramp-file-name file nil + (with-progress-reporter + v 3 (format "Checking `vc-registered' for %s" file) + + ;; There could be new files, created by the vc backend. We + ;; cannot reuse the old cache entries, therefore. + (let (tramp-vc-registered-file-names + (remote-file-name-inhibit-cache (current-time)) + (file-name-handler-alist + `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) + + ;; Here we collect only file names, which need an operation. + (tramp-run-real-handler 'vc-registered (list file)) + (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) + + ;; Send just one command, in order to fill the cache. + (when tramp-vc-registered-file-names + (tramp-maybe-send-script + v + (format tramp-vc-registered-read-file-names + (tramp-get-file-exists-command v) + (format "%s -r" (tramp-get-test-command v))) + "tramp_vc_registered_read_file_names") + + (dolist + (elt + (tramp-send-command-and-read + v + (format + "tramp_vc_registered_read_file_names <<'EOF'\n%s\nEOF\n" + (mapconcat 'tramp-shell-quote-argument + tramp-vc-registered-file-names + "\n")))) + + (tramp-set-file-property + v (car elt) (cadr elt) (cadr (cdr elt)))))) + + ;; Second run. Now all `file-exists-p' or `file-readable-p' + ;; calls shall be answered from the file cache. We unset + ;; `process-file-side-effects' in order to keep the cache when + ;; `process-file' calls appear. + (let (process-file-side-effects) + (tramp-run-real-handler 'vc-registered (list file))))))) + +;;;###tramp-autoload +(defun tramp-sh-file-name-handler (operation &rest args) + "Invoke remote-shell Tramp file name handler. +Fall back to normal file name handler if no Tramp handler exists." + (when (and tramp-locked (not tramp-locker)) + (setq tramp-locked nil) + (signal 'file-error (list "Forbidden reentrant call of Tramp"))) + (let ((tl tramp-locked)) + (unwind-protect + (progn + (setq tramp-locked t) + (let ((tramp-locker t)) + (save-match-data + (let ((fn (assoc operation tramp-sh-file-name-handler-alist))) + (if fn + (apply (cdr fn) args) + (tramp-run-real-handler operation args)))))) + (setq tramp-locked tl)))) + +(defun tramp-vc-file-name-handler (operation &rest args) + "Invoke special file name handler, which collects files to be handled." + (save-match-data + (let ((filename + (tramp-replace-environment-variables + (apply 'tramp-file-name-for-operation operation args))) + (fn (assoc operation tramp-sh-file-name-handler-alist))) + (with-parsed-tramp-file-name filename nil + (cond + ;; That's what we want: file names, for which checks are + ;; applied. We assume, that VC uses only `file-exists-p' and + ;; `file-readable-p' checks; otherwise we must extend the + ;; list. We do not perform any action, but return nil, in + ;; order to keep `vc-registered' running. + ((and fn (memq operation '(file-exists-p file-readable-p))) + (add-to-list 'tramp-vc-registered-file-names localname 'append) + nil) + ;; Tramp file name handlers like `expand-file-name'. They + ;; must still work. + (fn + (save-match-data (apply (cdr fn) args))) + ;; Default file name handlers, we don't care. + (t (tramp-run-real-handler operation args))))))) + +;;; Internal Functions: + +(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-barf-unless-okay + vec + (format "%s () {\n%s\n}" name + (format script (tramp-get-remote-perl vec))) + "Script %s sending failed" name) + (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))) + +(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." + (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)))))) + +(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. + +Returns the absolute file name of PROGNAME, if found, and nil otherwise. + +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) (point-at-eol))))) + 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))) + (tramp-send-command-and-check + vec (format "%s %s" result existing)) + (not (tramp-send-command-and-check + vec (format "%s %s" result nonexisting)))) + (and (setq result "/bin/test -e") + (tramp-send-command-and-check + vec (format "%s %s" result existing)) + (not (tramp-send-command-and-check + vec (format "%s %s" result nonexisting)))) + (and (setq result "/usr/bin/test -e") + (tramp-send-command-and-check + vec (format "%s %s" result existing)) + (not (tramp-send-command-and-check + vec (format "%s %s" result nonexisting)))) + (and (setq result (format "%s -d" (tramp-get-ls-command vec))) + (tramp-send-command-and-check + vec (format "%s %s" result existing)) + (not (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-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))))))))) + +;; Utility functions. + +(defun tramp-barf-if-no-shell-prompt (proc timeout &rest error-args) + "Wait for shell prompt and barf if none appears. +Looks at process PROC to see if a shell prompt appears in TIMEOUT +seconds. If not, it produces an error message with the given ERROR-ARGS." + (unless + (tramp-wait-for-regexp + proc timeout + (format + "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern)) + (apply 'tramp-error-with-buffer nil proc 'file-error error-args))) + +(defun tramp-open-connection-setup-interactive-shell (proc vec) + "Set up an interactive shell. +Mainly sets the prompt and the echo correctly. PROC is the shell +process to set up. VEC specifies the connection." + (let ((tramp-end-of-output tramp-initial-end-of-output)) + ;; It is useful to set the prompt in the following command because + ;; some people have a setting for $PS1 which /bin/sh doesn't know + ;; about and thus /bin/sh will display a strange prompt. For + ;; example, if $PS1 has "${CWD}" in the value, then ksh will + ;; display the current working directory but /bin/sh will display + ;; a dollar sign. The following command line sets $PS1 to a sane + ;; value, and works under Bourne-ish shells as well as csh-like + ;; shells. Daniel Pittman reports that the unusual positioning of + ;; the single quotes makes it work under `rc', too. We also unset + ;; the variable $ENV because that is read by some sh + ;; implementations (eg, bash when called as sh) on startup; this + ;; way, we avoid the startup file clobbering $PS1. $PROMPT_COMMAND + ;; is another way to set the prompt in /bin/bash, it must be + ;; discarded as well. + (tramp-open-shell + vec + (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-remote-sh)) + + ;; Disable echo. + (tramp-message vec 5 "Setting up remote shell environment") + (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t) + ;; Check whether the echo has really been disabled. Some + ;; implementations, like busybox of embedded GNU/Linux, don't + ;; support disabling. + (tramp-send-command vec "echo foo" t) + (with-current-buffer (process-buffer proc) + (goto-char (point-min)) + (when (looking-at "echo foo") + (tramp-set-connection-property proc "remote-echo" t) + (tramp-message vec 5 "Remote echo still on. Ok.") + ;; Make sure backspaces and their echo are enabled and no line + ;; width magic interferes with them. + (tramp-send-command vec "stty icanon erase ^H cols 32767" t)))) + + (tramp-message vec 5 "Setting shell prompt") + (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) + + ;; Try to set up the coding system correctly. + ;; CCC this can't be the right way to do it. Hm. + (tramp-message vec 5 "Determining coding system") + (tramp-send-command vec "echo foo ; echo bar" t) + (with-current-buffer (process-buffer proc) + (goto-char (point-min)) + (if (featurep 'mule) + ;; Use MULE to select the right EOL convention for communicating + ;; with the process. + (let* ((cs (or (tramp-compat-funcall 'process-coding-system proc) + (cons 'undecided 'undecided))) + cs-decode cs-encode) + (when (symbolp cs) (setq cs (cons cs cs))) + (setq cs-decode (car cs)) + (setq cs-encode (cdr cs)) + (unless cs-decode (setq cs-decode 'undecided)) + (unless cs-encode (setq cs-encode 'undecided)) + (setq cs-encode (tramp-compat-coding-system-change-eol-conversion + cs-encode 'unix)) + (when (search-forward "\r" nil t) + (setq cs-decode (tramp-compat-coding-system-change-eol-conversion + cs-decode 'dos))) + (tramp-compat-funcall + 'set-buffer-process-coding-system cs-decode cs-encode) + (tramp-message + vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) + ;; Look for ^M and do something useful if found. + (when (search-forward "\r" nil t) + ;; We have found a ^M but cannot frob the process coding system + ;; because we're running on a non-MULE Emacs. Let's try + ;; stty, instead. + (tramp-send-command vec "stty -onlcr" t)))) + + (tramp-send-command vec "set +o vi +o emacs" t) + + ;; Check whether the output of "uname -sr" has been changed. If + ;; yes, this is a strong indication that we must expire all + ;; connection properties. We start again with + ;; `tramp-maybe-open-connection', it will be catched there. + (tramp-message vec 5 "Checking system information") + (let ((old-uname (tramp-get-connection-property vec "uname" nil)) + (new-uname + (tramp-set-connection-property + vec "uname" + (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) + (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) + (with-current-buffer (tramp-get-debug-buffer vec) + ;; Keep the debug buffer. + (rename-buffer + (generate-new-buffer-name tramp-temp-buffer-name) 'unique) + (tramp-cleanup-connection vec) + (if (= (point-min) (point-max)) + (kill-buffer nil) + (rename-buffer (tramp-debug-buffer-name vec) 'unique)) + ;; We call `tramp-get-buffer' in order to keep the debug buffer. + (tramp-get-buffer vec) + (tramp-message + vec 3 + "Connection reset, because remote host changed from `%s' to `%s'" + old-uname new-uname) + (throw 'uname-changed (tramp-maybe-open-connection vec))))) + + ;; Check whether the remote host suffers from buggy + ;; `send-process-string'. This is known for FreeBSD (see comment in + ;; `send_process', file process.c). I've tested sending 624 bytes + ;; successfully, sending 625 bytes failed. Emacs makes a hack when + ;; this host type is detected locally. It cannot handle remote + ;; hosts, though. + (with-connection-property proc "chunksize" + (cond + ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) + tramp-chunksize) + (t + (tramp-message + vec 5 "Checking remote host type for `send-process-string' bug") + (if (string-match + "^FreeBSD" (tramp-get-connection-property vec "uname" "")) + 500 0)))) + + ;; Set remote PATH variable. + (tramp-set-remote-path vec) + + ;; Search for a good shell before searching for a command which + ;; checks if a file exists. This is done because Tramp wants to use + ;; "test foo; echo $?" to check if various conditions hold, and + ;; there are buggy /bin/sh implementations which don't execute the + ;; "echo $?" part if the "test" part has an error. In particular, + ;; the OpenSolaris /bin/sh is a problem. There are also other + ;; problems with /bin/sh of OpenSolaris, like redirection of stderr + ;; in function declarations, or changing HISTFILE in place. + ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when + ;; detected. + (tramp-find-shell vec) + + ;; Disable unexpected output. + (tramp-send-command vec "mesg n; biff n" t) + + ;; IRIX64 bash expands "!" even when in single quotes. This + ;; destroys our shell functions, we must disable it. See + ;; . + (when (string-match "^IRIX64" (tramp-get-connection-property vec "uname" "")) + (tramp-send-command vec "set +H" t)) + + ;; On BSD-like systems, ?\t is expanded to spaces. Suppress this. + (when (string-match "BSD\\|Darwin" + (tramp-get-connection-property vec "uname" "")) + (tramp-send-command vec "stty -oxtabs" t)) + + ;; Set `remote-tty' process property. + (ignore-errors + (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\""))) + (unless (zerop (length tty)) + (tramp-compat-process-put proc 'remote-tty tty)))) + + ;; Dump stty settings in the traces. + (when (>= tramp-verbose 9) + (tramp-send-command vec "stty -a" t)) + + ;; Set the environment. + (tramp-message vec 5 "Setting default environment") + + (let ((env (copy-sequence tramp-remote-process-environment)) + unset item) + (while env + (setq item (tramp-compat-split-string (car env) "=")) + (setcdr item (mapconcat 'identity (cdr item) "=")) + (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) + (tramp-send-command + vec (format "%s=%s; export %s" (car item) (cdr item) (car item)) t) + (push (car item) unset)) + (setq env (cdr env))) + (when unset + (tramp-send-command + vec (format "unset %s" (mapconcat 'identity unset " ")) t)))) + +;; CCC: We should either implement a Perl version of base64 encoding +;; and decoding. Then we just use that in the last item. The other +;; alternative is to use the Perl version of UU encoding. But then +;; we need a Lisp version of uuencode. +;; +;; Old text from documentation of tramp-methods: +;; Using a uuencode/uudecode inline method is discouraged, please use one +;; of the base64 methods instead since base64 encoding is much more +;; reliable and the commands are more standardized between the different +;; Unix versions. But if you can't use base64 for some reason, please +;; note that the default uudecode command does not work well for some +;; Unices, in particular AIX and Irix. For AIX, you might want to use +;; the following command for uudecode: +;; +;; sed '/^begin/d;/^[` ]$/d;/^end/d' | iconv -f uucode -t ISO8859-1 +;; +;; For Irix, no solution is known yet. + +(autoload 'uudecode-decode-region "uudecode") + +(defconst tramp-local-coding-commands + '((b64 base64-encode-region base64-decode-region) + (uu tramp-uuencode-region uudecode-decode-region) + (pack + "perl -e 'binmode STDIN; binmode STDOUT; print pack(q{u*}, join q{}, <>)'" + "perl -e 'binmode STDIN; binmode STDOUT; print unpack(q{u*}, join q{}, <>)'")) + "List of local coding commands for inline transfer. +Each item is a list that looks like this: + +\(FORMAT ENCODING DECODING\) + +FORMAT is symbol describing the encoding/decoding format. It can be +`b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing. + +ENCODING and DECODING can be strings, giving commands, or symbols, +giving functions. If they are strings, then they can contain +the \"%s\" format specifier. If that specifier is present, the input +filename will be put into the command line at that spot. If the +specifier is not present, the input should be read from standard +input. + +If they are functions, they will be called with two arguments, start +and end of region, and are expected to replace the region contents +with the encoded or decoded results, respectively.") + +(defconst tramp-remote-coding-commands + '((b64 "base64" "base64 -d -i") + ;; "-i" is more robust with older base64 from GNU coreutils. + ;; However, I don't know whether all base64 versions do supports + ;; this option. + (b64 "base64" "base64 -d") + (b64 "mimencode -b" "mimencode -u -b") + (b64 "mmencode -b" "mmencode -u -b") + (b64 "recode data..base64" "recode base64..data") + (b64 tramp-perl-encode-with-module tramp-perl-decode-with-module) + (b64 tramp-perl-encode tramp-perl-decode) + (uu "uuencode xxx" "uudecode -o /dev/stdout") + (uu "uuencode xxx" "uudecode -o -") + (uu "uuencode xxx" "uudecode -p") + (uu "uuencode xxx" tramp-uudecode) + (pack + "perl -e 'binmode STDIN; binmode STDOUT; print pack(q{u*}, join q{}, <>)'" + "perl -e 'binmode STDIN; binmode STDOUT; print unpack(q{u*}, join q{}, <>)'")) + "List of remote coding commands for inline transfer. +Each item is a list that looks like this: + +\(FORMAT ENCODING DECODING\) + +FORMAT is symbol describing the encoding/decoding format. It can be +`b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing. + +ENCODING and DECODING can be strings, giving commands, or symbols, +giving variables. If they are strings, then they can contain +the \"%s\" format specifier. If that specifier is present, the input +filename will be put into the command line at that spot. If the +specifier is not present, the input should be read from standard +input. + +If they are variables, this variable is a string containing a Perl +implementation for this functionality. This Perl program will be transferred +to the remote host, and it is available as shell function with the same name.") + +(defun tramp-find-inline-encoding (vec) + "Find an inline transfer encoding that works. +Goes through the list `tramp-local-coding-commands' and +`tramp-remote-coding-commands'." + (save-excursion + (let ((local-commands tramp-local-coding-commands) + (magic "xyzzy") + loc-enc loc-dec rem-enc rem-dec litem ritem found) + (while (and local-commands (not found)) + (setq litem (pop local-commands)) + (catch 'wont-work-local + (let ((format (nth 0 litem)) + (remote-commands tramp-remote-coding-commands)) + (setq loc-enc (nth 1 litem)) + (setq loc-dec (nth 2 litem)) + ;; If the local encoder or decoder is a string, the + ;; corresponding command has to work locally. + (if (not (stringp loc-enc)) + (tramp-message + vec 5 "Checking local encoding function `%s'" loc-enc) + (tramp-message + vec 5 "Checking local encoding command `%s' for sanity" loc-enc) + (unless (zerop (tramp-call-local-coding-command + loc-enc nil nil)) + (throw 'wont-work-local nil))) + (if (not (stringp loc-dec)) + (tramp-message + vec 5 "Checking local decoding function `%s'" loc-dec) + (tramp-message + vec 5 "Checking local decoding command `%s' for sanity" loc-dec) + (unless (zerop (tramp-call-local-coding-command + loc-dec nil nil)) + (throw 'wont-work-local nil))) + ;; Search for remote coding commands with the same format + (while (and remote-commands (not found)) + (setq ritem (pop remote-commands)) + (catch 'wont-work-remote + (when (equal format (nth 0 ritem)) + (setq rem-enc (nth 1 ritem)) + (setq rem-dec (nth 2 ritem)) + ;; Check if remote encoding and decoding commands can be + ;; called remotely with null input and output. This makes + ;; sure there are no syntax errors and the command is really + ;; found. Note that we do not redirect stdout to /dev/null, + ;; for two reasons: when checking the decoding command, we + ;; actually check the output it gives. And also, when + ;; redirecting "mimencode" output to /dev/null, then as root + ;; it might change the permissions of /dev/null! + (when (not (stringp rem-enc)) + (let ((name (symbol-name rem-enc))) + (while (string-match (regexp-quote "-") name) + (setq name (replace-match "_" nil t name))) + (tramp-maybe-send-script vec (symbol-value rem-enc) name) + (setq rem-enc name))) + (tramp-message + vec 5 + "Checking remote encoding command `%s' for sanity" rem-enc) + (unless (tramp-send-command-and-check + vec (format "%s " output) "")))) + +(defconst tramp-inline-compress-commands + '(("gzip" "gzip -d") + ("bzip2" "bzip2 -d") + ("compress" "compress -d")) + "List of compress and decompress commands for inline transfer. +Each item is a list that looks like this: + +\(COMPRESS DECOMPRESS\) + +COMPRESS or DECOMPRESS are strings with the respective commands.") + +(defun tramp-find-inline-compress (vec) + "Find an inline transfer compress command that works. +Goes through the list `tramp-inline-compress-commands'." + (save-excursion + (let ((commands tramp-inline-compress-commands) + (magic "xyzzy") + item compress decompress + found) + (while (and commands (not found)) + (catch 'next + (setq item (pop commands) + compress (nth 0 item) + decompress (nth 1 item)) + (tramp-message + vec 5 + "Checking local compress command `%s', `%s' for sanity" + compress decompress) + (unless (zerop (tramp-call-local-coding-command + (format "echo %s | %s | %s" + magic compress decompress) nil nil)) + (throw 'next nil)) + (tramp-message + vec 5 + "Checking remote compress command `%s', `%s' for sanity" + compress decompress) + (unless (tramp-send-command-and-check + vec (format "echo %s | %s | %s" magic compress decompress) t) + (throw 'next nil)) + (setq found t))) + + ;; Did we find something? + (if found + (progn + ;; Set connection properties. + (tramp-message + vec 5 "Using inline transfer compress command `%s'" compress) + (tramp-set-connection-property vec "inline-compress" compress) + (tramp-message + vec 5 "Using inline transfer decompress command `%s'" decompress) + (tramp-set-connection-property vec "inline-decompress" decompress)) + + (tramp-set-connection-property vec "inline-compress" nil) + (tramp-set-connection-property vec "inline-decompress" nil) + (tramp-message + 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." + (let ((target-alist `(,vec)) + (choices tramp-default-proxies-alist) + item proxy) + + ;; Look for proxy hosts to be passed. + (while choices + (setq item (pop choices) + proxy (eval (nth 2 item))) + (when (and + ;; host + (string-match (or (eval (nth 0 item)) "") + (or (tramp-file-name-host (car target-alist)) "")) + ;; user + (string-match (or (eval (nth 1 item)) "") + (or (tramp-file-name-user (car target-alist)) ""))) + (if (null proxy) + ;; No more hops needed. + (setq choices nil) + ;; Replace placeholders. + (setq proxy + (format-spec + proxy + (format-spec-make + ?u (or (tramp-file-name-user (car target-alist)) "") + ?h (or (tramp-file-name-host (car target-alist)) "")))) + (with-parsed-tramp-file-name proxy l + ;; Add the hop. + (add-to-list 'target-alist l) + ;; Start next search. + (setq choices tramp-default-proxies-alist))))) + + ;; Handle gateways. + (when (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. + (add-to-list + 'target-alist + (vector + (tramp-file-name-method hop) (tramp-file-name-user hop) + (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil)) + ;; 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. + (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) + (while choices + (setq item (pop choices)) + (when + (or + (not + (tramp-get-method-parameter + (tramp-file-name-method item) 'tramp-login-program)) + (tramp-get-method-parameter + (tramp-file-name-method item) 'tramp-copy-program)) + (tramp-error + vec 'file-error + "Method `%s' is not supported for multi-hops." + (tramp-file-name-method item))))) + + ;; In case the host name is not used for the remote shell + ;; command, the user could be misguided by applying a random + ;; hostname. + (let* ((v (car target-alist)) + (method (tramp-file-name-method v)) + (host (tramp-file-name-host v))) + (unless + (or + ;; There are multi-hops. + (cdr target-alist) + ;; The host name is used for the remote shell command. + (member + '("%h") (tramp-get-method-parameter method 'tramp-login-args)) + ;; The host is local. We cannot use `tramp-local-host-p' + ;; here, because it opens a connection as well. + (string-match tramp-local-host-regexp host)) + (tramp-error + v 'file-error + "Host `%s' looks like a remote host, `%s' can only use the local host" + host method))) + + ;; Result. + target-alist)) + +(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 +connection if a previous connection has died for some reason." + (catch 'uname-changed + (let ((p (tramp-get-connection-process vec)) + (process-name (tramp-get-connection-property vec "process-name" nil)) + (process-environment (copy-sequence process-environment))) + + ;; If too much time has passed since last command was sent, look + ;; whether process is still alive. If it isn't, kill it. When + ;; using ssh, it can sometimes happen that the remote end has + ;; hung up but the local ssh client doesn't recognize this until + ;; it tries to send some data to the remote end. So that's why + ;; we try to send a command from time to time, then look again + ;; whether the process is really alive. + (condition-case nil + (when (and (> (tramp-time-diff + (current-time) + (tramp-get-connection-property + p "last-cmd-time" '(0 0 0))) + 60) + p (processp p) (memq (process-status p) '(run open))) + (tramp-send-command vec "echo are you awake" t t) + (unless (and (memq (process-status p) '(run open)) + (tramp-wait-for-output p 10)) + ;; The error will be catched locally. + (tramp-error vec 'file-error "Awake did fail"))) + (file-error + (tramp-flush-connection-property vec) + (tramp-flush-connection-property p) + (delete-process p) + (setq p nil))) + + ;; New connection must be opened. + (unless (and p (processp p) (memq (process-status p) '(run open))) + + ;; We call `tramp-get-buffer' in order to get a debug buffer for + ;; messages from the beginning. + (tramp-get-buffer vec) + (with-progress-reporter + vec 3 + (if (zerop (length (tramp-file-name-user vec))) + (format "Opening connection for %s using %s" + (tramp-file-name-host vec) + (tramp-file-name-method vec)) + (format "Opening connection for %s@%s using %s" + (tramp-file-name-user vec) + (tramp-file-name-host vec) + (tramp-file-name-method vec))) + + ;; Start new process. + (when (and p (processp p)) + (delete-process p)) + (setenv "TERM" tramp-terminal-type) + (setenv "LC_ALL" "C") + (setenv "PROMPT_COMMAND") + (setenv "PS1" tramp-initial-end-of-output) + (let* ((target-alist (tramp-compute-multi-hops vec)) + (process-connection-type tramp-process-connection-type) + (process-adaptive-read-buffering nil) + (coding-system-for-read nil) + ;; This must be done in order to avoid our file name handler. + (p (let ((default-directory + (tramp-compat-temporary-file-directory))) + (start-process + (tramp-get-connection-name vec) + (tramp-get-connection-buffer vec) + tramp-encoding-shell)))) + + (tramp-message + vec 6 "%s" (mapconcat 'identity (process-command p) " ")) + + ;; Check whether process is alive. + (tramp-compat-set-process-query-on-exit-flag p nil) + (tramp-barf-if-no-shell-prompt + p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell) + + ;; Now do all the connections as specified. + (while target-alist + (let* ((hop (car target-alist)) + (l-method (tramp-file-name-method hop)) + (l-user (tramp-file-name-user hop)) + (l-host (tramp-file-name-host hop)) + (l-port nil) + (login-program + (tramp-get-method-parameter + l-method 'tramp-login-program)) + (login-args + (tramp-get-method-parameter l-method 'tramp-login-args)) + (async-args + (tramp-get-method-parameter l-method 'tramp-async-args)) + (gw-args + (tramp-get-method-parameter l-method 'tramp-gw-args)) + (gw (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-host gw))) + (command login-program) + ;; We don't create the temporary file. In fact, + ;; it is just a prefix for the ControlPath option + ;; of ssh; the real temporary file has another + ;; name, and it is created and protected by ssh. + ;; It is also removed by ssh, when the connection + ;; is closed. + (tmpfile + (tramp-set-connection-property + p "temp-file" + (make-temp-name + (expand-file-name + tramp-temp-name-prefix + (tramp-compat-temporary-file-directory))))) + spec) + + ;; Add arguments for asynchrononous processes. + (when (and process-name async-args) + (setq login-args (append async-args login-args))) + + ;; Add gateway arguments if necessary. + (when (and gw 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) + (setq l-port (match-string 2 l-host) + l-host (match-string 1 l-host))) + + ;; 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)) + + ;; Replace login-args place holders. + (setq + l-host (or l-host "") + l-user (or l-user "") + l-port (or l-port "") + spec (format-spec-make + ?h l-host ?u l-user ?p l-port ?t tmpfile) + command + (concat + ;; We do not want to see the trailing local prompt in + ;; `start-file-process'. + (unless (memq system-type '(windows-nt)) "exec ") + command " " + (mapconcat + (lambda (x) + (setq x (mapcar (lambda (y) (format-spec y spec)) x)) + (unless (member "" x) (mapconcat 'identity x " "))) + login-args " ") + ;; Local shell could be a Windows COMSPEC. It + ;; doesn't know the ";" syntax, but we must exit + ;; always for `start-file-process'. "exec" does not + ;; work either. + (if (memq system-type '(windows-nt)) " && exit || exit"))) + + ;; Send the command. + (tramp-message vec 3 "Sending command `%s'" command) + (tramp-send-command vec command t t) + (tramp-process-actions p vec tramp-actions-before-shell 60) + (tramp-message + vec 3 "Found remote shell prompt on `%s'" l-host)) + ;; Next hop. + (setq target-alist (cdr target-alist))) + + ;; Make initial shell settings. + (tramp-open-connection-setup-interactive-shell p vec))))))) + +(defun tramp-send-command (vec command &optional neveropen nooutput) + "Send the COMMAND to connection VEC. +Erases temporary buffer before sending the command. If optional +arg NEVEROPEN is non-nil, never try to open the connection. This +is meant to be used from `tramp-maybe-open-connection' only. The +function waits for output unless NOOUTPUT is set." + (unless neveropen (tramp-maybe-open-connection vec)) + (let ((p (tramp-get-connection-process vec))) + (when (tramp-get-connection-property p "remote-echo" nil) + ;; We mark the command string that it can be erased in the output buffer. + (tramp-set-connection-property p "check-remote-echo" t) + (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark))) + (when (string-match "<<'EOF'" command) + ;; Unset $PS1 when using here documents, in order to avoid + ;; multiple prompts. + (setq command (concat "(PS1= ; " command "\n)"))) + ;; Send the command. + (tramp-message vec 6 "%s" command) + (tramp-send-string vec command) + (unless nooutput (tramp-wait-for-output p)))) + +(defun tramp-wait-for-output (proc &optional timeout) + "Wait for output from remote command." + (unless (buffer-live-p (process-buffer proc)) + (delete-process proc) + (tramp-error proc 'file-error "Process `%s' not available, try again" proc)) + (with-current-buffer (process-buffer proc) + (let* (;; Initially, `tramp-end-of-output' is "#$ ". There might + ;; be leading escape sequences, which must be ignored. + (regexp (format "[^#$\n]*%s\r?$" (regexp-quote tramp-end-of-output))) + ;; Sometimes, the commands do not return a newline but a + ;; null byte before the shell prompt, for example "git + ;; ls-files -c -z ...". + (regexp1 (format "\\(^\\|\000\\)%s" regexp)) + (found (tramp-wait-for-regexp proc timeout regexp1))) + (if found + (let (buffer-read-only) + ;; A simple-minded busybox has sent " ^H" sequences. + ;; Delete them. + (goto-char (point-min)) + (when (re-search-forward "^\\(.\b\\)+$" (point-at-eol) t) + (forward-line 1) + (delete-region (point-min) (point))) + ;; Delete the prompt. + (goto-char (point-max)) + (re-search-backward regexp nil t) + (delete-region (point) (point-max))) + (if timeout + (tramp-error + proc 'file-error + "[[Remote prompt `%s' not found in %d secs]]" + tramp-end-of-output timeout) + (tramp-error + proc 'file-error + "[[Remote prompt `%s' not found]]" tramp-end-of-output))) + ;; Return value is whether end-of-output sentinel was found. + found))) + +(defun tramp-send-command-and-check + (vec command &optional subshell dont-suppress-err) + "Run COMMAND and check its exit status. +Sends `echo $?' along with the COMMAND for checking the exit status. If +COMMAND is nil, just sends `echo $?'. Returns the exit status found. + +If the optional argument SUBSHELL is non-nil, the command is +executed in a subshell, ie surrounded by parentheses. If +DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null." + (tramp-send-command + vec + (concat (if subshell "( " "") + command + (if command (if dont-suppress-err "; " " 2>/dev/null; ") "") + "echo tramp_exit_status $?" + (if subshell " )" ""))) + (with-current-buffer (tramp-get-connection-buffer vec) + (goto-char (point-max)) + (unless (re-search-backward "tramp_exit_status [0-9]+" nil t) + (tramp-error + vec 'file-error "Couldn't find exit status of `%s'" command)) + (skip-chars-forward "^ ") + (prog1 + (zerop (read (current-buffer))) + (let (buffer-read-only) + (delete-region (match-beginning 0) (point-max)))))) + +(defun tramp-barf-unless-okay (vec command fmt &rest args) + "Run COMMAND, check exit status, throw error if exit status not okay. +Similar to `tramp-send-command-and-check' but accepts two more arguments +FMT and ARGS which are passed to `error'." + (unless (tramp-send-command-and-check vec command) + (apply 'tramp-error vec 'file-error fmt args))) + +(defun tramp-send-command-and-read (vec command) + "Run COMMAND and return the output, which must be a Lisp expression. +In case there is no valid Lisp expression, it raises an error" + (tramp-barf-unless-okay vec command "`%s' returns with error" command) + (with-current-buffer (tramp-get-connection-buffer vec) + ;; Read the expression. + (goto-char (point-min)) + (condition-case nil + (prog1 (read (current-buffer)) + ;; Error handling. + (when (re-search-forward "\\S-" (point-at-eol) t) + (error nil))) + (error (tramp-error + vec 'file-error + "`%s' does not return a valid Lisp expression: `%s'" + command (buffer-string)))))) + +(defun tramp-convert-file-attributes (vec attr) + "Convert file-attributes ATTR generated by perl script, stat or ls. +Convert file mode bits to string and set virtual device number. +Return ATTR." + (when attr + ;; Convert last access time. + (unless (listp (nth 4 attr)) + (setcar (nthcdr 4 attr) + (list (floor (nth 4 attr) 65536) + (floor (mod (nth 4 attr) 65536))))) + ;; Convert last modification time. + (unless (listp (nth 5 attr)) + (setcar (nthcdr 5 attr) + (list (floor (nth 5 attr) 65536) + (floor (mod (nth 5 attr) 65536))))) + ;; Convert last status change time. + (unless (listp (nth 6 attr)) + (setcar (nthcdr 6 attr) + (list (floor (nth 6 attr) 65536) + (floor (mod (nth 6 attr) 65536))))) + ;; Convert file size. + (when (< (nth 7 attr) 0) + (setcar (nthcdr 7 attr) -1)) + (when (and (floatp (nth 7 attr)) + (<= (nth 7 attr) (tramp-compat-most-positive-fixnum))) + (setcar (nthcdr 7 attr) (round (nth 7 attr)))) + ;; Convert file mode bits to string. + (unless (stringp (nth 8 attr)) + (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))) + (when (stringp (car attr)) + (aset (nth 8 attr) 0 ?l))) + ;; Convert directory indication bit. + (when (string-match "^d" (nth 8 attr)) + (setcar attr t)) + ;; Convert symlink from `tramp-do-file-attributes-with-stat'. + (when (consp (car attr)) + (if (and (stringp (caar attr)) + (string-match ".+ -> .\\(.+\\)." (caar attr))) + (setcar attr (match-string 1 (caar attr))) + (setcar attr nil))) + ;; Set file's gid change bit. + (setcar (nthcdr 9 attr) + (if (numberp (nth 3 attr)) + (not (= (nth 3 attr) + (tramp-get-remote-gid vec 'integer))) + (not (string-equal + (nth 3 attr) + (tramp-get-remote-gid vec 'string))))) + ;; Convert inode. + (unless (listp (nth 10 attr)) + (setcar (nthcdr 10 attr) + (condition-case nil + (cons (floor (nth 10 attr) 65536) + (floor (mod (nth 10 attr) 65536))) + ;; Inodes can be incredible huge. We must hide this. + (error (tramp-get-inode vec))))) + ;; Set virtual device number. + (setcar (nthcdr 11 attr) + (tramp-get-device vec)) + attr)) + +(defun tramp-check-cached-permissions (vec access) + "Check `file-attributes' caches for VEC. +Return t if according to the cache access type ACCESS is known to +be granted." + (let ((result nil) + (offset (cond + ((eq ?r access) 1) + ((eq ?w access) 2) + ((eq ?x access) 3)))) + (dolist (suffix '("string" "integer") result) + (setq + result + (or + result + (let ((file-attr + (tramp-get-file-property + vec (tramp-file-name-localname vec) + (concat "file-attributes-" suffix) nil)) + (remote-uid + (tramp-get-connection-property + vec (concat "uid-" suffix) nil)) + (remote-gid + (tramp-get-connection-property + vec (concat "gid-" suffix) nil))) + (and + file-attr + (or + ;; Not a symlink + (eq t (car file-attr)) + (null (car file-attr))) + (or + ;; World accessible. + (eq access (aref (nth 8 file-attr) (+ offset 6))) + ;; User accessible and owned by user. + (and + (eq access (aref (nth 8 file-attr) offset)) + (equal remote-uid (nth 2 file-attr))) + ;; Group accessible and owned by user's + ;; principal group. + (and + (eq access (aref (nth 8 file-attr) (+ offset 3))) + (equal remote-gid (nth 3 file-attr))))))))))) + +(defun tramp-file-mode-from-int (mode) + "Turn an integer representing a file mode into an ls(1)-like string." + (let ((type (cdr + (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map))) + (user (logand (lsh mode -6) 7)) + (group (logand (lsh mode -3) 7)) + (other (logand (lsh mode -0) 7)) + (suid (> (logand (lsh mode -9) 4) 0)) + (sgid (> (logand (lsh mode -9) 2) 0)) + (sticky (> (logand (lsh mode -9) 1) 0))) + (setq user (tramp-file-mode-permissions user suid "s")) + (setq group (tramp-file-mode-permissions group sgid "s")) + (setq other (tramp-file-mode-permissions other sticky "t")) + (concat type user group other))) + +(defun tramp-file-mode-permissions (perm suid suid-text) + "Convert a permission bitset into a string. +This is used internally by `tramp-file-mode-from-int'." + (let ((r (> (logand perm 4) 0)) + (w (> (logand perm 2) 0)) + (x (> (logand perm 1) 0))) + (concat (or (and r "r") "-") + (or (and w "w") "-") + (or (and suid x suid-text) ; suid, execute + (and suid (upcase suid-text)) ; suid, !execute + (and x "x") "-")))) ; !suid + +(defun tramp-shell-case-fold (string) + "Converts STRING to shell glob pattern which ignores case." + (mapconcat + (lambda (c) + (if (equal (downcase c) (upcase c)) + (vector c) + (format "[%c%c]" (downcase c) (upcase c)))) + string + "")) + +(defun tramp-make-copy-program-file-name (vec) + "Create a file name suitable to be passed to `rcp' and workalikes." + (let ((user (tramp-file-name-user vec)) + (host (tramp-file-name-real-host vec)) + (localname (tramp-shell-quote-argument + (tramp-file-name-localname vec)))) + (if (not (zerop (length user))) + (format "%s@%s:%s" user host localname) + (format "%s:%s" host localname)))) + +(defun tramp-method-out-of-band-p (vec size) + "Return t if this is an out-of-band method, nil otherwise." + (and + ;; It shall be an out-of-band method. + (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program) + ;; Either the file size is large enough, or (in rare cases) there + ;; does not exist a remote encoding. + (or (null tramp-copy-size-limit) + (> size tramp-copy-size-limit) + (null (tramp-get-inline-coding vec "remote-encoding" size))))) + +;; Variables local to connection. + +(defun tramp-get-remote-path (vec) + (with-connection-property + ;; When `tramp-own-remote-path' is in `tramp-remote-path', we + ;; cache the result for the session only. Otherwise, the result + ;; is cached persistently. + (if (memq 'tramp-own-remote-path tramp-remote-path) + (tramp-get-connection-process vec) + vec) + "remote-path" + (let* ((remote-path (copy-tree tramp-remote-path)) + (elt1 (memq 'tramp-default-remote-path remote-path)) + (elt2 (memq 'tramp-own-remote-path remote-path)) + (default-remote-path + (when elt1 + (condition-case nil + (tramp-send-command-and-read + vec "echo \\\"`getconf PATH`\\\"") + ;; Default if "getconf" is not available. + (error + (tramp-message + vec 3 + "`getconf PATH' not successful, using default value \"%s\"." + "/bin:/usr/bin") + "/bin:/usr/bin")))) + (own-remote-path + (when elt2 + (condition-case nil + (tramp-send-command-and-read vec "echo \\\"$PATH\\\"") + ;; Default if "getconf" is not available. + (error + (tramp-message + vec 3 "$PATH not set, ignoring `tramp-own-remote-path'.") + nil))))) + + ;; Replace place holder `tramp-default-remote-path'. + (when elt1 + (setcdr elt1 + (append + (tramp-compat-split-string default-remote-path ":") + (cdr elt1))) + (setq remote-path (delq 'tramp-default-remote-path remote-path))) + + ;; Replace place holder `tramp-own-remote-path'. + (when elt2 + (setcdr elt2 + (append + (tramp-compat-split-string own-remote-path ":") + (cdr elt2))) + (setq remote-path (delq 'tramp-own-remote-path remote-path))) + + ;; Remove double entries. + (setq elt1 remote-path) + (while (consp elt1) + (while (and (car elt1) (setq elt2 (member (car elt1) (cdr elt1)))) + (setcar elt2 nil)) + (setq elt1 (cdr elt1))) + + ;; Remove non-existing directories. + (delq + nil + (mapcar + (lambda (x) + (and + (stringp x) + (file-directory-p + (tramp-make-tramp-file-name + (tramp-file-name-method vec) + (tramp-file-name-user vec) + (tramp-file-name-host vec) + x)) + x)) + remote-path))))) + +(defun tramp-get-remote-tmpdir (vec) + (with-connection-property vec "tmp-directory" + (let ((dir (tramp-shell-quote-argument "/tmp"))) + (if (and (tramp-send-command-and-check + vec (format "%s -d %s" (tramp-get-test-command vec) dir)) + (tramp-send-command-and-check + vec (format "%s -w %s" (tramp-get-test-command vec) dir))) + dir + (tramp-error vec 'file-error "Directory %s not accessible" dir))))) + +(defun tramp-get-ls-command (vec) + (with-connection-property vec "ls" + (tramp-message vec 5 "Finding a suitable `ls' command") + (or + (catch 'ls-found + (dolist (cmd '("ls" "gnuls" "gls")) + (let ((dl (tramp-get-remote-path vec)) + result) + (while (and dl (setq result (tramp-find-executable vec cmd dl t t))) + ;; Check parameters. On busybox, "ls" output coloring is + ;; enabled by default sometimes. So we try to disable it + ;; when possible. $LS_COLORING is not supported there. + ;; Some "ls" versions are sensible wrt the order of + ;; arguments, they fail when "-al" is after the + ;; "--color=never" argument (for example on FreeBSD). + (when (tramp-send-command-and-check + vec (format "%s -lnd /" result)) + (when (tramp-send-command-and-check + vec (format + "%s --color=never -al /dev/null" result)) + (setq result (concat result " --color=never"))) + (throw 'ls-found result)) + (setq dl (cdr dl)))))) + (tramp-error vec 'file-error "Couldn't find a proper `ls' command")))) + +(defun tramp-get-ls-command-with-dired (vec) + (save-match-data + (with-connection-property vec "ls-dired" + (tramp-message vec 5 "Checking, whether `ls --dired' works") + ;; Some "ls" versions are sensible wrt the order of arguments, + ;; they fail when "-al" is after the "--dired" argument (for + ;; example on FreeBSD). + (tramp-send-command-and-check + vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec)))))) + +(defun tramp-get-test-command (vec) + (with-connection-property vec "test" + (tramp-message vec 5 "Finding a suitable `test' command") + (if (tramp-send-command-and-check vec "test 0") + "test" + (tramp-find-executable vec "test" (tramp-get-remote-path vec))))) + +(defun tramp-get-test-nt-command (vec) + ;; Does `test A -nt B' work? Use abominable `find' construct if it + ;; doesn't. BSD/OS 4.0 wants the parentheses around the command, + ;; for otherwise the shell crashes. + (with-connection-property vec "test-nt" + (or + (progn + (tramp-send-command + vec (format "( %s / -nt / )" (tramp-get-test-command vec))) + (with-current-buffer (tramp-get-buffer vec) + (goto-char (point-min)) + (when (looking-at (regexp-quote tramp-end-of-output)) + (format "%s %%s -nt %%s" (tramp-get-test-command vec))))) + (progn + (tramp-send-command + vec + (format + "tramp_test_nt () {\n%s -n \"`find $1 -prune -newer $2 -print`\"\n}" + (tramp-get-test-command vec))) + "tramp_test_nt %s %s")))) + +(defun tramp-get-file-exists-command (vec) + (with-connection-property vec "file-exists" + (tramp-message vec 5 "Finding command to check if file exists") + (tramp-find-file-exists-command vec))) + +(defun tramp-get-remote-ln (vec) + (with-connection-property vec "ln" + (tramp-message vec 5 "Finding a suitable `ln' command") + (tramp-find-executable vec "ln" (tramp-get-remote-path vec)))) + +(defun tramp-get-remote-perl (vec) + (with-connection-property vec "perl" + (tramp-message vec 5 "Finding a suitable `perl' command") + (let ((result + (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec)) + (tramp-find-executable + vec "perl" (tramp-get-remote-path vec))))) + ;; We must check also for some Perl modules. + (when result + (with-connection-property vec "perl-file-spec" + (tramp-send-command-and-check + vec (format "%s -e 'use File::Spec;'" result))) + (with-connection-property vec "perl-cwd-realpath" + (tramp-send-command-and-check + vec (format "%s -e 'use Cwd \"realpath\";'" result)))) + result))) + +(defun tramp-get-remote-stat (vec) + (with-connection-property vec "stat" + (tramp-message vec 5 "Finding a suitable `stat' command") + (let ((result (tramp-find-executable + vec "stat" (tramp-get-remote-path vec))) + tmp) + ;; Check whether stat(1) returns usable syntax. %s does not + ;; work on older AIX systems. + (when result + (setq tmp + ;; We don't want to display an error message. + (tramp-compat-with-temp-message (or (current-message) "") + (ignore-errors + (tramp-send-command-and-read + vec (format "%s -c '(\"%%N\" %%s)' /" result))))) + (unless (and (listp tmp) (stringp (car tmp)) + (string-match "^./.$" (car tmp)) + (integerp (cadr tmp))) + (setq result nil))) + result))) + +(defun tramp-get-remote-readlink (vec) + (with-connection-property vec "readlink" + (tramp-message vec 5 "Finding a suitable `readlink' command") + (let ((result (tramp-find-executable + vec "readlink" (tramp-get-remote-path vec)))) + (when (and result + ;; We don't want to display an error message. + (tramp-compat-with-temp-message (or (current-message) "") + (ignore-errors + (tramp-send-command-and-check + vec (format "%s --canonicalize-missing /" result))))) + result)))) + +(defun tramp-get-remote-trash (vec) + (with-connection-property vec "trash" + (tramp-message vec 5 "Finding a suitable `trash' command") + (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))) + +(defun tramp-get-remote-id (vec) + (with-connection-property vec "id" + (tramp-message vec 5 "Finding POSIX `id' command") + (or + (catch 'id-found + (let ((dl (tramp-get-remote-path vec)) + result) + (while (and dl (setq result (tramp-find-executable vec "id" dl t t))) + ;; Check POSIX parameter. + (when (tramp-send-command-and-check vec (format "%s -u" result)) + (throw 'id-found result)) + (setq dl (cdr dl))))) + (tramp-error vec 'file-error "Couldn't find a POSIX `id' command")))) + +(defun tramp-get-remote-uid (vec id-format) + (with-connection-property vec (format "uid-%s" id-format) + (let ((res (tramp-send-command-and-read + vec + (format "%s -u%s %s" + (tramp-get-remote-id vec) + (if (equal id-format 'integer) "" "n") + (if (equal id-format 'integer) + "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/"))))) + ;; The command might not always return a number. + (if (and (equal id-format 'integer) (not (integerp res))) -1 res)))) + +(defun tramp-get-remote-gid (vec id-format) + (with-connection-property vec (format "gid-%s" id-format) + (let ((res (tramp-send-command-and-read + vec + (format "%s -g%s %s" + (tramp-get-remote-id vec) + (if (equal id-format 'integer) "" "n") + (if (equal id-format 'integer) + "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/"))))) + ;; The command might not always return a number. + (if (and (equal id-format 'integer) (not (integerp res))) -1 res)))) + +(defun tramp-get-local-uid (id-format) + (if (equal id-format 'integer) (user-uid) (user-login-name))) + +(defun tramp-get-local-gid (id-format) + (nth 3 (tramp-compat-file-attributes "~/" id-format))) + +;; Some predefined connection properties. +(defun tramp-get-inline-compress (vec prop size) + "Return the compress command related to PROP. +PROP is either `inline-compress' or `inline-decompress'. SIZE is +the length of the file to be compressed. + +If no corresponding command is found, nil is returned." + (when (and (integerp tramp-inline-compress-start-size) + (> size tramp-inline-compress-start-size)) + (with-connection-property vec prop + (tramp-find-inline-compress vec) + (tramp-get-connection-property vec prop nil)))) + +(defun tramp-get-inline-coding (vec prop size) + "Return the coding command related to PROP. +PROP is either `remote-encoding', `remode-decoding', +`local-encoding' or `local-decoding'. + +SIZE is the length of the file to be coded. Depending on SIZE, +compression might be applied. + +If no corresponding command is found, nil is returned. +Otherwise, either a string is returned which contains a `%s' mark +to be used for the respective input or output file; or a Lisp +function cell is returned to be applied on a buffer." + ;; We must catch the errors, because we want to return `nil', when + ;; no inline coding is found. + (ignore-errors + (let ((coding + (with-connection-property vec prop + (tramp-find-inline-encoding vec) + (tramp-get-connection-property vec prop nil))) + (prop1 (if (string-match "encoding" prop) + "inline-compress" "inline-decompress")) + compress) + ;; The connection property might have been cached. So we must + ;; send the script to the remote side - maybe. + (when (and coding (symbolp coding) (string-match "remote" prop)) + (let ((name (symbol-name coding))) + (while (string-match (regexp-quote "-") name) + (setq name (replace-match "_" nil t name))) + (tramp-maybe-send-script vec (symbol-value coding) name) + (setq coding name))) + (when coding + ;; Check for the `compress' command. + (setq compress (tramp-get-inline-compress vec prop1 size)) + ;; Return the value. + (cond + ((and compress (symbolp coding)) + (if (string-match "decompress" prop1) + `(lambda (beg end) + (,coding beg end) + (let ((coding-system-for-write 'binary) + (coding-system-for-read 'binary)) + (apply + 'call-process-region (point-min) (point-max) + (car (split-string ,compress)) t t nil + (cdr (split-string ,compress))))) + `(lambda (beg end) + (let ((coding-system-for-write 'binary) + (coding-system-for-read 'binary)) + (apply + 'call-process-region beg end + (car (split-string ,compress)) t t nil + (cdr (split-string ,compress)))) + (,coding (point-min) (point-max))))) + ((symbolp coding) + coding) + ((and compress (string-match "decoding" prop)) + (format "(%s | %s >%%s)" coding compress)) + (compress + (format "(%s <%%s | %s)" compress coding)) + ((string-match "decoding" prop) + (format "%s >%%s" coding)) + (t + (format "%s <%%s" coding))))))) + +;;; Integration of eshell.el: + +(eval-when-compile + (defvar eshell-path-env)) + +;; eshell.el keeps the path in `eshell-path-env'. We must change it +;; when `default-directory' points to another host. +(defun tramp-eshell-directory-change () + "Set `eshell-path-env' to $PATH of the host related to `default-directory'." + (setq eshell-path-env + (if (file-remote-p default-directory) + (with-parsed-tramp-file-name default-directory nil + (mapconcat + 'identity + (tramp-get-remote-path v) + ":")) + (getenv "PATH")))) + +(eval-after-load "esh-util" + '(progn + (tramp-eshell-directory-change) + (add-hook 'eshell-directory-change-hook + 'tramp-eshell-directory-change) + (add-hook 'tramp-unload-hook + (lambda () + (remove-hook 'eshell-directory-change-hook + 'tramp-eshell-directory-change))))) + +(add-hook 'tramp-unload-hook + (lambda () + (unload-feature 'tramp-sh 'force))) + +(provide 'tramp-sh) + +;;; TODO: + +;; * Don't use globbing for directories with many files, as this is +;; likely to produce long command lines, and some shells choke on +;; long command lines. +;; * Make it work for different encodings, and for different file name +;; encodings, too. (Daniel Pittman) +;; * Don't search for perl5 and perl. Instead, only search for perl and +;; then look if it's the right version (with `perl -v'). +;; * When editing a remote CVS controlled file as a different user, VC +;; gets confused about the file locking status. Try to find out why +;; the workaround doesn't work. +;; * Allow out-of-band methods as _last_ multi-hop. Open a connection +;; until the last but one hop via `start-file-process'. Apply it +;; also for ftp and smb. +;; * WIBNI if we had a command "trampclient"? If I was editing in +;; some shell with root priviledges, it would be nice if I could +;; just call +;; trampclient filename.c +;; as an editor, and the _current_ shell would connect to an Emacs +;; server and would be used in an existing non-priviledged Emacs +;; session for doing the editing in question. +;; That way, I need not tell Emacs my password again and be afraid +;; that it makes it into core dumps or other ugly stuff (I had Emacs +;; once display a just typed password in the context of a keyboard +;; sequence prompt for a question immediately following in a shell +;; script run within Emacs -- nasty). +;; And if I have some ssh session running to a different computer, +;; having the possibility of passing a local file there to a local +;; Emacs session (in case I can arrange for a connection back) would +;; be nice. +;; Likely the corresponding Tramp server should not allow the +;; equivalent of the emacsclient -eval option in order to make this +;; reasonably unproblematic. And maybe trampclient should have some +;; way of passing credentials, like by using an SSL socket or +;; something. (David Kastrup) +;; * Reconnect directly to a compliant shell without first going +;; through the user's default shell. (Pete Forman) +;; * How can I interrupt the remote process with a signal +;; (interrupt-process seems not to work)? (Markus Triska) +;; * Avoid the local shell entirely for starting remote processes. If +;; so, I think even a signal, when delivered directly to the local +;; SSH instance, would correctly be propagated to the remote process +;; automatically; possibly SSH would have to be started with +;; "-t". (Markus Triska) +;; * It makes me wonder if tramp couldn't fall back to ssh when scp +;; isn't on the remote host. (Mark A. Hershberger) +;; * Use lsh instead of ssh. (Alfred M. Szmidt) +;; * Optimize out-of-band copying, when both methods are scp-like (not +;; rsync). +;; * Keep a second connection open for out-of-band methods like scp or +;; rsync. +;; * Try telnet+curl as new method. It might be useful for busybox, +;; without built-in uuencode/uudecode. + +;;; tramp-sh.el ends here diff --cc lisp/net/tramp.el index f7d3b81039e,babcc2ca250..abcb6ae7d77 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@@ -3074,31 -6812,32 +3074,32 @@@ The terminal type can be configured wit (defun tramp-process-actions (proc vec actions &optional timeout) "Perform actions until success or TIMEOUT." ;; Preserve message for `progress-reporter'. - (with-temp-message "" + (tramp-compat-with-temp-message "" ;; Enable auth-source and password-cache. (tramp-set-connection-property vec "first-password-request" t) - (let (exit) - (while (not exit) - (tramp-message proc 3 "Waiting for prompts from remote shell") - (setq exit - (catch 'tramp-action - (if timeout - (with-timeout (timeout) - (tramp-process-one-action proc vec actions)) - (tramp-process-one-action proc vec actions))))) - (with-current-buffer (tramp-get-connection-buffer vec) - (widen) - (tramp-message vec 6 "\n%s" (buffer-string))) - (unless (eq exit 'ok) - (tramp-clear-passwd vec) - (tramp-error-with-buffer - nil vec 'file-error - (cond - ((eq exit 'permission-denied) "Permission denied") - ((eq exit 'process-died) "Process died") - (t "Login failed"))))))) + (save-restriction + (let (exit) + (while (not exit) + (tramp-message proc 3 "Waiting for prompts from remote shell") + (setq exit + (catch 'tramp-action + (if timeout + (with-timeout (timeout) + (tramp-process-one-action proc vec actions)) + (tramp-process-one-action proc vec actions))))) + (with-current-buffer (tramp-get-connection-buffer vec) + (widen) + (tramp-message vec 6 "\n%s" (buffer-string))) + (unless (eq exit 'ok) + (tramp-clear-passwd vec) + (tramp-error-with-buffer + nil vec 'file-error + (cond + ((eq exit 'permission-denied) "Permission denied") + ((eq exit 'process-died) "Process died") + (t "Login failed")))))))) -;; Utility functions. +:;; Utility functions: (defun tramp-accept-process-output (&optional proc timeout timeout-msecs) "Like `accept-process-output' for Tramp processes. diff --cc lisp/url/ChangeLog index 44cc511c99c,8fdd340da6c..5fd96e43b6b --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@@ -1,72 -1,9 +1,77 @@@ -2010-12-04 Chong Yidong ++2010-12-13 Chong Yidong + + * url-cookie.el (url-cookie-retrieve): Handle null LOCALPART. + Suggested by Lennart Borgman (Bug#7543). + -2010-09-18 Glenn Morris +2010-11-16 Lars Magne Ingebrigtsen + + * url-file.el (url-file-build-filename): Avoid interpreting + file:/foo:/bar URLs via tramp. + +2010-10-14 Lars Magne Ingebrigtsen + + * url-gw.el (url-open-stream): Use open-gnutls-stream if it exists. + +2010-10-07 Lars Magne Ingebrigtsen + + * url-http.el (url-http-end-of-document-sentinel): Protect against + the process buffer being killed. + +2010-10-04 Lars Magne Ingebrigtsen + - * url-http.el (url-http-wait-for-headers-change-function): Protect - against url-http-response-status for degenerate documents. ++ * url-http.el (url-http-wait-for-headers-change-function): ++ Protect against url-http-response-status for degenerate documents. + (url-http-wait-for-headers-change-function): Revert previous + change. It lead to really slow loads. + +2010-10-03 Glenn Morris + + * url-util.el (url-get-url-filename-chars): Don't eval-and-compile. + (url-get-url-at-point): Don't use eval-when-compile. + + * url-cache.el (url-cache-create-filename-human-readable) + (url-cache-create-filename-using-md5): + * url-util.el (url-file-directory, url-file-nondirectory): + Don't use eval-when-compile and regexp-quote. + +2010-10-03 Lars Magne Ingebrigtsen + - * url-vars.el (url-mime-charset-string): Changed the default to ++ * url-vars.el (url-mime-charset-string): Change the default to + nil to avoid sending 1171 bytes of not very useful data to the + HTTP server every request. + +2010-10-02 Lars Magne Ingebrigtsen + + * url-util.el (url-display-percentage): Don't message when the URL + is silent. + (url-lazy-message): Ditto. + (url-lazy-message): Remove leftover debugging code. + + * url-http.el (url-http-parse-headers): Pass the SILENT parameter + back to the fetching function. + + * url.el (url-retrieve): Add a silent parameter. + (url-retrieve-internal): Ditto. + + * url-parse.el (url): Add a `silent' slot in the URL struct. + +2010-10-01 Lars Magne Ingebrigtsen + + * url-cookie.el (url-cookie-handle-set-cookie): Use + url-lazy-message for the cookie warning, which isn't very interesting. + + * url-http.el (url-http-async-sentinel): Check that the buffer is + still alive before switching to it. + +2010-09-25 Julien Danjou + + * url-cache.el (url-cache-create-filename): Ensure no-port and + default-port end up with the same cache file. + (url-cache-create-filename-human-readable) + (url-cache-create-filename-using-md5): Argument is always in the form of + a string now. + +2010-09-23 Glenn Morris * url-cache.el (url-is-cached): Doc fix. @@@ -102,31 -19,14 +107,31 @@@ * url-cookie.el (url-cookie-expired-p): Simplify and fix. (Bug#6957) -2010-07-26 Michael Albinus +2010-09-11 Glenn Morris + + * url-cache.el, url-gw.el, url-history.el, url-irc.el, url-util.el: + * url-vars.el: Remove leading `*' from defcustom docs. - * url-http (url-http-parse-headers): Disable file name handlers at +2010-07-27 Michael Albinus + + * url-http.el (url-http-parse-headers): Disable file name handlers at all (not only Tramp). (Bug#6717) -2010-07-25 Michael Albinus +2010-07-27 Michael Albinus + + * url-http.el (url-http-parse-headers): Disable Tramp. (Bug#6717) + +2010-07-01 Mark A. Hershberger - * url-http (url-http-parse-headers): Disable Tramp. (Bug#6717) + * url-http.el (url-http-create-request): Add a CRLF on the end so - that POSTs with content to https urls work. See - ++ that POSTs with content to https urls work. ++ See + +2010-06-22 Mark A. Hershberger + + * url-parse.el (url-user-for-url, url-password-for-url): + Convenience functions that get usernames and passwords for urls + from auth-source functions. 2010-06-12 Štěpán Němec (tiny change) @@@ -602,8 -475,8 +607,8 @@@ * url-http.el (url-http-proxy): New variable. (url-http-create-request): Use it. Don't use `url-proxy-object'. (url-http): Treat `url' argument as resource to download, and -- dynamic variable `url-using-proxy' as proxy to use. Set -- `url-current-object' to actual URL, and `url-http-proxy' to proxy ++ dynamic variable `url-using-proxy' as proxy to use. ++ Set `url-current-object' to actual URL, and `url-http-proxy' to proxy used. (url-http-handle-cookies): Assume that `url-current-object' does not point to the proxy used. @@@ -619,24 -492,24 +624,24 @@@ (url-proxy): Bind it instead of `proxy-object'. * url-http.el (url-http-create-request): Remove url argument, use -- the buffer-local variable `url-http-target-url' instead. Both -- callers updated. Simplify proxy handling. ++ the buffer-local variable `url-http-target-url' instead. ++ Both callers updated. Simplify proxy handling. (url-http): Don't make proxy-object buffer local. * url.el (url-retrieve-internal): Bind url-proxy-object to nil. 2006-11-26 Magnus Henoch -- * url-http.el (url-http-wait-for-headers-change-function): Use -- `when' instead of `if' when possible. ++ * url-http.el (url-http-wait-for-headers-change-function): ++ Use `when' instead of `if' when possible. (url-http): Define url-http-response-version. (url-http-parse-response): Set it. (url-http-parse-headers): Use it to determine keep-alive behavior. 2006-11-23 Diane Murray (tiny change) -- * url-http.el (url-http-content-length-after-change-function): Use -- `url-lazy-message'. ++ * url-http.el (url-http-content-length-after-change-function): ++ Use `url-lazy-message'. * url-util.el (url-display-percentage): Only show a message if `url-show-status' is non-nil. @@@ -1018,8 -891,8 +1023,8 @@@ (url-cookie-generate-header-lines): Likewise. (url-cookie-handle-set-cookie): Likewise. (url-cookie-create): Expect :localpart instead of :path. -- (url-cookie-localpart): Renamed from url-cookie-path. -- (url-cookie-set-localpart): Renamed from url-cookie-set-path. ++ (url-cookie-localpart): Rename from url-cookie-path. ++ (url-cookie-set-localpart): Rename from url-cookie-set-path. (url-cookie-file): Doc fix. (url-cookie-p): Add doc string. @@@ -2236,7 -2109,7 +2241,7 @@@ message when we have to contact a host so the user always gets at least some feedback. -- * lisp/url-expand.el (url-expander-remove-relative-links): Moved and ++ * lisp/url-expand.el (url-expander-remove-relative-links): Move and renamed function. (url-default-expander): Use it. diff --cc lisp/vc/diff-mode.el index cec4fb24616,00000000000..c16c2460e75 mode 100644,000000..100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@@ -1,1939 -1,0 +1,1942 @@@ +;;; diff-mode.el --- a mode for viewing/editing context diffs + +;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,2005, 2006, +;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +;; Author: Stefan Monnier +;; Keywords: convenience patch diff vc + +;; 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: + +;; Provides support for font-lock, outline, navigation +;; commands, editing and various conversions as well as jumping +;; to the corresponding source file. + +;; Inspired by Pavel Machek's patch-mode.el () +;; Some efforts were spent to have it somewhat compatible with XEmacs' +;; diff-mode as well as with compilation-minor-mode + +;; Bugs: + +;; - Reverse doesn't work with normal diffs. + +;; Todo: + +;; - Improve `diff-add-change-log-entries-other-window', +;; it is very simplistic now. +;; +;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks. +;; Also allow C-c C-a to delete already-applied hunks. +;; +;; - Try `diff ' to try and fuzzily discover the source location +;; of a hunk. Show then the changes between and and make it +;; possible to apply them to , , or . +;; Or maybe just make it into a ".rej to diff3-markers converter". +;; Maybe just use `wiggle' (by Neil Brown) to do it for us. +;; +;; - in diff-apply-hunk, strip context in replace-match to better +;; preserve markers and spacing. +;; - Handle `diff -b' output in context->unified. + +;;; Code: +(eval-when-compile (require 'cl)) + +(defvar add-log-buffer-file-name-function) + + +(defgroup diff-mode () + "Major mode for viewing/editing diffs." + :version "21.1" + :group 'tools + :group 'diff) + +(defcustom diff-default-read-only nil + "If non-nil, `diff-mode' buffers default to being read-only." + :type 'boolean + :group 'diff-mode) + +(defcustom diff-jump-to-old-file nil + "Non-nil means `diff-goto-source' jumps to the old file. +Else, it jumps to the new file." + :type 'boolean + :group 'diff-mode) + +(defcustom diff-update-on-the-fly t + "Non-nil means hunk headers are kept up-to-date on-the-fly. +When editing a diff file, the line numbers in the hunk headers +need to be kept consistent with the actual diff. This can +either be done on the fly (but this sometimes interacts poorly with the +undo mechanism) or whenever the file is written (can be slow +when editing big diffs)." + :type 'boolean + :group 'diff-mode) + +(defcustom diff-advance-after-apply-hunk t + "Non-nil means `diff-apply-hunk' will move to the next hunk after applying." + :type 'boolean + :group 'diff-mode) + +(defcustom diff-mode-hook nil + "Run after setting up the `diff-mode' major mode." + :type 'hook + :options '(diff-delete-empty-files diff-make-unified) + :group 'diff-mode) + +(defvar diff-vc-backend nil + "The VC backend that created the current Diff buffer, if any.") + +(defvar diff-outline-regexp + "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)") + +;;;; +;;;; keymap, menu, ... +;;;; + +(easy-mmode-defmap diff-mode-shared-map + '(;; From Pavel Machek's patch-mode. + ("n" . diff-hunk-next) + ("N" . diff-file-next) + ("p" . diff-hunk-prev) + ("P" . diff-file-prev) + ("\t" . diff-hunk-next) + ([backtab] . diff-hunk-prev) + ("k" . diff-hunk-kill) + ("K" . diff-file-kill) + ;; From compilation-minor-mode. + ("}" . diff-file-next) + ("{" . diff-file-prev) + ("\C-m" . diff-goto-source) + ([mouse-2] . diff-goto-source) + ;; From XEmacs' diff-mode. + ;; Standard M-w is useful, so don't change M-W. + ;;("W" . widen) + ;;("." . diff-goto-source) ;display-buffer + ;;("f" . diff-goto-source) ;find-file + ("o" . diff-goto-source) ;other-window + ;;("w" . diff-goto-source) ;other-frame + ;;("N" . diff-narrow) + ;;("h" . diff-show-header) + ;;("j" . diff-show-difference) ;jump to Nth diff + ;;("q" . diff-quit) + ;; Not useful if you have to metafy them. + ;;(" " . scroll-up) + ;;("\177" . scroll-down) + ;; Standard M-a is useful, so don't change M-A. + ;;("A" . diff-ediff-patch) + ;; Standard M-r is useful, so don't change M-r or M-R. + ;;("r" . diff-restrict-view) + ;;("R" . diff-reverse-direction) + ("g" . revert-buffer) + ("q" . quit-window)) + "Basic keymap for `diff-mode', bound to various prefix keys.") + +(easy-mmode-defmap diff-mode-map + `(("\e" . ,diff-mode-shared-map) + ;; From compilation-minor-mode. + ("\C-c\C-c" . diff-goto-source) + ;; By analogy with the global C-x 4 a binding. + ("\C-x4A" . diff-add-change-log-entries-other-window) + ;; Misc operations. + ("\C-c\C-a" . diff-apply-hunk) + ("\C-c\C-e" . diff-ediff-patch) + ("\C-c\C-n" . diff-restrict-view) + ("\C-c\C-s" . diff-split-hunk) + ("\C-c\C-t" . diff-test-hunk) + ("\C-c\C-r" . diff-reverse-direction) + ("\C-c\C-u" . diff-context->unified) + ;; `d' because it duplicates the context :-( --Stef + ("\C-c\C-d" . diff-unified->context) + ("\C-c\C-w" . diff-ignore-whitespace-hunk) + ("\C-c\C-b" . diff-refine-hunk) ;No reason for `b' :-( + ("\C-c\C-f" . next-error-follow-minor-mode)) + "Keymap for `diff-mode'. See also `diff-mode-shared-map'.") + +(easy-menu-define diff-mode-menu diff-mode-map + "Menu for `diff-mode'." + '("Diff" + ["Jump to Source" diff-goto-source + :help "Jump to the corresponding source line"] + ["Apply hunk" diff-apply-hunk + :help "Apply the current hunk to the source file and go to the next"] + ["Test applying hunk" diff-test-hunk + :help "See whether it's possible to apply the current hunk"] + ["Apply diff with Ediff" diff-ediff-patch + :help "Call `ediff-patch-file' on the current buffer"] + ["Create Change Log entries" diff-add-change-log-entries-other-window + :help "Create ChangeLog entries for the changes in the diff buffer"] + "-----" + ["Reverse direction" diff-reverse-direction + :help "Reverse the direction of the diffs"] + ["Context -> Unified" diff-context->unified + :help "Convert context diffs to unified diffs"] + ["Unified -> Context" diff-unified->context + :help "Convert unified diffs to context diffs"] + ;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)] + ["Show trailing whitespace" whitespace-mode + :style toggle :selected (bound-and-true-p whitespace-mode) + :help "Show trailing whitespace in modified lines"] + "-----" + ["Split hunk" diff-split-hunk + :active (diff-splittable-p) + :help "Split the current (unified diff) hunk at point into two hunks"] + ["Ignore whitespace changes" diff-ignore-whitespace-hunk + :help "Re-diff the current hunk, ignoring whitespace differences"] + ["Highlight fine changes" diff-refine-hunk + :help "Highlight changes of hunk at point at a finer granularity"] + ["Kill current hunk" diff-hunk-kill + :help "Kill current hunk"] + ["Kill current file's hunks" diff-file-kill + :help "Kill all current file's hunks"] + "-----" + ["Previous Hunk" diff-hunk-prev + :help "Go to the previous count'th hunk"] + ["Next Hunk" diff-hunk-next + :help "Go to the next count'th hunk"] + ["Previous File" diff-file-prev + :help "Go to the previous count'th file"] + ["Next File" diff-file-next + :help "Go to the next count'th file"] + )) + +(defcustom diff-minor-mode-prefix "\C-c=" + "Prefix key for `diff-minor-mode' commands." + :type '(choice (string "\e") (string "C-c=") string) + :group 'diff-mode) + +(easy-mmode-defmap diff-minor-mode-map + `((,diff-minor-mode-prefix . ,diff-mode-shared-map)) + "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.") + +(define-minor-mode diff-auto-refine-mode + "Automatically highlight changes in detail as the user visits hunks. +When transitioning from disabled to enabled, +try to refine the current hunk, as well." + :group 'diff-mode :init-value t :lighter nil ;; " Auto-Refine" + (when diff-auto-refine-mode + (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) + +;;;; +;;;; font-lock support +;;;; + +(defface diff-header + '((((class color) (min-colors 88) (background light)) + :background "grey80") + (((class color) (min-colors 88) (background dark)) + :background "grey45") + (((class color) (background light)) + :foreground "blue1" :weight bold) + (((class color) (background dark)) + :foreground "green" :weight bold) + (t :weight bold)) + "`diff-mode' face inherited by hunk and index header faces." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-header-face 'diff-header "22.1") +(defvar diff-header-face 'diff-header) + +(defface diff-file-header + '((((class color) (min-colors 88) (background light)) + :background "grey70" :weight bold) + (((class color) (min-colors 88) (background dark)) + :background "grey60" :weight bold) + (((class color) (background light)) + :foreground "green" :weight bold) + (((class color) (background dark)) + :foreground "cyan" :weight bold) + (t :weight bold)) ; :height 1.3 + "`diff-mode' face used to highlight file header lines." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-file-header-face 'diff-file-header "22.1") +(defvar diff-file-header-face 'diff-file-header) + +(defface diff-index + '((t :inherit diff-file-header)) + "`diff-mode' face used to highlight index header lines." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-index-face 'diff-index "22.1") +(defvar diff-index-face 'diff-index) + +(defface diff-hunk-header + '((t :inherit diff-header)) + "`diff-mode' face used to highlight hunk header lines." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-hunk-header-face 'diff-hunk-header "22.1") +(defvar diff-hunk-header-face 'diff-hunk-header) + +(defface diff-removed + '((t :inherit diff-changed)) + "`diff-mode' face used to highlight removed lines." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-removed-face 'diff-removed "22.1") +(defvar diff-removed-face 'diff-removed) + +(defface diff-added + '((t :inherit diff-changed)) + "`diff-mode' face used to highlight added lines." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-added-face 'diff-added "22.1") +(defvar diff-added-face 'diff-added) + +(defface diff-changed + '((((type tty pc) (class color) (background light)) + :foreground "magenta" :weight bold :slant italic) + (((type tty pc) (class color) (background dark)) + :foreground "yellow" :weight bold :slant italic)) + "`diff-mode' face used to highlight changed lines." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-changed-face 'diff-changed "22.1") +(defvar diff-changed-face 'diff-changed) + +(defface diff-indicator-removed + '((t :inherit diff-removed)) + "`diff-mode' face used to highlight indicator of removed lines (-, <)." + :group 'diff-mode + :version "22.1") +(defvar diff-indicator-removed-face 'diff-indicator-removed) + +(defface diff-indicator-added + '((t :inherit diff-added)) + "`diff-mode' face used to highlight indicator of added lines (+, >)." + :group 'diff-mode + :version "22.1") +(defvar diff-indicator-added-face 'diff-indicator-added) + +(defface diff-indicator-changed + '((t :inherit diff-changed)) + "`diff-mode' face used to highlight indicator of changed lines." + :group 'diff-mode + :version "22.1") +(defvar diff-indicator-changed-face 'diff-indicator-changed) + +(defface diff-function + '((t :inherit diff-header)) + "`diff-mode' face used to highlight function names produced by \"diff -p\"." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-function-face 'diff-function "22.1") +(defvar diff-function-face 'diff-function) + +(defface diff-context + '((((class color grayscale) (min-colors 88)) :inherit shadow)) + "`diff-mode' face used to highlight context and other side-information." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-context-face 'diff-context "22.1") +(defvar diff-context-face 'diff-context) + +(defface diff-nonexistent + '((t :inherit diff-file-header)) + "`diff-mode' face used to highlight nonexistent files in recursive diffs." + :group 'diff-mode) +(define-obsolete-face-alias 'diff-nonexistent-face 'diff-nonexistent "22.1") +(defvar diff-nonexistent-face 'diff-nonexistent) + +(defconst diff-yank-handler '(diff-yank-function)) +(defun diff-yank-function (text) + ;; FIXME: the yank-handler is now called separately on each piece of text + ;; with a yank-handler property, so the next-single-property-change call + ;; below will always return nil :-( --stef + (let ((mixed (next-single-property-change 0 'yank-handler text)) + (start (point))) + ;; First insert the text. + (insert text) + ;; If the text does not include any diff markers and if we're not + ;; yanking back into a diff-mode buffer, get rid of the prefixes. + (unless (or mixed (derived-mode-p 'diff-mode)) + (undo-boundary) ; Just in case the user wanted the prefixes. + (let ((re (save-excursion + (if (re-search-backward "^[>][ \t]") + "^[ <>!+-]")))) + (save-excursion + (while (re-search-backward re start t) + (replace-match "" t t))))))) + +(defconst diff-hunk-header-re-unified + "^@@ -\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? \\+\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? @@") +(defconst diff-context-mid-hunk-header-re + "--- \\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? ----$") + +(defvar diff-font-lock-keywords + `((,(concat "\\(" diff-hunk-header-re-unified "\\)\\(.*\\)$") + (1 diff-hunk-header-face) (6 diff-function-face)) + ("^\\(\\*\\{15\\}\\)\\(.*\\)$" ;context + (1 diff-hunk-header-face) (2 diff-function-face)) + ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context + (,diff-context-mid-hunk-header-re . diff-hunk-header-face) ;context + ("^[0-9,]+[acd][0-9,]+$" . diff-hunk-header-face) ;normal + ("^---$" . diff-hunk-header-face) ;normal + ;; For file headers, accept files with spaces, but be careful to rule + ;; out false-positives when matching hunk headers. + ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\([^\t\n]+?\\)\\(?:\t.*\\| \\(\\*\\*\\*\\*\\|----\\)\\)?\n" + (0 diff-header-face) + (2 (if (not (match-end 3)) diff-file-header-face) prepend)) + ("^\\([-<]\\)\\(.*\n\\)" + (1 diff-indicator-removed-face) (2 diff-removed-face)) + ("^\\([+>]\\)\\(.*\n\\)" + (1 diff-indicator-added-face) (2 diff-added-face)) + ("^\\(!\\)\\(.*\n\\)" + (1 diff-indicator-changed-face) (2 diff-changed-face)) + ("^Index: \\(.+\\).*\n" + (0 diff-header-face) (1 diff-index-face prepend)) + ("^Only in .*\n" . diff-nonexistent-face) + ("^\\(#\\)\\(.*\\)" + (1 font-lock-comment-delimiter-face) + (2 font-lock-comment-face)) + ("^[^-=+*!<>#].*\n" (0 diff-context-face)))) + +(defconst diff-font-lock-defaults + '(diff-font-lock-keywords t nil nil nil (font-lock-multiline . nil))) + +(defvar diff-imenu-generic-expression + ;; Prefer second name as first is most likely to be a backup or + ;; version-control name. The [\t\n] at the end of the unidiff pattern + ;; catches Debian source diff files (which lack the trailing date). + '((nil "\\+\\+\\+\\ \\([^\t\n]+\\)[\t\n]" 1) ; unidiffs + (nil "^--- \\([^\t\n]+\\)\t.*\n\\*" 1))) ; context diffs + +;;;; +;;;; Movement +;;;; + +(defvar diff-valid-unified-empty-line t + "If non-nil, empty lines are valid in unified diffs. +Some versions of diff replace all-blank context lines in unified format with +empty lines. This makes the format less robust, but is tolerated. +See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html") + +(defconst diff-hunk-header-re + (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")) +(defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1))) +(defvar diff-narrowed-to nil) + +(defun diff-hunk-style (&optional style) + (when (looking-at diff-hunk-header-re) + (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context))))) + (goto-char (match-end 0))) + style) + +(defun diff-end-of-hunk (&optional style donttrustheader) + (let (end) + (when (looking-at diff-hunk-header-re) + ;; Especially important for unified (because headers are ambiguous). + (setq style (diff-hunk-style style)) + (goto-char (match-end 0)) + (when (and (not donttrustheader) (match-end 2)) + (let* ((nold (string-to-number (or (match-string 2) "1"))) + (nnew (string-to-number (or (match-string 4) "1"))) + (endold + (save-excursion + (re-search-forward (if diff-valid-unified-empty-line + "^[- \n]" "^[- ]") + nil t nold) + (line-beginning-position 2))) + (endnew + ;; The hunk may end with a bunch of "+" lines, so the `end' is + ;; then further than computed above. + (save-excursion + (re-search-forward (if diff-valid-unified-empty-line + "^[+ \n]" "^[+ ]") + nil t nnew) + (line-beginning-position 2)))) + (setq end (max endold endnew))))) + ;; We may have a first evaluation of `end' thanks to the hunk header. + (unless end + (setq end (and (re-search-forward + (case style + (unified (concat (if diff-valid-unified-empty-line + "^[^-+# \\\n]\\|" "^[^-+# \\]\\|") + ;; A `unified' header is ambiguous. + diff-file-header-re)) + (context "^[^-+#! \\]") + (normal "^[^<>#\\]") + (t "^[^-+#!<> \\]")) + nil t) + (match-beginning 0))) + (when diff-valid-unified-empty-line + ;; While empty lines may be valid inside hunks, they are also likely + ;; to be unrelated to the hunk. + (goto-char (or end (point-max))) + (while (eq ?\n (char-before (1- (point)))) + (forward-char -1) + (setq end (point))))) + ;; The return value is used by easy-mmode-define-navigation. + (goto-char (or end (point-max))))) + +(defun diff-beginning-of-hunk (&optional try-harder) + "Move back to beginning of hunk. +If TRY-HARDER is non-nil, try to cater to the case where we're not in a hunk +but in the file header instead, in which case move forward to the first hunk." + (beginning-of-line) + (unless (looking-at diff-hunk-header-re) + (forward-line 1) + (condition-case () + (re-search-backward diff-hunk-header-re) + (error + (if (not try-harder) + (error "Can't find the beginning of the hunk") + (diff-beginning-of-file-and-junk) + (diff-hunk-next)))))) + +(defun diff-unified-hunk-p () + (save-excursion + (ignore-errors + (diff-beginning-of-hunk) + (looking-at "^@@")))) + +(defun diff-beginning-of-file () + (beginning-of-line) + (unless (looking-at diff-file-header-re) + (let ((start (point)) + res) + ;; diff-file-header-re may need to match up to 4 lines, so in case + ;; we're inside the header, we need to move up to 3 lines forward. + (forward-line 3) + (if (and (setq res (re-search-backward diff-file-header-re nil t)) + ;; Maybe the 3 lines forward were too much and we matched + ;; a file header after our starting point :-( + (or (<= (point) start) + (setq res (re-search-backward diff-file-header-re nil t)))) + res + (goto-char start) + (error "Can't find the beginning of the file"))))) + + +(defun diff-end-of-file () + (re-search-forward "^[-+#!<>0-9@* \\]" nil t) + (re-search-forward (concat "^[^-+#!<>0-9@* \\]\\|" diff-file-header-re) + nil 'move) + (if (match-beginning 1) + (goto-char (match-beginning 1)) + (beginning-of-line))) + +;; Define diff-{hunk,file}-{prev,next} +(easy-mmode-define-navigation + diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view + (if diff-auto-refine-mode + (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) + +(easy-mmode-define-navigation + diff-file diff-file-header-re "file" diff-end-of-hunk) + +(defun diff-restrict-view (&optional arg) + "Restrict the view to the current hunk. +If the prefix ARG is given, restrict the view to the current file instead." + (interactive "P") + (save-excursion + (if arg (diff-beginning-of-file) (diff-beginning-of-hunk 'try-harder)) + (narrow-to-region (point) + (progn (if arg (diff-end-of-file) (diff-end-of-hunk)) + (point))) + (set (make-local-variable 'diff-narrowed-to) (if arg 'file 'hunk)))) + + +(defun diff-hunk-kill () + "Kill current hunk." + (interactive) + (diff-beginning-of-hunk) + (let* ((start (point)) + ;; Search the second match, since we're looking at the first. + (nexthunk (when (re-search-forward diff-hunk-header-re nil t 2) + (match-beginning 0))) + (firsthunk (ignore-errors + (goto-char start) + (diff-beginning-of-file) (diff-hunk-next) (point))) + (nextfile (ignore-errors (diff-file-next) (point))) + (inhibit-read-only t)) + (goto-char start) + (if (and firsthunk (= firsthunk start) + (or (null nexthunk) + (and nextfile (> nexthunk nextfile)))) + ;; It's the only hunk for this file, so kill the file. + (diff-file-kill) + (diff-end-of-hunk) + (kill-region start (point))))) + +;; "index ", "old mode", "new mode", "new file mode" and +;; "deleted file mode" are output by git-diff. +(defconst diff-file-junk-re + "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode") + +(defun diff-beginning-of-file-and-junk () + "Go to the beginning of file-related diff-info. +This is like `diff-beginning-of-file' except it tries to skip back over leading +data such as \"Index: ...\" and such." + (let* ((orig (point)) + ;; Skip forward over what might be "leading junk" so as to get + ;; closer to the actual diff. + (_ (progn (beginning-of-line) + (while (looking-at diff-file-junk-re) + (forward-line 1)))) + (start (point)) + (prevfile (condition-case err + (save-excursion (diff-beginning-of-file) (point)) + (error err))) + (err (if (consp prevfile) prevfile)) + (nextfile (ignore-errors + (save-excursion + (goto-char start) (diff-file-next) (point)))) + ;; prevhunk is one of the limits. + (prevhunk (save-excursion + (ignore-errors + (if (numberp prevfile) (goto-char prevfile)) + (diff-hunk-prev) (point)))) + (previndex (save-excursion + (forward-line 1) ;In case we're looking at "Index:". + (re-search-backward "^Index: " prevhunk t)))) + ;; If we're in the junk, we should use nextfile instead of prevfile. + (if (and (numberp nextfile) + (or (not (numberp prevfile)) + (and previndex (> previndex prevfile)))) + (setq prevfile nextfile)) + (if (and previndex (numberp prevfile) (< previndex prevfile)) + (setq prevfile previndex)) + (if (and (numberp prevfile) (<= prevfile start)) + (progn + (goto-char prevfile) + ;; Now skip backward over the leading junk we may have before the + ;; diff itself. + (while (save-excursion + (and (zerop (forward-line -1)) + (looking-at diff-file-junk-re))) + (forward-line -1))) + ;; File starts *after* the starting point: we really weren't in + ;; a file diff but elsewhere. + (goto-char orig) + (signal (car err) (cdr err))))) + +(defun diff-file-kill () + "Kill current file's hunks." + (interactive) + (let ((orig (point)) + (start (progn (diff-beginning-of-file-and-junk) (point))) + (inhibit-read-only t)) + (diff-end-of-file) + (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs. + (if (> orig (point)) (error "Not inside a file diff")) + (kill-region start (point)))) + +(defun diff-kill-junk () + "Kill spurious empty diffs." + (interactive) + (save-excursion + (let ((inhibit-read-only t)) + (goto-char (point-min)) + (while (re-search-forward (concat "^\\(Index: .*\n\\)" + "\\([^-+!* <>].*\n\\)*?" + "\\(\\(Index:\\) \\|" + diff-file-header-re "\\)") + nil t) + (delete-region (if (match-end 4) (match-beginning 0) (match-end 1)) + (match-beginning 3)) + (beginning-of-line))))) + +(defun diff-count-matches (re start end) + (save-excursion + (let ((n 0)) + (goto-char start) + (while (re-search-forward re end t) (incf n)) + n))) + +(defun diff-splittable-p () + (save-excursion + (beginning-of-line) + (and (looking-at "^[-+ ]") + (progn (forward-line -1) (looking-at "^[-+ ]")) + (diff-unified-hunk-p)))) + +(defun diff-split-hunk () + "Split the current (unified diff) hunk at point into two hunks." + (interactive) + (beginning-of-line) + (let ((pos (point)) + (start (progn (diff-beginning-of-hunk) (point)))) + (unless (looking-at diff-hunk-header-re-unified) + (error "diff-split-hunk only works on unified context diffs")) + (forward-line 1) + (let* ((start1 (string-to-number (match-string 1))) + (start2 (string-to-number (match-string 3))) + (newstart1 (+ start1 (diff-count-matches "^[- \t]" (point) pos))) + (newstart2 (+ start2 (diff-count-matches "^[+ \t]" (point) pos))) + (inhibit-read-only t)) + (goto-char pos) + ;; Hopefully the after-change-function will not screw us over. + (insert "@@ -" (number-to-string newstart1) ",1 +" + (number-to-string newstart2) ",1 @@\n") + ;; Fix the original hunk-header. + (diff-fixup-modifs start pos)))) + + +;;;; +;;;; jump to other buffers +;;;; + +(defvar diff-remembered-files-alist nil) +(defvar diff-remembered-defdir nil) + +(defun diff-filename-drop-dir (file) + (when (string-match "/" file) (substring file (match-end 0)))) + +(defun diff-merge-strings (ancestor from to) + "Merge the diff between ANCESTOR and FROM into TO. +Returns the merged string if successful or nil otherwise. +The strings are assumed not to contain any \"\\n\" (i.e. end of line). +If ANCESTOR = FROM, returns TO. +If ANCESTOR = TO, returns FROM. +The heuristic is simplistic and only really works for cases +like \(diff-merge-strings \"b/foo\" \"b/bar\" \"/a/c/foo\")." + ;; Ideally, we want: + ;; AMB ANB CMD -> CND + ;; but that's ambiguous if `foo' or `bar' is empty: + ;; a/foo a/foo1 b/foo.c -> b/foo1.c but not 1b/foo.c or b/foo.c1 + (let ((str (concat ancestor "\n" from "\n" to))) + (when (and (string-match (concat + "\\`\\(.*?\\)\\(.*\\)\\(.*\\)\n" + "\\1\\(.*\\)\\3\n" + "\\(.*\\(\\2\\).*\\)\\'") str) + (equal to (match-string 5 str))) + (concat (substring str (match-beginning 5) (match-beginning 6)) + (match-string 4 str) + (substring str (match-end 6) (match-end 5)))))) + +(defun diff-tell-file-name (old name) + "Tell Emacs where the find the source file of the current hunk. +If the OLD prefix arg is passed, tell the file NAME of the old file." + (interactive + (let* ((old current-prefix-arg) + (fs (diff-hunk-file-names current-prefix-arg))) + (unless fs (error "No file name to look for")) + (list old (read-file-name (format "File for %s: " (car fs)) + nil (diff-find-file-name old 'noprompt) t)))) + (let ((fs (diff-hunk-file-names old))) + (unless fs (error "No file name to look for")) + (push (cons fs name) diff-remembered-files-alist))) + +(defun diff-hunk-file-names (&optional old) + "Give the list of file names textually mentioned for the current hunk." + (save-excursion + (unless (looking-at diff-file-header-re) + (or (ignore-errors (diff-beginning-of-file)) + (re-search-forward diff-file-header-re nil t))) + (let ((limit (save-excursion + (condition-case () + (progn (diff-hunk-prev) (point)) + (error (point-min))))) + (header-files + (if (looking-at "[-*][-*][-*] \\(\\S-+\\)\\(\\s-.*\\)?\n[-+][-+][-+] \\(\\S-+\\)") + (list (if old (match-string 1) (match-string 3)) + (if old (match-string 3) (match-string 1))) + (forward-line 1) nil))) + (delq nil + (append + (when (and (not old) + (save-excursion + (re-search-backward "^Index: \\(.+\\)" limit t))) + (list (match-string 1))) + header-files + (when (re-search-backward + "^diff \\(-\\S-+ +\\)*\\(\\S-+\\)\\( +\\(\\S-+\\)\\)?" + nil t) + (list (if old (match-string 2) (match-string 4)) + (if old (match-string 4) (match-string 2))))))))) + +(defun diff-find-file-name (&optional old noprompt prefix) + "Return the file corresponding to the current patch. +Non-nil OLD means that we want the old file. +Non-nil NOPROMPT means to prefer returning nil than to prompt the user. +PREFIX is only used internally: don't use it." + (unless (equal diff-remembered-defdir default-directory) + ;; Flush diff-remembered-files-alist if the default-directory is changed. + (set (make-local-variable 'diff-remembered-defdir) default-directory) + (set (make-local-variable 'diff-remembered-files-alist) nil)) + (save-excursion + (unless (looking-at diff-file-header-re) + (or (ignore-errors (diff-beginning-of-file)) + (re-search-forward diff-file-header-re nil t))) + (let ((fs (diff-hunk-file-names old))) + (if prefix (setq fs (mapcar (lambda (f) (concat prefix f)) fs))) + (or + ;; use any previously used preference + (cdr (assoc fs diff-remembered-files-alist)) + ;; try to be clever and use previous choices as an inspiration + (dolist (rf diff-remembered-files-alist) + (let ((newfile (diff-merge-strings (caar rf) (car fs) (cdr rf)))) + (if (and newfile (file-exists-p newfile)) (return newfile)))) + ;; look for each file in turn. If none found, try again but + ;; ignoring the first level of directory, ... + (do* ((files fs (delq nil (mapcar 'diff-filename-drop-dir files))) + (file nil nil)) + ((or (null files) + (setq file (do* ((files files (cdr files)) + (file (car files) (car files))) + ;; Use file-regular-p to avoid + ;; /dev/null, directories, etc. + ((or (null file) (file-regular-p file)) + file)))) + file)) + ;; .rej patches implicitly apply to + (and (string-match "\\.rej\\'" (or buffer-file-name "")) + (let ((file (substring buffer-file-name 0 (match-beginning 0)))) + (when (file-exists-p file) file))) + ;; If we haven't found the file, maybe it's because we haven't paid + ;; attention to the PCL-CVS hint. + (and (not prefix) + (boundp 'cvs-pcl-cvs-dirchange-re) + (save-excursion + (re-search-backward cvs-pcl-cvs-dirchange-re nil t)) + (diff-find-file-name old noprompt (match-string 1))) + ;; if all else fails, ask the user + (unless noprompt + (let ((file (read-file-name (format "Use file %s: " + (or (first fs) "")) + nil (first fs) t (first fs)))) + (set (make-local-variable 'diff-remembered-files-alist) + (cons (cons fs file) diff-remembered-files-alist)) + file)))))) + + +(defun diff-ediff-patch () + "Call `ediff-patch-file' on the current buffer." + (interactive) + (condition-case err + (ediff-patch-file nil (current-buffer)) + (wrong-number-of-arguments (ediff-patch-file)))) + +;;;; +;;;; Conversion functions +;;;; + +;;(defvar diff-inhibit-after-change nil +;; "Non-nil means inhibit `diff-mode's after-change functions.") + +(defun diff-unified->context (start end) + "Convert unified diffs to context diffs. +START and END are either taken from the region (if a prefix arg is given) or +else cover the whole buffer." + (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) + (list (region-beginning) (region-end)) + (list (point-min) (point-max)))) + (unless (markerp end) (setq end (copy-marker end t))) + (let (;;(diff-inhibit-after-change t) + (inhibit-read-only t)) + (save-excursion + (goto-char start) + (while (and (re-search-forward + (concat "^\\(\\(---\\) .+\n\\(\\+\\+\\+\\) .+\\|" + diff-hunk-header-re-unified ".*\\)$") + nil t) + (< (point) end)) + (combine-after-change-calls + (if (match-beginning 2) + ;; we matched a file header + (progn + ;; use reverse order to make sure the indices are kept valid + (replace-match "---" t t nil 3) + (replace-match "***" t t nil 2)) + ;; we matched a hunk header + (let ((line1 (match-string 4)) + (lines1 (or (match-string 5) "1")) + (line2 (match-string 6)) + (lines2 (or (match-string 7) "1")) + ;; Variables to use the special undo function. + (old-undo buffer-undo-list) + (old-end (marker-position end)) + (start (match-beginning 0)) + (reversible t)) + (replace-match + (concat "***************\n*** " line1 "," + (number-to-string (+ (string-to-number line1) + (string-to-number lines1) + -1)) + " ****")) + (save-restriction + (narrow-to-region (line-beginning-position 2) + ;; Call diff-end-of-hunk from just before + ;; the hunk header so it can use the hunk + ;; header info. + (progn (diff-end-of-hunk 'unified) (point))) + (let ((hunk (buffer-string))) + (goto-char (point-min)) + (if (not (save-excursion (re-search-forward "^-" nil t))) + (delete-region (point) (point-max)) + (goto-char (point-max)) + (let ((modif nil) last-pt) + (while (progn (setq last-pt (point)) + (= (forward-line -1) 0)) + (case (char-after) + (?\s (insert " ") (setq modif nil) (backward-char 1)) + (?+ (delete-region (point) last-pt) (setq modif t)) + (?- (if (not modif) + (progn (forward-char 1) + (insert " ")) + (delete-char 1) + (insert "! ")) + (backward-char 2)) + (?\\ (when (save-excursion (forward-line -1) + (= (char-after) ?+)) + (delete-region (point) last-pt) (setq modif t))) + ;; diff-valid-unified-empty-line. + (?\n (insert " ") (setq modif nil) (backward-char 2)) + (t (setq modif nil)))))) + (goto-char (point-max)) + (save-excursion + (insert "--- " line2 "," + (number-to-string (+ (string-to-number line2) + (string-to-number lines2) + -1)) + " ----\n" hunk)) + ;;(goto-char (point-min)) + (forward-line 1) + (if (not (save-excursion (re-search-forward "^+" nil t))) + (delete-region (point) (point-max)) + (let ((modif nil) (delete nil)) + (if (save-excursion (re-search-forward "^\\+.*\n-" nil t)) + ;; Normally, lines in a substitution come with + ;; first the removals and then the additions, and + ;; the context->unified function follows this + ;; convention, of course. Yet, other alternatives + ;; are valid as well, but they preclude the use of + ;; context->unified as an undo command. + (setq reversible nil)) + (while (not (eobp)) + (case (char-after) + (?\s (insert " ") (setq modif nil) (backward-char 1)) + (?- (setq delete t) (setq modif t)) + (?+ (if (not modif) + (progn (forward-char 1) + (insert " ")) + (delete-char 1) + (insert "! ")) + (backward-char 2)) + (?\\ (when (save-excursion (forward-line 1) + (not (eobp))) + (setq delete t) (setq modif t))) + ;; diff-valid-unified-empty-line. + (?\n (insert " ") (setq modif nil) (backward-char 2) + (setq reversible nil)) + (t (setq modif nil))) + (let ((last-pt (point))) + (forward-line 1) + (when delete + (delete-region last-pt (point)) + (setq delete nil))))))) + (unless (or (not reversible) (eq buffer-undo-list t)) + ;; Drop the many undo entries and replace them with + ;; a single entry that uses diff-context->unified to do + ;; the work. + (setq buffer-undo-list + (cons (list 'apply (- old-end end) start (point-max) + 'diff-context->unified start (point-max)) + old-undo))))))))))) + +(defun diff-context->unified (start end &optional to-context) + "Convert context diffs to unified diffs. +START and END are either taken from the region +\(when it is highlighted) or else cover the whole buffer. +With a prefix argument, convert unified format to context format." + (interactive (if (and transient-mark-mode mark-active) + (list (region-beginning) (region-end) current-prefix-arg) + (list (point-min) (point-max) current-prefix-arg))) + (if to-context + (diff-unified->context start end) + (unless (markerp end) (setq end (copy-marker end t))) + (let ( ;;(diff-inhibit-after-change t) + (inhibit-read-only t)) + (save-excursion + (goto-char start) + (while (and (re-search-forward "^\\(\\(\\*\\*\\*\\) .+\n\\(---\\) .+\\|\\*\\{15\\}.*\n\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]+\\) \\*\\*\\*\\*\\)$" nil t) + (< (point) end)) + (combine-after-change-calls + (if (match-beginning 2) + ;; we matched a file header + (progn + ;; use reverse order to make sure the indices are kept valid + (replace-match "+++" t t nil 3) + (replace-match "---" t t nil 2)) + ;; we matched a hunk header + (let ((line1s (match-string 4)) + (line1e (match-string 5)) + (pt1 (match-beginning 0)) + ;; Variables to use the special undo function. + (old-undo buffer-undo-list) + (old-end (marker-position end)) + (reversible t)) + (replace-match "") + (unless (re-search-forward + diff-context-mid-hunk-header-re nil t) + (error "Can't find matching `--- n1,n2 ----' line")) + (let ((line2s (match-string 1)) + (line2e (match-string 2)) + (pt2 (progn + (delete-region (progn (beginning-of-line) (point)) + (progn (forward-line 1) (point))) + (point-marker)))) + (goto-char pt1) + (forward-line 1) + (while (< (point) pt2) + (case (char-after) + (?! (delete-char 2) (insert "-") (forward-line 1)) + (?- (forward-char 1) (delete-char 1) (forward-line 1)) + (?\s ;merge with the other half of the chunk + (let* ((endline2 + (save-excursion + (goto-char pt2) (forward-line 1) (point)))) + (case (char-after pt2) + ((?! ?+) + (insert "+" + (prog1 (buffer-substring (+ pt2 2) endline2) + (delete-region pt2 endline2)))) + (?\s + (unless (= (- endline2 pt2) + (- (line-beginning-position 2) (point))) + ;; If the two lines we're merging don't have the + ;; same length (can happen with "diff -b"), then + ;; diff-unified->context will not properly undo + ;; this operation. + (setq reversible nil)) + (delete-region pt2 endline2) + (delete-char 1) + (forward-line 1)) + (?\\ (forward-line 1)) + (t (setq reversible nil) + (delete-char 1) (forward-line 1))))) + (t (setq reversible nil) (forward-line 1)))) + (while (looking-at "[+! ] ") + (if (/= (char-after) ?!) (forward-char 1) + (delete-char 1) (insert "+")) + (delete-char 1) (forward-line 1)) + (save-excursion + (goto-char pt1) + (insert "@@ -" line1s "," + (number-to-string (- (string-to-number line1e) + (string-to-number line1s) + -1)) + " +" line2s "," + (number-to-string (- (string-to-number line2e) + (string-to-number line2s) + -1)) " @@")) + (set-marker pt2 nil) + ;; The whole procedure succeeded, let's replace the myriad + ;; of undo elements with just a single special one. + (unless (or (not reversible) (eq buffer-undo-list t)) + (setq buffer-undo-list + (cons (list 'apply (- old-end end) pt1 (point) + 'diff-unified->context pt1 (point)) + old-undo))) + ))))))))) + +(defun diff-reverse-direction (start end) + "Reverse the direction of the diffs. +START and END are either taken from the region (if a prefix arg is given) or +else cover the whole buffer." + (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) + (list (region-beginning) (region-end)) + (list (point-min) (point-max)))) + (unless (markerp end) (setq end (copy-marker end t))) + (let (;;(diff-inhibit-after-change t) + (inhibit-read-only t)) + (save-excursion + (goto-char start) + (while (and (re-search-forward "^\\(\\([-*][-*][-*] \\)\\(.+\\)\n\\([-+][-+][-+] \\)\\(.+\\)\\|\\*\\{15\\}.*\n\\*\\*\\* \\(.+\\) \\*\\*\\*\\*\\|@@ -\\([0-9,]+\\) \\+\\([0-9,]+\\) @@.*\\)$" nil t) + (< (point) end)) + (combine-after-change-calls + (cond + ;; a file header + ((match-beginning 2) (replace-match "\\2\\5\n\\4\\3" nil)) + ;; a context-diff hunk header + ((match-beginning 6) + (let ((pt-lines1 (match-beginning 6)) + (lines1 (match-string 6))) + (replace-match "" nil nil nil 6) + (forward-line 1) + (let ((half1s (point))) + (while (looking-at "[-! \\][ \t]\\|#") + (when (= (char-after) ?-) (delete-char 1) (insert "+")) + (forward-line 1)) + (let ((half1 (delete-and-extract-region half1s (point)))) + (unless (looking-at diff-context-mid-hunk-header-re) + (insert half1) + (error "Can't find matching `--- n1,n2 ----' line")) + (let* ((str1end (or (match-end 2) (match-end 1))) + (str1 (buffer-substring (match-beginning 1) str1end))) + (goto-char str1end) + (insert lines1) + (delete-region (match-beginning 1) str1end) + (forward-line 1) + (let ((half2s (point))) + (while (looking-at "[!+ \\][ \t]\\|#") + (when (= (char-after) ?+) (delete-char 1) (insert "-")) + (forward-line 1)) + (let ((half2 (delete-and-extract-region half2s (point)))) + (insert (or half1 "")) + (goto-char half1s) + (insert (or half2 "")))) + (goto-char pt-lines1) + (insert str1)))))) + ;; a unified-diff hunk header + ((match-beginning 7) + (replace-match "@@ -\\8 +\\7 @@" nil) + (forward-line 1) + (let ((c (char-after)) first last) + (while (case (setq c (char-after)) + (?- (setq first (or first (point))) + (delete-char 1) (insert "+") t) + (?+ (setq last (or last (point))) + (delete-char 1) (insert "-") t) + ((?\\ ?#) t) + (t (when (and first last (< first last)) + (insert (delete-and-extract-region first last))) + (setq first nil last nil) + (memq c (if diff-valid-unified-empty-line + '(?\s ?\n) '(?\s))))) + (forward-line 1)))))))))) + +(defun diff-fixup-modifs (start end) + "Fixup the hunk headers (in case the buffer was modified). +START and END are either taken from the region (if a prefix arg is given) or +else cover the whole buffer." + (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) + (list (region-beginning) (region-end)) + (list (point-min) (point-max)))) + (let ((inhibit-read-only t)) + (save-excursion + (goto-char end) (diff-end-of-hunk nil 'donttrustheader) + (let ((plus 0) (minus 0) (space 0) (bang 0)) + (while (and (= (forward-line -1) 0) (<= start (point))) + (if (not (looking-at + (concat diff-hunk-header-re-unified + "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$" + "\\|--- .+\n\\+\\+\\+ "))) + (case (char-after) + (?\s (incf space)) + (?+ (incf plus)) + (?- (incf minus)) + (?! (incf bang)) + ((?\\ ?#) nil) + (t (setq space 0 plus 0 minus 0 bang 0))) + (cond + ((looking-at diff-hunk-header-re-unified) + (let* ((old1 (match-string 2)) + (old2 (match-string 4)) + (new1 (number-to-string (+ space minus))) + (new2 (number-to-string (+ space plus)))) + (if old2 + (unless (string= new2 old2) (replace-match new2 t t nil 4)) + (goto-char (match-end 4)) (insert "," new2)) + (if old1 + (unless (string= new1 old1) (replace-match new1 t t nil 2)) + (goto-char (match-end 2)) (insert "," new1)))) + ((looking-at diff-context-mid-hunk-header-re) + (when (> (+ space bang plus) 0) + (let* ((old1 (match-string 1)) + (old2 (match-string 2)) + (new (number-to-string + (+ space bang plus -1 (string-to-number old1))))) + (unless (string= new old2) (replace-match new t t nil 2))))) + ((looking-at "\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]*\\) \\*\\*\\*\\*$") + (when (> (+ space bang minus) 0) + (let* ((old (match-string 1)) + (new (format + (concat "%0" (number-to-string (length old)) "d") + (+ space bang minus -1 (string-to-number old))))) + (unless (string= new old) (replace-match new t t nil 2)))))) + (setq space 0 plus 0 minus 0 bang 0))))))) + +;;;; +;;;; Hooks +;;;; + +(defun diff-write-contents-hooks () + "Fixup hunk headers if necessary." + (if (buffer-modified-p) (diff-fixup-modifs (point-min) (point-max))) + nil) + +;; It turns out that making changes in the buffer from within an +;; *-change-function is asking for trouble, whereas making them +;; from a post-command-hook doesn't pose much problems +(defvar diff-unhandled-changes nil) +(defun diff-after-change-function (beg end len) + "Remember to fixup the hunk header. +See `after-change-functions' for the meaning of BEG, END and LEN." + ;; Ignoring changes when inhibit-read-only is set is strictly speaking + ;; incorrect, but it turns out that inhibit-read-only is normally not set + ;; inside editing commands, while it tends to be set when the buffer gets + ;; updated by an async process or by a conversion function, both of which + ;; would rather not be uselessly slowed down by this hook. + (when (and (not undo-in-progress) (not inhibit-read-only)) + (if diff-unhandled-changes + (setq diff-unhandled-changes + (cons (min beg (car diff-unhandled-changes)) + (max end (cdr diff-unhandled-changes)))) + (setq diff-unhandled-changes (cons beg end))))) + +(defun diff-post-command-hook () + "Fixup hunk headers if necessary." + (when (consp diff-unhandled-changes) + (ignore-errors + (save-excursion + (goto-char (car diff-unhandled-changes)) + ;; Maybe we've cut the end of the hunk before point. + (if (and (bolp) (not (bobp))) (backward-char 1)) + ;; We used to fixup modifs on all the changes, but it turns out that + ;; it's safer not to do it on big changes, e.g. when yanking a big + ;; diff, or when the user edits the header, since we might then + ;; screw up perfectly correct values. --Stef + (diff-beginning-of-hunk) + (let* ((style (if (looking-at "\\*\\*\\*") 'context)) + (start (line-beginning-position (if (eq style 'context) 3 2))) + (mid (if (eq style 'context) + (save-excursion + (re-search-forward diff-context-mid-hunk-header-re + nil t))))) + (when (and ;; Don't try to fixup changes in the hunk header. + (> (car diff-unhandled-changes) start) + ;; Don't try to fixup changes in the mid-hunk header either. + (or (not mid) + (< (cdr diff-unhandled-changes) (match-beginning 0)) + (> (car diff-unhandled-changes) (match-end 0))) + (save-excursion + (diff-end-of-hunk nil 'donttrustheader) + ;; Don't try to fixup changes past the end of the hunk. + (>= (point) (cdr diff-unhandled-changes)))) + (diff-fixup-modifs (point) (cdr diff-unhandled-changes))))) + (setq diff-unhandled-changes nil)))) + +(defun diff-next-error (arg reset) + ;; Select a window that displays the current buffer so that point + ;; movements are reflected in that window. Otherwise, the user might + ;; never see the hunk corresponding to the source she's jumping to. + (pop-to-buffer (current-buffer)) + (if reset (goto-char (point-min))) + (diff-hunk-next arg) + (diff-goto-source)) + +(defvar whitespace-style) +(defvar whitespace-trailing-regexp) + +;;;###autoload +(define-derived-mode diff-mode fundamental-mode "Diff" + "Major mode for viewing/editing context diffs. +Supports unified and context diffs as well as (to a lesser extent) +normal diffs. + +When the buffer is read-only, the ESC prefix is not necessary. +If you edit the buffer manually, diff-mode will try to update the hunk +headers for you on-the-fly. + +You can also switch between context diff and unified diff with \\[diff-context->unified], +or vice versa with \\[diff-unified->context] and you can also reverse the direction of +a diff with \\[diff-reverse-direction]. + + \\{diff-mode-map}" + + (set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults) + (set (make-local-variable 'outline-regexp) diff-outline-regexp) + (set (make-local-variable 'imenu-generic-expression) + diff-imenu-generic-expression) + ;; These are not perfect. They would be better done separately for + ;; context diffs and unidiffs. + ;; (set (make-local-variable 'paragraph-start) + ;; (concat "@@ " ; unidiff hunk + ;; "\\|\\*\\*\\* " ; context diff hunk or file start + ;; "\\|--- [^\t]+\t")) ; context or unidiff file + ;; ; start (first or second line) + ;; (set (make-local-variable 'paragraph-separate) paragraph-start) + ;; (set (make-local-variable 'page-delimiter) "--- [^\t]+\t") + ;; compile support + (set (make-local-variable 'next-error-function) 'diff-next-error) + + (set (make-local-variable 'beginning-of-defun-function) + 'diff-beginning-of-file-and-junk) + (set (make-local-variable 'end-of-defun-function) + 'diff-end-of-file) + + ;; Set up `whitespace-mode' so that turning it on will show trailing + ;; whitespace problems on the modified lines of the diff. + (set (make-local-variable 'whitespace-style) '(trailing)) + (set (make-local-variable 'whitespace-trailing-regexp) + "^[-\+!<>].*?\\([\t ]+\\)$") + + (setq buffer-read-only diff-default-read-only) + ;; setup change hooks + (if (not diff-update-on-the-fly) + (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t) + (make-local-variable 'diff-unhandled-changes) + (add-hook 'after-change-functions 'diff-after-change-function nil t) + (add-hook 'post-command-hook 'diff-post-command-hook nil t)) + ;; Neat trick from Dave Love to add more bindings in read-only mode: + (lexical-let ((ro-bind (cons 'buffer-read-only diff-mode-shared-map))) + (add-to-list 'minor-mode-overriding-map-alist ro-bind) + ;; Turn off this little trick in case the buffer is put in view-mode. + (add-hook 'view-mode-hook + (lambda () + (setq minor-mode-overriding-map-alist + (delq ro-bind minor-mode-overriding-map-alist))) + nil t)) + ;; add-log support + (set (make-local-variable 'add-log-current-defun-function) + 'diff-current-defun) + (set (make-local-variable 'add-log-buffer-file-name-function) + (lambda () (diff-find-file-name nil 'noprompt))) + (unless (buffer-file-name) + (hack-dir-local-variables-non-file-buffer))) + +;;;###autoload +(define-minor-mode diff-minor-mode + "Minor mode for viewing/editing context diffs. +\\{diff-minor-mode-map}" + :group 'diff-mode :lighter " Diff" + ;; FIXME: setup font-lock + ;; setup change hooks + (if (not diff-update-on-the-fly) + (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t) + (make-local-variable 'diff-unhandled-changes) + (add-hook 'after-change-functions 'diff-after-change-function nil t) + (add-hook 'post-command-hook 'diff-post-command-hook nil t))) + +;;; Handy hook functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun diff-delete-if-empty () + ;; An empty diff file means there's no more diffs to integrate, so we + ;; can just remove the file altogether. Very handy for .rej files if we + ;; remove hunks as we apply them. + (when (and buffer-file-name + (eq 0 (nth 7 (file-attributes buffer-file-name)))) + (delete-file buffer-file-name))) + +(defun diff-delete-empty-files () + "Arrange for empty diff files to be removed." + (add-hook 'after-save-hook 'diff-delete-if-empty nil t)) + +(defun diff-make-unified () + "Turn context diffs into unified diffs if applicable." + (if (save-excursion + (goto-char (point-min)) + (and (looking-at diff-hunk-header-re) (eq (char-after) ?*))) + (let ((mod (buffer-modified-p))) + (unwind-protect + (diff-context->unified (point-min) (point-max)) + (restore-buffer-modified-p mod))))) + +;;; +;;; Misc operations that have proved useful at some point. +;;; + +(defun diff-next-complex-hunk () + "Jump to the next \"complex\" hunk. +\"Complex\" is approximated by \"the hunk changes the number of lines\". +Only works for unified diffs." + (interactive) + (while + (and (re-search-forward diff-hunk-header-re-unified nil t) + (equal (match-string 2) (match-string 4))))) + +(defun diff-sanity-check-context-hunk-half (lines) + (let ((count lines)) + (while + (cond + ((and (memq (char-after) '(?\s ?! ?+ ?-)) + (memq (char-after (1+ (point))) '(?\s ?\t))) + (decf count) t) + ((or (zerop count) (= count lines)) nil) + ((memq (char-after) '(?! ?+ ?-)) + (if (not (and (eq (char-after (1+ (point))) ?\n) + (y-or-n-p "Try to auto-fix whitespace loss damage? "))) + (error "End of hunk ambiguously marked") + (forward-char 1) (insert " ") (forward-line -1) t)) + ((< lines 0) + (error "End of hunk ambiguously marked")) + ((not (y-or-n-p "Try to auto-fix whitespace loss and word-wrap damage? ")) + (error "Abort!")) + ((eolp) (insert " ") (forward-line -1) t) + (t (insert " ") (delete-region (- (point) 2) (- (point) 1)) t)) + (forward-line)))) + +(defun diff-sanity-check-hunk () + (let (;; Every modification is protected by a y-or-n-p, so it's probably + ;; OK to override a read-only setting. + (inhibit-read-only t)) + (save-excursion + (cond + ((not (looking-at diff-hunk-header-re)) + (error "Not recognizable hunk header")) + + ;; A context diff. + ((eq (char-after) ?*) + (if (not (looking-at "\\*\\{15\\}\\(?: .*\\)?\n\\*\\*\\* \\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? \\*\\*\\*\\*")) + (error "Unrecognized context diff first hunk header format") + (forward-line 2) + (diff-sanity-check-context-hunk-half + (if (match-end 2) + (1+ (- (string-to-number (match-string 2)) + (string-to-number (match-string 1)))) + 1)) + (if (not (looking-at diff-context-mid-hunk-header-re)) + (error "Unrecognized context diff second hunk header format") + (forward-line) + (diff-sanity-check-context-hunk-half + (if (match-end 2) + (1+ (- (string-to-number (match-string 2)) + (string-to-number (match-string 1)))) + 1))))) + + ;; A unified diff. + ((eq (char-after) ?@) + (if (not (looking-at diff-hunk-header-re-unified)) + (error "Unrecognized unified diff hunk header format") + (let ((before (string-to-number (or (match-string 2) "1"))) + (after (string-to-number (or (match-string 4) "1")))) + (forward-line) + (while + (case (char-after) + (?\s (decf before) (decf after) t) + (?- + (if (and (looking-at diff-file-header-re) + (zerop before) (zerop after)) + ;; No need to query: this is a case where two patches + ;; are concatenated and only counting the lines will + ;; give the right result. Let's just add an empty + ;; line so that our code which doesn't count lines + ;; will not get confused. + (progn (save-excursion (insert "\n")) nil) + (decf before) t)) + (?+ (decf after) t) + (t + (cond + ((and diff-valid-unified-empty-line + ;; Not just (eolp) so we don't infloop at eob. + (eq (char-after) ?\n) + (> before 0) (> after 0)) + (decf before) (decf after) t) + ((and (zerop before) (zerop after)) nil) + ((or (< before 0) (< after 0)) + (error (if (or (zerop before) (zerop after)) + "End of hunk ambiguously marked" + "Hunk seriously messed up"))) + ((not (y-or-n-p (concat "Try to auto-fix " (if (eolp) "whitespace loss" "word-wrap damage") "? "))) + (error "Abort!")) + ((eolp) (insert " ") (forward-line -1) t) + (t (insert " ") + (delete-region (- (point) 2) (- (point) 1)) t)))) + (forward-line))))) + + ;; A plain diff. + (t + ;; TODO. + ))))) + +(defun diff-hunk-text (hunk destp char-offset) + "Return the literal source text from HUNK as (TEXT . OFFSET). +If DESTP is nil, TEXT is the source, otherwise the destination text. +CHAR-OFFSET is a char-offset in HUNK, and OFFSET is the corresponding +char-offset in TEXT." + (with-temp-buffer + (insert hunk) + (goto-char (point-min)) + (let ((src-pos nil) + (dst-pos nil) + (divider-pos nil) + (num-pfx-chars 2)) + ;; Set the following variables: + ;; SRC-POS buffer pos of the source part of the hunk or nil if none + ;; DST-POS buffer pos of the destination part of the hunk or nil + ;; DIVIDER-POS buffer pos of any divider line separating the src & dst + ;; NUM-PFX-CHARS number of line-prefix characters used by this format" + (cond ((looking-at "^@@") + ;; unified diff + (setq num-pfx-chars 1) + (forward-line 1) + (setq src-pos (point) dst-pos (point))) + ((looking-at "^\\*\\*") + ;; context diff + (forward-line 2) + (setq src-pos (point)) + (re-search-forward diff-context-mid-hunk-header-re nil t) + (forward-line 0) + (setq divider-pos (point)) + (forward-line 1) + (setq dst-pos (point))) + ((looking-at "^[0-9]+a[0-9,]+$") + ;; normal diff, insert + (forward-line 1) + (setq dst-pos (point))) + ((looking-at "^[0-9,]+d[0-9]+$") + ;; normal diff, delete + (forward-line 1) + (setq src-pos (point))) + ((looking-at "^[0-9,]+c[0-9,]+$") + ;; normal diff, change + (forward-line 1) + (setq src-pos (point)) + (re-search-forward "^---$" nil t) + (forward-line 0) + (setq divider-pos (point)) + (forward-line 1) + (setq dst-pos (point))) + (t + (error "Unknown diff hunk type"))) + + (if (if destp (null dst-pos) (null src-pos)) + ;; Implied empty text + (if char-offset '("" . 0) "") + + ;; For context diffs, either side can be empty, (if there's only + ;; added or only removed text). We should then use the other side. + (cond ((equal src-pos divider-pos) (setq src-pos dst-pos)) + ((equal dst-pos (point-max)) (setq dst-pos src-pos))) + + (when char-offset (goto-char (+ (point-min) char-offset))) + + ;; Get rid of anything except the desired text. + (save-excursion + ;; Delete unused text region + (let ((keep (if destp dst-pos src-pos))) + (when (and divider-pos (> divider-pos keep)) + (delete-region divider-pos (point-max))) + (delete-region (point-min) keep)) + ;; Remove line-prefix characters, and unneeded lines (unified diffs). + (let ((kill-char (if destp ?- ?+))) + (goto-char (point-min)) + (while (not (eobp)) + (if (eq (char-after) kill-char) + (delete-region (point) (progn (forward-line 1) (point))) + (delete-char num-pfx-chars) + (forward-line 1))))) + + (let ((text (buffer-substring-no-properties (point-min) (point-max)))) + (if char-offset (cons text (- (point) (point-min))) text)))))) + + +(defun diff-find-text (text) + "Return the buffer position (BEG . END) of the nearest occurrence of TEXT. +If TEXT isn't found, nil is returned." + (let* ((orig (point)) + (forw (and (search-forward text nil t) + (cons (match-beginning 0) (match-end 0)))) + (back (and (goto-char (+ orig (length text))) + (search-backward text nil t) + (cons (match-beginning 0) (match-end 0))))) + ;; Choose the closest match. + (if (and forw back) + (if (> (- (car forw) orig) (- orig (car back))) back forw) + (or back forw)))) + +(defun diff-find-approx-text (text) + "Return the buffer position (BEG . END) of the nearest occurrence of TEXT. +Whitespace differences are ignored." + (let* ((orig (point)) + (re (concat "^[ \t\n ]*" + (mapconcat 'regexp-quote (split-string text) "[ \t\n ]+") + "[ \t\n ]*\n")) + (forw (and (re-search-forward re nil t) + (cons (match-beginning 0) (match-end 0)))) + (back (and (goto-char (+ orig (length text))) + (re-search-backward re nil t) + (cons (match-beginning 0) (match-end 0))))) + ;; Choose the closest match. + (if (and forw back) + (if (> (- (car forw) orig) (- orig (car back))) back forw) + (or back forw)))) + +(defsubst diff-xor (a b) (if a (if (not b) a) b)) + +(defun diff-find-source-location (&optional other-file reverse noprompt) + "Find out (BUF LINE-OFFSET POS SRC DST SWITCHED). +BUF is the buffer corresponding to the source file. +LINE-OFFSET is the offset between the expected and actual positions + of the text of the hunk or nil if the text was not found. +POS is a pair (BEG . END) indicating the position of the text in the buffer. +SRC and DST are the two variants of text as returned by `diff-hunk-text'. + SRC is the variant that was found in the buffer. +SWITCHED is non-nil if the patch is already applied. +NOPROMPT, if non-nil, means not to prompt the user." + (save-excursion + (let* ((other (diff-xor other-file diff-jump-to-old-file)) + (char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder) + (point)))) + ;; Check that the hunk is well-formed. Otherwise diff-mode and + ;; the user may disagree on what constitutes the hunk + ;; (e.g. because an empty line truncates the hunk mid-course), + ;; leading to potentially nasty surprises for the user. + ;; + ;; Suppress check when NOPROMPT is non-nil (Bug#3033). + (_ (unless noprompt (diff-sanity-check-hunk))) + (hunk (buffer-substring + (point) (save-excursion (diff-end-of-hunk) (point)))) + (old (diff-hunk-text hunk reverse char-offset)) + (new (diff-hunk-text hunk (not reverse) char-offset)) + ;; Find the location specification. + (line (if (not (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")) + (error "Can't find the hunk header") + (if other (match-string 1) + (if (match-end 3) (match-string 3) + (unless (re-search-forward + diff-context-mid-hunk-header-re nil t) + (error "Can't find the hunk separator")) + (match-string 1))))) + (file (or (diff-find-file-name other noprompt) + (error "Can't find the file"))) + (buf (find-file-noselect file))) + ;; Update the user preference if he so wished. + (when (> (prefix-numeric-value other-file) 8) + (setq diff-jump-to-old-file other)) + (with-current-buffer buf + (goto-char (point-min)) (forward-line (1- (string-to-number line))) + (let* ((orig-pos (point)) + (switched nil) + ;; FIXME: Check for case where both OLD and NEW are found. + (pos (or (diff-find-text (car old)) + (progn (setq switched t) (diff-find-text (car new))) + (progn (setq switched nil) + (condition-case nil + (diff-find-approx-text (car old)) + (invalid-regexp nil))) ;Regex too big. + (progn (setq switched t) + (condition-case nil + (diff-find-approx-text (car new)) + (invalid-regexp nil))) ;Regex too big. + (progn (setq switched nil) nil)))) + (nconc + (list buf) + (if pos + (list (count-lines orig-pos (car pos)) pos) + (list nil (cons orig-pos (+ orig-pos (length (car old)))))) + (if switched (list new old t) (list old new)))))))) + + +(defun diff-hunk-status-msg (line-offset reversed dry-run) + (let ((msg (if dry-run + (if reversed "already applied" "not yet applied") + (if reversed "undone" "applied")))) + (message (cond ((null line-offset) "Hunk text not found") + ((= line-offset 0) "Hunk %s") + ((= line-offset 1) "Hunk %s at offset %d line") + (t "Hunk %s at offset %d lines")) + msg line-offset))) + +(defvar diff-apply-hunk-to-backup-file nil) + +(defun diff-apply-hunk (&optional reverse) + "Apply the current hunk to the source file and go to the next. +By default, the new source file is patched, but if the variable +`diff-jump-to-old-file' is non-nil, then the old source file is +patched instead (some commands, such as `diff-goto-source' can change +the value of this variable when given an appropriate prefix argument). + +With a prefix argument, REVERSE the hunk." + (interactive "P") + (destructuring-bind (buf line-offset pos old new &optional switched) + ;; Sometimes we'd like to have the following behavior: if REVERSE go + ;; to the new file, otherwise go to the old. But that means that by + ;; default we use the old file, which is the opposite of the default + ;; for diff-goto-source, and is thus confusing. Also when you don't + ;; know about it it's pretty surprising. + ;; TODO: make it possible to ask explicitly for this behavior. + ;; + ;; This is duplicated in diff-test-hunk. + (diff-find-source-location nil reverse) + (cond + ((null line-offset) + (error "Can't find the text to patch")) + ((with-current-buffer buf + (and buffer-file-name + (backup-file-name-p buffer-file-name) + (not diff-apply-hunk-to-backup-file) + (not (set (make-local-variable 'diff-apply-hunk-to-backup-file) + (yes-or-no-p (format "Really apply this hunk to %s? " + (file-name-nondirectory + buffer-file-name))))))) + (error "%s" + (substitute-command-keys + (format "Use %s\\[diff-apply-hunk] to apply it to the other file" + (if (not reverse) "\\[universal-argument] "))))) + ((and switched + ;; A reversed patch was detected, perhaps apply it in reverse. + (not (save-window-excursion + (pop-to-buffer buf) + (goto-char (+ (car pos) (cdr old))) + (y-or-n-p + (if reverse + "Hunk hasn't been applied yet; apply it now? " + "Hunk has already been applied; undo it? "))))) + (message "(Nothing done)")) + (t + ;; Apply the hunk + (with-current-buffer buf + (goto-char (car pos)) + (delete-region (car pos) (cdr pos)) + (insert (car new))) + ;; Display BUF in a window + (set-window-point (display-buffer buf) (+ (car pos) (cdr new))) + (diff-hunk-status-msg line-offset (diff-xor switched reverse) nil) + (when diff-advance-after-apply-hunk + (diff-hunk-next)))))) + + +(defun diff-test-hunk (&optional reverse) + "See whether it's possible to apply the current hunk. +With a prefix argument, try to REVERSE the hunk." + (interactive "P") + (destructuring-bind (buf line-offset pos src dst &optional switched) + (diff-find-source-location nil reverse) + (set-window-point (display-buffer buf) (+ (car pos) (cdr src))) + (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) + + +(defalias 'diff-mouse-goto-source 'diff-goto-source) + +(defun diff-goto-source (&optional other-file event) + "Jump to the corresponding source line. +`diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg +is given) determines whether to jump to the old or the new file. +If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) +then `diff-jump-to-old-file' is also set, for the next invocations." + (interactive (list current-prefix-arg last-input-event)) + ;; When pointing at a removal line, we probably want to jump to + ;; the old location, and else to the new (i.e. as if reverting). + ;; This is a convenient detail when using smerge-diff. + (if event (posn-set-point (event-end event))) + (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) + (destructuring-bind (buf line-offset pos src dst &optional switched) + (diff-find-source-location other-file rev) + (pop-to-buffer buf) + (goto-char (+ (car pos) (cdr src))) + (diff-hunk-status-msg line-offset (diff-xor rev switched) t)))) + + +(defun diff-current-defun () + "Find the name of function at point. +For use in `add-log-current-defun-function'." + ;; Kill change-log-default-name so it gets recomputed each time, since + ;; each hunk may belong to another file which may belong to another + ;; directory and hence have a different ChangeLog file. + (kill-local-variable 'change-log-default-name) + (save-excursion + (when (looking-at diff-hunk-header-re) + (forward-line 1) + (re-search-forward "^[^ ]" nil t)) + (destructuring-bind (&optional buf line-offset pos src dst switched) + ;; Use `noprompt' since this is used in which-func-mode and such. + (ignore-errors ;Signals errors in place of prompting. + (diff-find-source-location nil nil 'noprompt)) + (when buf + (beginning-of-line) + (or (when (memq (char-after) '(?< ?-)) + ;; Cursor is pointing at removed text. This could be a removed + ;; function, in which case, going to the source buffer will + ;; not help since the function is now removed. Instead, + ;; try to figure out the function name just from the + ;; code-fragment. + (let ((old (if switched dst src))) + (with-temp-buffer + (insert (car old)) + (funcall (buffer-local-value 'major-mode buf)) + (goto-char (+ (point-min) (cdr old))) + (add-log-current-defun)))) + (with-current-buffer buf + (goto-char (+ (car pos) (cdr src))) + (add-log-current-defun))))))) + +(defun diff-ignore-whitespace-hunk () + "Re-diff the current hunk, ignoring whitespace differences." + (interactive) + (let* ((char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder) + (point)))) + (opts (case (char-after) (?@ "-bu") (?* "-bc") (t "-b"))) + (line-nb (and (or (looking-at "[^0-9]+\\([0-9]+\\)") + (error "Can't find line number")) + (string-to-number (match-string 1)))) + (inhibit-read-only t) + (hunk (delete-and-extract-region + (point) (save-excursion (diff-end-of-hunk) (point)))) + (lead (make-string (1- line-nb) ?\n)) ;Line nums start at 1. + (file1 (make-temp-file "diff1")) + (file2 (make-temp-file "diff2")) + (coding-system-for-read buffer-file-coding-system) + old new) + (unwind-protect + (save-excursion + (setq old (diff-hunk-text hunk nil char-offset)) + (setq new (diff-hunk-text hunk t char-offset)) + (write-region (concat lead (car old)) nil file1 nil 'nomessage) + (write-region (concat lead (car new)) nil file2 nil 'nomessage) + (with-temp-buffer + (let ((status + (call-process diff-command nil t nil + opts file1 file2))) + (case status + (0 nil) ;Nothing to reformat. + (1 (goto-char (point-min)) + ;; Remove the file-header. + (when (re-search-forward diff-hunk-header-re nil t) + (delete-region (point-min) (match-beginning 0)))) + (t (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (insert hunk))) + (setq hunk (buffer-string)) + (unless (memq status '(0 1)) + (error "Diff returned: %s" status))))) + ;; Whatever happens, put back some equivalent text: either the new + ;; one or the original one in case some error happened. + (insert hunk) + (delete-file file1) + (delete-file file2)))) + +;;; Fine change highlighting. + +(defface diff-refine-change + '((((class color) (min-colors 88) (background light)) + :background "grey85") + (((class color) (min-colors 88) (background dark)) + :background "grey60") + (((class color) (background light)) + :background "yellow") + (((class color) (background dark)) + :background "green") + (t :weight bold)) + "Face used for char-based changes shown by `diff-refine-hunk'." + :group 'diff-mode) + +(defun diff-refine-preproc () + (while (re-search-forward "^[+>]" nil t) + ;; Remove spurious changes due to the fact that one side of the hunk is + ;; marked with leading + or > and the other with leading - or <. + ;; We used to replace all the prefix chars with " " but this only worked + ;; when we did char-based refinement (or when using + ;; smerge-refine-weight-hack) since otherwise, the `forward' motion done + ;; in chopup do not necessarily do the same as the ones in highlight + ;; since the "_" is not treated the same as " ". + (replace-match (cdr (assq (char-before) '((?+ . "-") (?> . "<")))))) + ) + +(defun diff-refine-hunk () + "Highlight changes of hunk at point at a finer granularity." + (interactive) + (eval-and-compile (require 'smerge-mode)) + (save-excursion + (diff-beginning-of-hunk 'try-harder) - (let* ((style (diff-hunk-style)) ;Skips the hunk header as well. ++ (let* ((start (point)) ++ (style (diff-hunk-style)) ;Skips the hunk header as well. + (beg (point)) + (props '((diff-mode . fine) (face diff-refine-change))) - (end (progn (diff-end-of-hunk) (point)))) ++ ;; Be careful to go back to `start' so diff-end-of-hunk gets ++ ;; to read the hunk header's line info. ++ (end (progn (goto-char start) (diff-end-of-hunk) (point)))) + + (remove-overlays beg end 'diff-mode 'fine) + + (goto-char beg) + (case style + (unified + (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+" + end t) + (smerge-refine-subst (match-beginning 0) (match-end 1) + (match-end 1) (match-end 0) + props 'diff-refine-preproc))) + (context + (let* ((middle (save-excursion (re-search-forward "^---"))) + (other middle)) + (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) + (smerge-refine-subst (match-beginning 0) (match-end 0) + (save-excursion + (goto-char other) + (re-search-forward "^\\(?:!.*\n\\)+" end) + (setq other (match-end 0)) + (match-beginning 0)) + other + props 'diff-refine-preproc)))) + (t ;; Normal diffs. + (let ((beg1 (1+ (point)))) + (when (re-search-forward "^---.*\n" end t) + ;; It's a combined add&remove, so there's something to do. + (smerge-refine-subst beg1 (match-beginning 0) + (match-end 0) end + props 'diff-refine-preproc)))))))) + + +(defun diff-add-change-log-entries-other-window () + "Iterate through the current diff and create ChangeLog entries. +I.e. like `add-change-log-entry-other-window' but applied to all hunks." + (interactive) + ;; XXX: Currently add-change-log-entry-other-window is only called + ;; once per hunk. Some hunks have multiple changes, it would be + ;; good to call it for each change. + (save-excursion + (goto-char (point-min)) + (let ((orig-buffer (current-buffer))) + (condition-case nil + ;; Call add-change-log-entry-other-window for each hunk in + ;; the diff buffer. + (while (progn + (diff-hunk-next) + ;; Move to where the changes are, + ;; `add-change-log-entry-other-window' works better in + ;; that case. + (re-search-forward + (concat "\n[!+-<>]" + ;; If the hunk is a context hunk with an empty first + ;; half, recognize the "--- NNN,MMM ----" line + "\\(-- [0-9]+\\(,[0-9]+\\)? ----\n" + ;; and skip to the next non-context line. + "\\( .*\n\\)*[+]\\)?") + nil t)) + (save-excursion + ;; FIXME: this pops up windows of all the buffers. + (add-change-log-entry nil nil t nil t))) + ;; When there's no more hunks, diff-hunk-next signals an error. + (error nil))))) + +;; provide the package +(provide 'diff-mode) + +;;; Old Change Log from when diff-mode wasn't part of Emacs: +;; Revision 1.11 1999/10/09 23:38:29 monnier +;; (diff-mode-load-hook): dropped. +;; (auto-mode-alist): also catch *.diffs. +;; (diff-find-file-name, diff-mode): add smarts to find the right file +;; for *.rej files (that lack any file name indication). +;; +;; Revision 1.10 1999/09/30 15:32:11 monnier +;; added support for "\ No newline at end of file". +;; +;; Revision 1.9 1999/09/15 00:01:13 monnier +;; - added basic `compile' support. +;; - have diff-kill-hunk call diff-kill-file if it's the only hunk. +;; - diff-kill-file now tries to kill the leading garbage as well. +;; +;; Revision 1.8 1999/09/13 21:10:09 monnier +;; - don't use CL in the autoloaded code +;; - accept diffs using -T +;; +;; Revision 1.7 1999/09/05 20:53:03 monnier +;; interface to ediff-patch +;; +;; Revision 1.6 1999/09/01 20:55:13 monnier +;; (ediff=patch-file): add bindings to call ediff-patch. +;; (diff-find-file-name): taken out of diff-goto-source. +;; (diff-unified->context, diff-context->unified, diff-reverse-direction, +;; diff-fixup-modifs): only use the region if a prefix arg is given. +;; +;; Revision 1.5 1999/08/31 19:18:52 monnier +;; (diff-beginning-of-file, diff-prev-file): fixed wrong parenthesis. +;; +;; Revision 1.4 1999/08/31 13:01:44 monnier +;; use `combine-after-change-calls' to minimize the slowdown of font-lock. +;; + +;; arch-tag: 2571d7ff-bc28-4cf9-8585-42e21890be66 +;;; diff-mode.el ends here diff --cc lisp/vc/log-edit.el index 2bce58f50f2,00000000000..c7f37c50011 mode 100644,000000..100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@@ -1,879 -1,0 +1,879 @@@ +;;; log-edit.el --- Major mode for editing CVS commit messages + +;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +;; 2008, 2009, 2010 Free Software Foundation, Inc. + +;; Author: Stefan Monnier +;; Keywords: pcl-cvs cvs commit log vc + +;; 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: + +;; Todo: + +;; - Move in VC's code +;; - Add compatibility for VC's hook variables + +;;; Code: + +(eval-when-compile (require 'cl)) +(require 'add-log) ; for all the ChangeLog goodies +(require 'pcvs-util) +(require 'ring) + +;;;; +;;;; Global Variables +;;;; + +(defgroup log-edit nil + "Major mode for editing RCS and CVS commit messages." + :group 'pcl-cvs + :group 'vc ; It's used by VC. + :version "21.1" + :prefix "log-edit-") + +;; compiler pacifiers +(defvar cvs-buffer) + + +;; The main keymap + +(easy-mmode-defmap log-edit-mode-map + `(("\C-c\C-c" . log-edit-done) + ("\C-c\C-a" . log-edit-insert-changelog) + ("\C-c\C-d" . log-edit-show-diff) + ("\C-c\C-f" . log-edit-show-files) + ("\M-n" . log-edit-next-comment) + ("\M-p" . log-edit-previous-comment) + ("\M-r" . log-edit-comment-search-backward) + ("\M-s" . log-edit-comment-search-forward) + ("\C-c?" . log-edit-mode-help)) + "Keymap for the `log-edit-mode' (to edit version control log messages)." + :group 'log-edit) + +;; Compatibility with old names. Should we bother ? +(defvar vc-log-mode-map log-edit-mode-map) +(defvar vc-log-entry-mode vc-log-mode-map) + +(easy-menu-define log-edit-menu log-edit-mode-map + "Menu used for `log-edit-mode'." + '("Log-Edit" + ["Done" log-edit-done + :help "Exit log-edit and proceed with the actual action."] + "--" + ["Insert ChangeLog" log-edit-insert-changelog + :help "Insert a log message by looking at the ChangeLog"] + ["Add to ChangeLog" log-edit-add-to-changelog + :help "Insert this log message into the appropriate ChangeLog file"] + "--" + ["Show diff" log-edit-show-diff + :help "Show the diff for the files to be committed."] + ["List files" log-edit-show-files + :help "Show the list of relevant files."] + "--" + ["Previous comment" log-edit-previous-comment + :help "Cycle backwards through comment history"] + ["Next comment" log-edit-next-comment + :help "Cycle forwards through comment history."] + ["Search comment forward" log-edit-comment-search-forward + :help "Search forwards through comment history for a substring match of str"] + ["Search comment backward" log-edit-comment-search-backward + :help "Search backwards through comment history for substring match of str"])) + +(defcustom log-edit-confirm 'changed + "If non-nil, `log-edit-done' will request confirmation. +If 'changed, only request confirmation if the list of files has + changed since the beginning of the log-edit session." + :group 'log-edit + :type '(choice (const changed) (const t) (const nil))) + +(defcustom log-edit-keep-buffer nil + "If non-nil, don't hide the buffer after `log-edit-done'." + :group 'log-edit + :type 'boolean) + +(defvar cvs-commit-buffer-require-final-newline t) +(make-obsolete-variable 'cvs-commit-buffer-require-final-newline + 'log-edit-require-final-newline + "21.1") + +(defcustom log-edit-require-final-newline + cvs-commit-buffer-require-final-newline + "Enforce a newline at the end of commit log messages. +Enforce it silently if t, query if non-nil and don't do anything if nil." + :group 'log-edit + :type '(choice (const ask) (const t) (const nil))) + +(defcustom log-edit-setup-invert nil + "Non-nil means `log-edit' should invert the meaning of its SETUP arg. +If SETUP is 'force, this variable has no effect." + :group 'log-edit + :type 'boolean) + +(defcustom log-edit-hook '(log-edit-insert-cvs-template + log-edit-show-files + log-edit-insert-changelog) + "Hook run at the end of `log-edit'." + :group 'log-edit + :type '(hook :options (log-edit-insert-changelog + log-edit-insert-cvs-rcstemplate + log-edit-insert-cvs-template + log-edit-insert-filenames))) + +(defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook) + "Hook run when entering `log-edit-mode'." + :group 'log-edit + :type 'hook) + +(defcustom log-edit-done-hook nil + "Hook run before doing the actual commit. +This hook can be used to cleanup the message, enforce various +conventions, or to allow recording the message in some other database, +such as a bug-tracking system. The list of files about to be committed +can be obtained from `log-edit-files'." + :group 'log-edit + :type '(hook :options (log-edit-set-common-indentation + log-edit-add-to-changelog))) + +(defcustom log-edit-strip-single-file-name nil + "If non-nil, remove file name from single-file log entries." + :type 'boolean + :safe 'booleanp + :group 'log-edit + :version "24.1") + +(defvar cvs-changelog-full-paragraphs t) +(make-obsolete-variable 'cvs-changelog-full-paragraphs + 'log-edit-changelog-full-paragraphs + "21.1") + +(defvar log-edit-changelog-full-paragraphs cvs-changelog-full-paragraphs + "*If non-nil, include full ChangeLog paragraphs in the log. +This may be set in the ``local variables'' section of a ChangeLog, to +indicate the policy for that ChangeLog. + +A ChangeLog paragraph is a bunch of log text containing no blank lines; +a paragraph usually describes a set of changes with a single purpose, +but perhaps spanning several functions in several files. Changes in +different paragraphs are unrelated. + +You could argue that the log entry for a file should contain the +full ChangeLog paragraph mentioning the change to the file, even though +it may mention other files, because that gives you the full context you +need to understand the change. This is the behavior you get when this +variable is set to t. + +On the other hand, you could argue that the log entry for a change +should contain only the text for the changes which occurred in that +file, because the log is per-file. This is the behavior you get +when this variable is set to nil.") + +;;;; Internal global or buffer-local vars + +(defconst log-edit-files-buf "*log-edit-files*") +(defvar log-edit-initial-files nil) +(defvar log-edit-callback nil) +(defvar log-edit-diff-function nil) +(defvar log-edit-listfun nil) + +(defvar log-edit-parent-buffer nil) + +;;; Originally taken from VC-Log mode + +(defconst log-edit-maximum-comment-ring-size 32 + "Maximum number of saved comments in the comment ring.") +(defvar log-edit-comment-ring (make-ring log-edit-maximum-comment-ring-size)) +(defvar log-edit-comment-ring-index nil) +(defvar log-edit-last-comment-match "") + +(defun log-edit-new-comment-index (stride len) + "Return the comment index STRIDE elements from the current one. +LEN is the length of `log-edit-comment-ring'." + (mod (cond + (log-edit-comment-ring-index (+ log-edit-comment-ring-index stride)) + ;; Initialize the index on the first use of this command + ;; so that the first M-p gets index 0, and the first M-n gets + ;; index -1. + ((> stride 0) (1- stride)) + (t stride)) + len)) + +(defun log-edit-previous-comment (arg) + "Cycle backwards through comment history. +With a numeric prefix ARG, go back ARG comments." + (interactive "*p") + (let ((len (ring-length log-edit-comment-ring))) + (if (<= len 0) + (progn (message "Empty comment ring") (ding)) + ;; Don't use `erase-buffer' because we don't want to `widen'. + (delete-region (point-min) (point-max)) + (setq log-edit-comment-ring-index (log-edit-new-comment-index arg len)) + (message "Comment %d" (1+ log-edit-comment-ring-index)) + (insert (ring-ref log-edit-comment-ring log-edit-comment-ring-index))))) + +(defun log-edit-next-comment (arg) + "Cycle forwards through comment history. +With a numeric prefix ARG, go forward ARG comments." + (interactive "*p") + (log-edit-previous-comment (- arg))) + +(defun log-edit-comment-search-backward (str &optional stride) + "Search backwards through comment history for substring match of STR. +If the optional argument STRIDE is present, that is a step-width to use +when going through the comment ring." + ;; Why substring rather than regexp ? -sm + (interactive + (list (read-string "Comment substring: " nil nil log-edit-last-comment-match))) + (unless stride (setq stride 1)) + (if (string= str "") + (setq str log-edit-last-comment-match) + (setq log-edit-last-comment-match str)) + (let* ((str (regexp-quote str)) + (len (ring-length log-edit-comment-ring)) + (n (log-edit-new-comment-index stride len))) + (while (progn (when (or (>= n len) (< n 0)) (error "Not found")) + (not (string-match str (ring-ref log-edit-comment-ring n)))) + (setq n (+ n stride))) + (setq log-edit-comment-ring-index n) + (log-edit-previous-comment 0))) + +(defun log-edit-comment-search-forward (str) + "Search forwards through comment history for a substring match of STR." + (interactive + (list (read-string "Comment substring: " nil nil log-edit-last-comment-match))) + (log-edit-comment-search-backward str -1)) + +(defun log-edit-comment-to-change-log (&optional whoami file-name) + "Enter last VC comment into the change log for the current file. +WHOAMI (interactive prefix) non-nil means prompt for user name +and site. FILE-NAME is the name of the change log; if nil, use +`change-log-default-name'. + +This may be useful as a `log-edit-checkin-hook' to update change logs +automatically." + (interactive (if current-prefix-arg + (list current-prefix-arg + (prompt-for-change-log-name)))) + (let (;; Extract the comment first so we get any error before doing anything. + (comment (ring-ref log-edit-comment-ring 0)) + ;; Don't let add-change-log-entry insert a defun name. + (add-log-current-defun-function 'ignore) + end) + ;; Call add-log to do half the work. + (add-change-log-entry whoami file-name t t) + ;; Insert the VC comment, leaving point before it. + (setq end (save-excursion (insert comment) (point-marker))) + (if (looking-at "\\s *\\s(") + ;; It starts with an open-paren, as in "(foo): Frobbed." + ;; So remove the ": " add-log inserted. + (delete-char -2)) + ;; Canonicalize the white space between the file name and comment. + (just-one-space) + ;; Indent rest of the text the same way add-log indented the first line. + (let ((indentation (current-indentation))) + (save-excursion + (while (< (point) end) + (forward-line 1) + (indent-to indentation)) + (setq end (point)))) + ;; Fill the inserted text, preserving open-parens at bol. + (let ((paragraph-start (concat paragraph-start "\\|\\s *\\s("))) + (beginning-of-line) + (fill-region (point) end)) + ;; Canonicalize the white space at the end of the entry so it is + ;; separated from the next entry by a single blank line. + (skip-syntax-forward " " end) + (delete-char (- (skip-syntax-backward " "))) + (or (eobp) (looking-at "\n\n") + (insert "\n")))) + +;; Compatibility with old names. +(define-obsolete-variable-alias 'vc-comment-ring 'log-edit-comment-ring "22.1") +(define-obsolete-variable-alias 'vc-comment-ring-index 'log-edit-comment-ring-index "22.1") +(define-obsolete-function-alias 'vc-previous-comment 'log-edit-previous-comment "22.1") +(define-obsolete-function-alias 'vc-next-comment 'log-edit-next-comment "22.1") +(define-obsolete-function-alias 'vc-comment-search-reverse 'log-edit-comment-search-backward "22.1") +(define-obsolete-function-alias 'vc-comment-search-forward 'log-edit-comment-search-forward "22.1") +(define-obsolete-function-alias 'vc-comment-to-change-log 'log-edit-comment-to-change-log "22.1") + +;;; +;;; Actual code +;;; + +(defface log-edit-summary '((t :inherit font-lock-function-name-face)) + "Face for the summary in `log-edit-mode' buffers.") + +(defface log-edit-header '((t :inherit font-lock-keyword-face)) + "Face for the headers in `log-edit-mode' buffers.") + +(defface log-edit-unknown-header '((t :inherit font-lock-comment-face)) + "Face for unknown headers in `log-edit-mode' buffers.") + +(defvar log-edit-headers-alist '(("Summary" . log-edit-summary) + ("Fixes") ("Author")) + "AList of known headers and the face to use to highlight them.") + +(defconst log-edit-header-contents-regexp + "[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?") + +(defun log-edit-match-to-eoh (limit) + ;; FIXME: copied from message-match-to-eoh. + (let ((start (point))) + (rfc822-goto-eoh) + ;; Typical situation: some temporary change causes the header to be + ;; incorrect, so EOH comes earlier than intended: the last lines of the + ;; intended headers are now not considered part of the header any more, + ;; so they don't have the multiline property set. When the change is + ;; completed and the header has its correct shape again, the lack of the + ;; multiline property means we won't rehighlight the last lines of + ;; the header. + (if (< (point) start) + nil ;No header within start..limit. + ;; Here we disregard LIMIT so that we may extend the area again. + (set-match-data (list start (point))) + (point)))) + +(defvar log-edit-font-lock-keywords + ;; Copied/inspired by message-font-lock-keywords. + `((log-edit-match-to-eoh + (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp) + (progn (goto-char (match-beginning 0)) (match-end 0)) nil + (1 (if (assoc (match-string 2) log-edit-headers-alist) + 'log-edit-header + 'log-edit-unknown-header) + nil lax) + ;; From `log-edit-header-contents-regexp': + (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) + 'log-edit-header) + nil lax))))) + +;;;###autoload +(defun log-edit (callback &optional setup params buffer mode &rest ignore) + "Setup a buffer to enter a log message. +\\The buffer will be put in mode MODE or `log-edit-mode' +if MODE is nil. +If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run. +Mark and point will be set around the entire contents of the buffer so +that it is easy to kill the contents of the buffer with \\[kill-region]. +Once you're done editing the message, pressing \\[log-edit-done] will call +`log-edit-done' which will end up calling CALLBACK to do the actual commit. + +PARAMS if non-nil is an alist. Possible keys and associated values: + `log-edit-listfun' -- function taking no arguments that returns the list of + files that are concerned by the current operation (using relative names); + `log-edit-diff-function' -- function taking no arguments that + displays a diff of the files concerned by the current operation. + +If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the +log message and go back to the current buffer when done. Otherwise, it +uses the current buffer." + (let ((parent (current-buffer))) + (if buffer (pop-to-buffer buffer)) + (when (and log-edit-setup-invert (not (eq setup 'force))) + (setq setup (not setup))) + (when setup + (erase-buffer) + (insert "Summary: ") + (save-excursion (insert "\n\n"))) + (if mode + (funcall mode) + (log-edit-mode)) + (set (make-local-variable 'log-edit-callback) callback) + (if (listp params) + (dolist (crt params) + (set (make-local-variable (car crt)) (cdr crt))) + ;; For backward compatibility with log-edit up to version 22.2 + ;; accept non-list PARAMS to mean `log-edit-list'. + (set (make-local-variable 'log-edit-listfun) params)) + + (if buffer (set (make-local-variable 'log-edit-parent-buffer) parent)) + (set (make-local-variable 'log-edit-initial-files) (log-edit-files)) + (when setup (run-hooks 'log-edit-hook)) + (goto-char (point-min)) (push-mark (point-max)) + (message "%s" (substitute-command-keys + "Press \\[log-edit-done] when you are done editing.")))) + +(define-derived-mode log-edit-mode text-mode "Log-Edit" + "Major mode for editing version-control log messages. +When done editing the log entry, just type \\[log-edit-done] which +will trigger the actual commit of the file(s). +Several other handy support commands are provided of course and +the package from which this is used might also provide additional +commands (under C-x v for VC, for example). + +\\{log-edit-mode-map}" + (set (make-local-variable 'font-lock-defaults) + '(log-edit-font-lock-keywords t t)) + (make-local-variable 'log-edit-comment-ring-index) + (hack-dir-local-variables-non-file-buffer)) + +(defun log-edit-hide-buf (&optional buf where) + (when (setq buf (get-buffer (or buf log-edit-files-buf))) + (let ((win (get-buffer-window buf where))) + (if win (ignore-errors (delete-window win)))) + (bury-buffer buf))) + +(defun log-edit-done () + "Finish editing the log message and commit the files. +If you want to abort the commit, simply delete the buffer." + (interactive) + ;; Clean up empty headers. + (goto-char (point-min)) + (while (looking-at (concat "^[a-z]*:" log-edit-header-contents-regexp)) + (let ((beg (match-beginning 0))) + (goto-char (match-end 0)) + (if (string-match "\\`[ \n\t]*\\'" (match-string 1)) + (delete-region beg (point))))) + ;; Get rid of leading empty lines. + (goto-char (point-min)) + (when (looking-at "\\([ \t]*\n\\)+") + (delete-region (match-beginning 0) (match-end 0))) + ;; Get rid of trailing empty lines + (goto-char (point-max)) + (skip-syntax-backward " ") + (when (equal (char-after) ?\n) (forward-char 1)) + (delete-region (point) (point-max)) + ;; Check for final newline + (if (and (> (point-max) (point-min)) + (/= (char-before (point-max)) ?\n) + (or (eq log-edit-require-final-newline t) + (and log-edit-require-final-newline + (y-or-n-p + (format "Buffer %s does not end in newline. Add one? " + (buffer-name)))))) + (save-excursion + (goto-char (point-max)) + (insert ?\n))) + (let ((comment (buffer-string))) + (when (or (ring-empty-p log-edit-comment-ring) + (not (equal comment (ring-ref log-edit-comment-ring 0)))) + (ring-insert log-edit-comment-ring comment))) + (let ((win (get-buffer-window log-edit-files-buf))) + (if (and log-edit-confirm + (not (and (eq log-edit-confirm 'changed) + (equal (log-edit-files) log-edit-initial-files))) + (progn + (log-edit-show-files) + (not (y-or-n-p "Really commit? ")))) + (progn (when (not win) (log-edit-hide-buf)) + (message "Oh, well! Later maybe?")) + (run-hooks 'log-edit-done-hook) + (log-edit-hide-buf) + (unless (or log-edit-keep-buffer (not log-edit-parent-buffer)) + (cvs-bury-buffer (current-buffer) log-edit-parent-buffer)) + (call-interactively log-edit-callback)))) + +(defun log-edit-files () + "Return the list of files that are about to be committed." + (ignore-errors (funcall log-edit-listfun))) + +(defun log-edit-mode-help () + "Provide help for the `log-edit-mode-map'." + (interactive) + (if (eq last-command 'log-edit-mode-help) + (describe-function major-mode) + (message "%s" + (substitute-command-keys + "Type `\\[log-edit-done]' to finish commit. Try `\\[describe-function] log-edit-done' for more help.")))) + +(defcustom log-edit-common-indent 0 + "Minimum indentation to use in `log-edit-set-common-indentation'." + :group 'log-edit + :type 'integer) + +(defun log-edit-set-common-indentation () + "(Un)Indent the current buffer rigidly to `log-edit-common-indent'." + (save-excursion + (let ((common (point-max))) + (rfc822-goto-eoh) + (while (< (point) (point-max)) + (if (not (looking-at "^[ \t]*$")) + (setq common (min common (current-indentation)))) + (forward-line 1)) + (rfc822-goto-eoh) + (indent-rigidly (point) (point-max) + (- log-edit-common-indent common))))) + +(defun log-edit-show-diff () + "Show the diff for the files to be committed." + (interactive) + (if (functionp log-edit-diff-function) + (funcall log-edit-diff-function) + (error "Diff functionality has not been setup"))) + +(defun log-edit-show-files () + "Show the list of files to be committed." + (interactive) + (let* ((files (log-edit-files)) + (buf (get-buffer-create log-edit-files-buf))) + (with-current-buffer buf + (log-edit-hide-buf buf 'all) + (setq buffer-read-only nil) + (erase-buffer) + (cvs-insert-strings files) + (setq buffer-read-only t) + (goto-char (point-min)) + (save-selected-window + (cvs-pop-to-buffer-same-frame buf) + (shrink-window-if-larger-than-buffer) + (selected-window))))) + +(defun log-edit-insert-cvs-template () + "Insert the template specified by the CVS administrator, if any. +This simply uses the local CVS/Template file." + (interactive) + (when (or (called-interactively-p 'interactive) + (= (point-min) (point-max))) + (when (file-readable-p "CVS/Template") + (insert-file-contents "CVS/Template")))) + +(defun log-edit-insert-cvs-rcstemplate () + "Insert the rcstemplate from the CVS repository. +This contacts the repository to get the rcstemplate file and +can thus take some time." + (interactive) + (when (or (called-interactively-p 'interactive) + (= (point-min) (point-max))) + (when (file-readable-p "CVS/Root") + ;; Ignore the stderr stuff, even if it's an error. + (call-process "cvs" nil '(t nil) nil + "checkout" "-p" "CVSROOT/rcstemplate")))) + +(defun log-edit-insert-filenames () + "Insert the list of files that are to be committed." + (interactive) + (insert "Affected files: \n" + (mapconcat 'identity (log-edit-files) " \n"))) + +(defun log-edit-add-to-changelog () + "Insert this log message into the appropriate ChangeLog file." + (interactive) + ;; Yuck! + (unless (string= (buffer-string) (ring-ref log-edit-comment-ring 0)) + (ring-insert log-edit-comment-ring (buffer-string))) + (dolist (f (log-edit-files)) + (let ((buffer-file-name (expand-file-name f))) + (save-excursion + (log-edit-comment-to-change-log))))) + +(defvar log-edit-changelog-use-first nil) + +(defvar log-edit-rewrite-fixes nil + "Rule to rewrite bug numbers into Fixes: headers. +The value should be of the form (REGEXP . REPLACEMENT) +where REGEXP should match the expression referring to a bug number +in the text, and REPLACEMENT is an expression to pass to `replace-match' +to build the Fixes: header.") +(put 'log-edit-rewrite-fixes 'safe-local-variable + (lambda (v) (and (stringp (car-safe v)) (stringp (cdr v))))) + +(defun log-edit-insert-changelog (&optional use-first) + "Insert a log message by looking at the ChangeLog. +The idea is to write your ChangeLog entries first, and then use this +command to commit your changes. + +To select default log text, we: +- find the ChangeLog entries for the files to be checked in, +- verify that the top entry in the ChangeLog is on the current date + and by the current user; if not, we don't provide any default text, +- search the ChangeLog entry for paragraphs containing the names of + the files we're checking in, and finally +- use those paragraphs as the log text. + +If the optional prefix arg USE-FIRST is given (via \\[universal-argument]), +or if the command is repeated a second time in a row, use the first log entry +regardless of user name or time." + (interactive "P") + (let ((eoh (save-excursion (rfc822-goto-eoh) (point)))) + (when (<= (point) eoh) + (goto-char eoh) + (if (looking-at "\n") (forward-char 1)))) + (let ((author + (let ((log-edit-changelog-use-first + (or use-first (eq last-command 'log-edit-insert-changelog)))) + (log-edit-insert-changelog-entries (log-edit-files))))) + (log-edit-set-common-indentation) + ;; Add an Author: field if appropriate. + (when author + (rfc822-goto-eoh) + (insert "Author: " author "\n" (if (looking-at "\n") "" "\n"))) + ;; Add a Fixes: field if applicable. + (when (consp log-edit-rewrite-fixes) + (rfc822-goto-eoh) + (when (re-search-forward (car log-edit-rewrite-fixes) nil t) + (let ((start (match-beginning 0)) + (end (match-end 0)) + (fixes (match-substitute-replacement + (cdr log-edit-rewrite-fixes)))) + (delete-region start end) + (rfc822-goto-eoh) + (insert "Fixes: " fixes "\n" (if (looking-at "\n") "" "\n"))))) + (goto-char (point-min)) + (when (and log-edit-strip-single-file-name (looking-at "\\*\\s-+")) + (forward-line 1) + (when (not (re-search-forward "^\\*\\s-+" nil t)) + (goto-char (point-min)) + (skip-chars-forward "^():") + (skip-chars-forward ": ") + (delete-region (point-min) (point)))))) + +;;;; +;;;; functions for getting commit message from ChangeLog a file... +;;;; Courtesy Jim Blandy +;;;; + +(defun log-edit-narrow-changelog () + "Narrow to the top page of the current buffer, a ChangeLog file. +Actually, the narrowed region doesn't include the date line. +A \"page\" in a ChangeLog file is the area between two dates." + (or (eq major-mode 'change-log-mode) + (error "log-edit-narrow-changelog: current buffer isn't a ChangeLog")) + + (goto-char (point-min)) + + ;; Skip date line and subsequent blank lines. + (forward-line 1) + (if (looking-at "[ \t\n]*\n") + (goto-char (match-end 0))) + + (let ((start (point))) + (forward-page 1) + (narrow-to-region start (point)) + (goto-char (point-min)))) + +(defun log-edit-changelog-paragraph () + "Return the bounds of the ChangeLog paragraph containing point. +If we are between paragraphs, return the previous paragraph." + (beginning-of-line) + (if (looking-at "^[ \t]*$") + (skip-chars-backward " \t\n" (point-min))) + (list (progn + (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit) + (goto-char (match-end 0))) + (point)) + (if (re-search-forward "^[ \t\n]*$" nil t) + (match-beginning 0) + (point-max)))) + +(defun log-edit-changelog-subparagraph () + "Return the bounds of the ChangeLog subparagraph containing point. +A subparagraph is a block of non-blank lines beginning with an asterisk. +If we are between sub-paragraphs, return the previous subparagraph." + (end-of-line) + (if (search-backward "*" nil t) + (list (progn (beginning-of-line) (point)) + (progn + (forward-line 1) + (if (re-search-forward "^[ \t]*[\n*]" nil t) + (match-beginning 0) + (point-max)))) + (list (point) (point)))) + +(defun log-edit-changelog-entry () + "Return the bounds of the ChangeLog entry containing point. +The variable `log-edit-changelog-full-paragraphs' decides whether an +\"entry\" is a paragraph or a subparagraph; see its documentation string +for more details." + (save-excursion + (if log-edit-changelog-full-paragraphs + (log-edit-changelog-paragraph) + (log-edit-changelog-subparagraph)))) + +(defvar user-full-name) +(defvar user-mail-address) + +(defvar log-edit-author) ;Dynamically scoped. + +(defun log-edit-changelog-ours-p () + "See if ChangeLog entry at point is for the current user, today. +Return non-nil if it is." + ;; Code adapted from add-change-log-entry. + (let ((name (or (and (boundp 'add-log-full-name) add-log-full-name) + (and (fboundp 'user-full-name) (user-full-name)) + (and (boundp 'user-full-name) user-full-name))) + (mail (or (and (boundp 'add-log-mailing-address) add-log-mailing-address) + ;;(and (fboundp 'user-mail-address) (user-mail-address)) + (and (boundp 'user-mail-address) user-mail-address))) + (time (or (and (boundp 'add-log-time-format) + (functionp add-log-time-format) + (funcall add-log-time-format)) + (format-time-string "%Y-%m-%d")))) + (if (null log-edit-changelog-use-first) + (looking-at (regexp-quote (format "%s %s <%s>" time name mail))) + ;; Check the author, to potentially add it as a "Author: " header. + (when (looking-at "[^ \t]") + (when (and (boundp 'log-edit-author) + (not (looking-at (format ".+ .+ <%s>" + (regexp-quote mail)))) + (looking-at ".+ \\(.+ <.+>\\)")) + (let ((author (replace-regexp-in-string " " " " + (match-string 1)))) + (unless (and log-edit-author + (string-match (regexp-quote author) log-edit-author)) + (setq log-edit-author + (if log-edit-author + (concat log-edit-author ", " author) + author))))) + t)))) + +(defun log-edit-changelog-entries (file) + "Return the ChangeLog entries for FILE, and the ChangeLog they came from. +The return value looks like this: + (LOGBUFFER (ENTRYSTART ENTRYEND) ...) +where LOGBUFFER is the name of the ChangeLog buffer, and each +\(ENTRYSTART . ENTRYEND\) pair is a buffer region." + (let ((changelog-file-name + (let ((default-directory + (file-name-directory (expand-file-name file))) + (visiting-buffer (find-buffer-visiting file))) + ;; If there is a buffer visiting FILE, and it has a local + ;; value for `change-log-default-name', use that. + (if (and visiting-buffer + (local-variable-p 'change-log-default-name + visiting-buffer)) + (with-current-buffer visiting-buffer + change-log-default-name) + ;; `find-change-log' uses `change-log-default-name' if set + ;; and sets it before exiting, so we need to work around + ;; that memoizing which is undesired here + (setq change-log-default-name nil) + (find-change-log))))) + (with-current-buffer (find-file-noselect changelog-file-name) + (unless (eq major-mode 'change-log-mode) (change-log-mode)) + (goto-char (point-min)) + (if (looking-at "\\s-*\n") (goto-char (match-end 0))) + (if (not (log-edit-changelog-ours-p)) + (list (current-buffer)) + (save-restriction + (log-edit-narrow-changelog) + (goto-char (point-min)) + + ;; Search for the name of FILE relative to the ChangeLog. If that + ;; doesn't occur anywhere, they're not using full relative + ;; filenames in the ChangeLog, so just look for FILE; we'll accept + ;; some false positives. + (let ((pattern (file-relative-name + file (file-name-directory changelog-file-name)))) + (if (or (string= pattern "") + (not (save-excursion + (search-forward pattern nil t)))) + (setq pattern (file-name-nondirectory file))) + + (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)" - pattern ++ (regexp-quote pattern) + "\\($\\|[^[:alnum:]]\\)")) + + (let (texts + (pos (point))) + (while (and (not (eobp)) (re-search-forward pattern nil t)) + (let ((entry (log-edit-changelog-entry))) + (if (< (elt entry 1) (max (1+ pos) (point))) + ;; This is not relevant, actually. + nil + (push entry texts)) + ;; Make sure we make progress. + (setq pos (max (1+ pos) (elt entry 1))) + (goto-char pos))) + + (cons (current-buffer) texts)))))))) + +(defun log-edit-changelog-insert-entries (buffer beg end &rest files) + "Insert the text from BUFFER between BEG and END. +Rename relative filenames in the ChangeLog entry as FILES." + (let ((opoint (point)) + (log-name (buffer-file-name buffer)) + (case-fold-search nil) + bound) + (insert-buffer-substring buffer beg end) + (setq bound (point-marker)) + (when log-name + (dolist (f files) + (save-excursion + (goto-char opoint) + (when (re-search-forward + (concat "\\(^\\|[ \t]\\)\\(" + (file-relative-name f (file-name-directory log-name)) + "\\)[, :\n]") + bound t) + (replace-match f t t nil 2))))) + ;; Eliminate tabs at the beginning of the line. + (save-excursion + (goto-char opoint) + (while (re-search-forward "^\\(\t+\\)" bound t) + (replace-match ""))))) + +(defun log-edit-insert-changelog-entries (files) + "Given a list of files FILES, insert the ChangeLog entries for them." + (let ((log-entries nil) + (log-edit-author nil)) + ;; Note that any ChangeLog entry can apply to more than one file. + ;; Here we construct a log-entries list with elements of the form + ;; ((LOGBUFFER ENTRYSTART ENTRYEND) FILE1 FILE2...) + (dolist (file files) + (let* ((entries (log-edit-changelog-entries file)) + (buf (car entries)) + key entry) + (dolist (region (cdr entries)) + (setq key (cons buf region)) + (if (setq entry (assoc key log-entries)) + (setcdr entry (append (cdr entry) (list file))) + (push (list key file) log-entries))))) + ;; Now map over log-entries, and extract the strings. + (dolist (log-entry (nreverse log-entries)) + (apply 'log-edit-changelog-insert-entries + (append (car log-entry) (cdr log-entry))) + (insert "\n")) + log-edit-author)) + +(defun log-edit-extract-headers (headers comment) + "Extract headers from COMMENT to form command line arguments. +HEADERS should be an alist with elements of the form (HEADER . CMDARG) +associating header names to the corresponding cmdline option name and the +result is then a list of the form (MSG CMDARG1 HDRTEXT1 CMDARG2 HDRTEXT2...). +where MSG is the remaining text from STRING. +If \"Summary\" is not in HEADERS, then the \"Summary\" header is extracted +anyway and put back as the first line of MSG." + (with-temp-buffer + (insert comment) + (rfc822-goto-eoh) + (narrow-to-region (point-min) (point)) + (let ((case-fold-search t) + (summary ()) + (res ())) + (dolist (header (if (assoc "Summary" headers) headers + (cons '("Summary" . t) headers))) + (goto-char (point-min)) + (while (re-search-forward (concat "^" (car header) + ":" log-edit-header-contents-regexp) + nil t) + (if (eq t (cdr header)) + (setq summary (match-string 1)) + (push (match-string 1) res) + (push (or (cdr header) (car header)) res)) + (replace-match "" t t))) + ;; Remove header separator if the header is empty. + (widen) + (goto-char (point-min)) + (when (looking-at "\\([ \t]*\n\\)+") + (delete-region (match-beginning 0) (match-end 0))) + (if summary (insert summary "\n")) + (cons (buffer-string) res)))) + +(provide 'log-edit) + +;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc +;;; log-edit.el ends here diff --cc src/ChangeLog index 18c482c2e92,97401ffe40a..2db05fd1722 --- a/src/ChangeLog +++ b/src/ChangeLog @@@ -1,74 -1,66 +1,129 @@@ -2010-12-12 Eli Zaretskii ++2010-12-13 Eli Zaretskii + + * fileio.c (Fexpand_file_name): Doc fix. (Bug#7617) + -2010-12-11 Eli Zaretskii - - * w32fns.c (Fx_show_tip): Call try_window with last argument - TRY_WINDOW_IGNORE_FONTS_CHANGE. Delete the TODO ifdef: problem - solved. Round up the tip height to an integral multiple of the - frame's line height. Add FRAME_COLUMN_WIDTH to the tip width. - (Bug#7398) ++2010-12-13 Eli Zaretskii + + * xdisp.c (string_pos_nchars_ahead, c_string_pos) + (face_before_or_after_it_pos, next_element_from_string) + (next_element_from_c_string, produce_stretch_glyph): Remove unused + calculations of maximum string length before calling + string_char_and_length and STRING_CHAR_AND_LENGTH. + (string_char_and_length): Update commentary: MAXLEN is no longer + needed. + -2010-12-10 Jan Djärv ++2010-12-13 Jan Djärv + + * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT + as (Qsave_session arg). + + * xsmfns.c (smc_interact_CB): Set arg to Qnil. + (smc_die_CB): Make an event with arg Qt. + (Fhandle_save_session): If event has Qt as argument, + call Fkill_emacs (Bug#7552). + -2010-12-07 Jan Djärv ++2010-12-13 Chong Yidong ++ ++ * buffer.c (transient-mark-mode): Doc fix (Bug#7465). ++ ++2010-12-13 Jan Djärv + + * xsmfns.c (smc_die_CB): Call Fkill_emacs (Bug#7552). + -2010-12-06 Chong Yidong ++2010-12-13 Chong Yidong + + * dispextern.h (struct it): New member overlay_strings_charpos. + + * xdisp.c (next_overlay_string, load_overlay_strings): Record the + charpos where we computed n_overlay_strings. + (next_overlay_string): Load overlay strings at recorded position, + which may not be the same as the iterator's charpos (Bug#7016). + -2010-12-05 Jan Djärv - - * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background - with cursor color and draw a rectangle around the image (Bug#7412). - -2010-12-05 Chong Yidong ++2010-12-13 Chong Yidong + + * xdisp.c (try_scrolling): Avoid infloop if the first line is + obscured due to a vscroll (Bug#7537). + -2010-12-02 Jan Djärv ++2010-12-13 Jan Djärv + + * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT. + + * nsterm.m (x_set_window_size, windowWillResize, initFrameFromEmacs): + Use FRAME_TOOLBAR_HEIGHT. + (x_set_offset): Handle XNegative and YNegative in + f->size_hint_flags (Bug#7510). + -2010-11-25 Kenichi Handa +2010-12-11 Eli Zaretskii + + * w32fns.c (Fx_show_tip): Call try_window with last argument + TRY_WINDOW_IGNORE_FONTS_CHANGE. Delete the TODO ifdef: problem + solved. Round up the tip height to an integral multiple of the + frame's line height. Add FRAME_COLUMN_WIDTH to the tip width. + (Bug#7398) + +2010-12-08 Glenn Morris + + * fileio.c (Fverify_visited_file_modtime): Default to current buffer. + +2010-12-06 Lars Magne Ingebrigtsen + + * xml.c (parse_region): Ignore blank HTML nodes. + (make_dom): Return CDATA sections (like ) as + text nodes. + +2010-12-06 Stefan Monnier + + * lread.c (read1): Allow newstyle unquote outside of backquote. + Disallow old-style backquotes inside new-style backquotes. + Don't count unquotes to figure out when we're "syntactically inside + but semantically outside of a backquote" any more. + Extend the restriction no-unescaped-commas-and-backquotes-in-symbols + to all contexts. + +2010-12-05 Chong Yidong + + * process.c: Remove checks for HAVE_SYS_IOCTL_H (Bug#7484). + +2010-12-04 Andreas Schwab + + * Makefile.in (M_FILE): Substitute @M_FILE@ instead of @machfile@. + (S_FILE): Substitute @S_FILE@ instead of @opsysfile@. + * m/arm.h, m/sh3.h, m/xtensa.h: Remove files. + +2010-12-03 Andreas Schwab + + * lisp.h (union Lisp_Object): Explicitly declare signedness of + bit-field. + (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. + * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. + * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/hp800.h: Remove file. + * m/mips.h: Remove file. + +2010-12-03 Jan Djärv + + * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background + with cursor color and draw a rectangle around the image (Bug#7412). + +2010-12-03 Andreas Schwab + + * frame.c (x_set_font): Remove unused variable. + +2010-12-02 Jan Djärv + + * nsmenu.m (update_frame_tool_bar): Remove NSLog on invalid image. + + * nsterm.m (ns_draw_glyph_string): Switch fore- and background if + drawing text under filled box cursor (Bug#7479). + +2010-11-27 Kenichi Handa * charset.c (emacs_mule_charset): Make it an array of charset ID; i.e. integer. diff --cc src/buffer.c index 67192b4843b,939e2bb0e19..1351dac3cd7 --- a/src/buffer.c +++ b/src/buffer.c @@@ -6099,23 -6237,11 +6099,25 @@@ to the value obtained by calling `curre If the buffer has never been shown in a window, the value is nil. */); DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, - doc: /* */); + doc: /* Non-nil if Transient Mark mode is enabled. +See the command `transient-mark-mode' for a description of this minor mode. + +Non-nil also enables highlighting of the region whenever the mark is active. +The variable `highlight-nonselected-windows' controls whether to highlight +all windows or just the selected window. + - If the value is `lambda', that enables Transient Mark mode temporarily. - After any subsequent action that would normally deactivate the mark - \(such as buffer modification), Transient Mark mode is turned off. - - If the value is (only . OLDVAL), that enables Transient Mark mode - temporarily. After any subsequent point motion command that is not - shift-translated, or any other action that would normally deactivate - the mark (such as buffer modification), the value of - `transient-mark-mode' is set to OLDVAL. */); ++Lisp programs may give this variable certain special values: ++ ++- A value of `lambda' enables Transient Mark mode temporarily. ++ It is disabled again after any subsequent action that would ++ normally deactivate the mark (e.g. buffer modification). ++ ++- A value of (only . OLDVAL) enables Transient Mark mode ++ temporarily. After any subsequent point motion command that is ++ not shift-translated, or any other action that would normally ++ deactivate the mark (e.g. buffer modification), the value of ++ `transient-mark-mode' is set to OLDVAL. */); Vtransient_mark_mode = Qnil; - /* The docstring is in simple.el. If we put it here, it would be - overwritten when transient-mark-mode is defined using - define-minor-mode. */ DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, doc: /* *Non-nil means disregard read-only status of buffers or characters. diff --cc src/fileio.c index 886e5ebc411,e330f724142..c2b93a6bd8b --- a/src/fileio.c +++ b/src/fileio.c @@@ -793,9 -842,10 +796,9 @@@ See also the function `substitute-in-fi For technical reasons, this function can return correct but non-intuitive results for the root directory; for instance, \(expand-file-name ".." "/") returns "/..". For this reason, use - (directory-file-name (file-name-directory dirname)) to traverse a + \(directory-file-name (file-name-directory dirname)) to traverse a filesystem tree, not (expand-file-name ".." dirname). */) - (name, default_directory) - Lisp_Object name, default_directory; + (Lisp_Object name, Lisp_Object default_directory) { /* These point to SDATA and need to be careful with string-relocation during GC (via DECODE_FILE). */ diff --cc src/xdisp.c index 77e9db2e5eb,d3afac26a68..1c220647ba9 --- a/src/xdisp.c +++ b/src/xdisp.c @@@ -1544,14 -1454,15 +1544,13 @@@ pos_visible_p (struct window *w, EMACS_ } - /* Return the next character from STR which is MAXLEN bytes long. - Return in *LEN the length of the character. This is like - STRING_CHAR_AND_LENGTH but never returns an invalid character. If - we find one, we return a `?', but with the length of the invalid - character. */ + /* Return the next character from STR. Return in *LEN the length of + the character. This is like STRING_CHAR_AND_LENGTH but never + returns an invalid character. If we find one, we return a `?', but + with the length of the invalid character. */ static INLINE int -string_char_and_length (str, len) - const unsigned char *str; - int *len; +string_char_and_length (const unsigned char *str, int *len) { int c; diff --cc src/xsmfns.c index 7b82fd4e61e,8a16f68b255..561fd5ee51a --- a/src/xsmfns.c +++ b/src/xsmfns.c @@@ -306,10 -295,12 +307,10 @@@ smc_save_yourself_CB (SmcConn smcConn /* According to the SM specification, this shall close the connection. */ static void -smc_die_CB (smcConn, clientData) - SmcConn smcConn; - SmPointer clientData; +smc_die_CB (SmcConn smcConn, SmPointer clientData) { - SmcCloseConnection (smcConn, 0, 0); - ice_connection_closed (); + emacs_event.kind = SAVE_SESSION_EVENT; + emacs_event.arg = Qt; } /* We don't use the next two but they are mandatory, leave them empty. @@@ -520,11 -534,15 +521,14 @@@ from `emacs-session-save' If the retur is told to abort the window system shutdown. Do not call this function yourself. */) - (event) - Lisp_Object event; + (Lisp_Object event) { + int kill_emacs = CONSP (event) && CONSP (XCDR (event)) + && EQ (Qt, XCAR (XCDR (event))); + /* Check doing_interact so that we don't do anything if someone called this at the wrong time. */ - if (doing_interact) + if (doing_interact && ! kill_emacs) { Bool cancel_shutdown = False;