commit ba42f7932419c3c8b1e23f39c81a1a2dd1b3a154 (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Sun Sep 27 22:07:14 2020 -0400 Fix pcomplete completion of things like `xargs` and `sudo` (bug#16197) * lisp/pcmpl-unix.el (pcomplete/xargs): Don't `pcomplete-this` around `pcomplete-command-completion-function`. (pcomplete/sudo): Make it an alias for `pcomplete/xargs`. * lisp/shell.el (shell-command-completion-function): Return the names from `exec-path` when the command name has no `/`. diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el index 74f45b9523..9d346cfbd2 100644 --- a/lisp/pcmpl-unix.el +++ b/lisp/pcmpl-unix.el @@ -82,10 +82,14 @@ being via `pcmpl-ssh-known-hosts-file'." ;;;###autoload (defun pcomplete/xargs () "Completion for `xargs'." - (pcomplete-here (funcall pcomplete-command-completion-function)) + ;; FIXME: Add completion of xargs-specific arguments. + (funcall pcomplete-command-completion-function) (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) pcomplete-default-completion-function))) +;; FIXME: Add completion of sudo-specific arguments. +(defalias 'pcomplete/sudo #'pcomplete/xargs) + ;;;###autoload (defalias 'pcomplete/time 'pcomplete/xargs) diff --git a/lisp/shell.el b/lisp/shell.el index 9667dab2af..6129e5efc8 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -460,9 +460,12 @@ Thus, this does not include the shell's current directory.") This is the value of `pcomplete-command-completion-function' for Shell buffers. It implements `shell-completion-execonly' for `pcomplete' completion." - (pcomplete-here (pcomplete-entries nil - (if shell-completion-execonly - 'file-executable-p)))) + (if (pcomplete-match "/") + (pcomplete-here (pcomplete-entries nil + (if shell-completion-execonly + 'file-executable-p))) + (pcomplete-here + (nth 2 (shell--command-completion-data))))) (defun shell-completion-vars () "Setup completion vars for `shell-mode' and `read-shell-command'." commit 4155ca273ade47bc7e19fe4af1f41c4e764a59ba Author: Michael Albinus Date: Sun Sep 27 18:59:04 2020 +0200 Document D-Bus monitoring * doc/misc/dbus.texi: Replace "symbol" by "keyword" where appropriate. (Alternative Buses): Adapt dbus-init-bus description. (Errors and Events): Adapt dbus-event structure. New defuns dbus-event-destination-name, dbus-event-handler and dbus-event-arguments. (Monitoring Events): New node. * lisp/net/dbus.el: Replace "symbol" by "keyword" where appropriate. (cl-lib): Require. (dbus-register-monitor): Adapt the argument list. (dbus-monitor-handler): Extend. (dbus-init-bus): Adapt docstring. * test/lisp/net/dbus-tests.el (dbus-test01-compound-types): Skip if needed. Extend test. diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 95d6523d36..4b2eab4eb7 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -63,6 +63,7 @@ another. An overview of D-Bus can be found at * Signals:: Sending and receiving signals. * Alternative Buses:: Alternative buses and environments. * Errors and Events:: Errors and events. +* Monitoring Events:: Monitoring events. * Index:: Index including concepts, functions, variables. * GNU Free Documentation License:: The license for this documentation. @@ -162,12 +163,13 @@ registered names. Internally they use the basic interface @defun dbus-list-activatable-names &optional bus This function returns the D-Bus service names, which can be activated -for @var{bus}. It must be either the symbol @code{:system} (the -default) or the symbol @code{:session}. An activatable service is +for @var{bus}. It must be either the keyword @code{:system} (the +default) or the keyword @code{:session}. An activatable service is described in a service registration file. Under GNU/Linux, such files are located at @file{/usr/share/dbus-1/system-services/} (for the @code{:system} bus) or @file{/usr/share/dbus-1/services/}. An -activatable service is not necessarily registered at @var{bus} already. +activatable service is not necessarily registered at @var{bus} +already. The result is a list of strings, which is @code{nil} when there are no activatable service names at all. Example: @@ -186,7 +188,7 @@ there are no registered service names at all. Well known names are strings like @samp{org.freedesktop.DBus}. Names starting with @samp{:} are unique names for services. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @end defun @@ -196,7 +198,7 @@ known name in @var{bus}. A service has a known name if it doesn't start with @samp{:}. The result is a list of strings, which is @code{nil} when there are no known names at all. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @end defun @@ -206,7 +208,7 @@ For a given service, registered at D-Bus @var{bus} under the name result is a list of strings, or @code{nil} when there are no queued names for @var{service} at all. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @var{service} must be a known service name as string. @end defun @@ -217,7 +219,7 @@ For a given service, registered at D-Bus @var{bus} under the name owner. The result is a string, or @code{nil} when there is no name owner of @var{service}. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @var{service} must be a known service name as string. @end defun @@ -228,7 +230,7 @@ registered at D-Bus @var{bus}. If @var{service} has not yet started, it is autostarted if possible. The result is either @code{t} or @code{nil}. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @var{service} must be a string. @var{timeout}, a nonnegative integer, specifies the maximum number of milliseconds before @code{dbus-ping} must return. The default value is 25,000. @@ -256,7 +258,7 @@ it, you can instead write: This function returns the unique name, under which Emacs is registered at D-Bus @var{bus}, as a string. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @end defun @@ -375,7 +377,7 @@ must be strings. This function returns all interfaces and sub-nodes of @var{service}, registered at object path @var{path} at bus @var{bus}. -@var{bus} must be either the symbol @code{:system} or the symbol +@var{bus} must be either the keyword @code{:system} or the keyword @code{:session}. @var{service} must be a known service name, and @var{path} must be a valid object path. The last two parameters are strings. The result, the introspection data, is a string in XML @@ -747,8 +749,8 @@ or @var{property} cannot be read, an error is raised. Example: @defun dbus-set-property bus service path interface property [type] value This function sets the value of @var{property} of @var{interface} to @var{value}. It will be checked at @var{bus}, @var{service}, -@var{path}. @var{value} can be preceded by a @var{type} symbol. When -the value is successfully set, this function returns @var{value}. +@var{path}. @var{value} can be preceded by a @var{type} keyword. +When the value is successfully set, this function returns @var{value}. Example: @lisp @@ -999,8 +1001,8 @@ Other Lisp objects, like symbols or hash tables, are not accepted as input parameters. If it is necessary to use another D-Bus type, a corresponding type -symbol can be prepended to the corresponding Lisp object. Basic D-Bus -types are represented by the type symbols @code{:byte}, +keyword can be prepended to the corresponding Lisp object. Basic +D-Bus types are represented by the type keywords @code{:byte}, @code{:boolean}, @code{:int16}, @code{:uint16}, @code{:int32}, @code{:uint32}, @code{:int64}, @code{:uint64}, @code{:double}, @code{:string}, @code{:object-path}, @code{:signature} and @@ -1040,7 +1042,7 @@ If typed explicitly, a non-@code{nil} boolean value like @code{:boolean 'symbol} is handled like @code{t} or @code{:boolean t}. A D-Bus compound type is always represented as a list. The @sc{car} -of this list can be the type symbol @code{:array}, @code{:variant}, +of this list can be the type keyword @code{:array}, @code{:variant}, @code{:struct} or @code{:dict-entry}, which would result in a corresponding D-Bus container. @code{:array} is optional, because this is the default compound D-Bus type for a list. @@ -1215,7 +1217,7 @@ parameters from the object. @defun dbus-call-method bus service path interface method &optional :timeout timeout &rest args @anchor{dbus-call-method} This function calls @var{method} on the D-Bus @var{bus}. @var{bus} is -either the symbol @code{:system} or the symbol @code{:session}. +either the keyword @code{:system} or the keyword @code{:session}. @var{service} is the D-Bus service name to be used. @var{path} is the D-Bus object path, @var{service} is registered at. @var{interface} is @@ -1308,8 +1310,8 @@ emulate the @code{lshal} command on GNU/Linux systems: @defun dbus-call-method-asynchronously bus service path interface method handler &optional :timeout timeout &rest args This function calls @var{method} on the D-Bus @var{bus} -asynchronously. @var{bus} is either the symbol @code{:system} or the -symbol @code{:session}. +asynchronously. @var{bus} is either the keyword @code{:system} or the +keyword @code{:session}. @var{service} is the D-Bus service name to be used. @var{path} is the D-Bus object path, @var{service} is registered at. @var{interface} is @@ -1369,7 +1371,7 @@ the following functions: This function registers the known name @var{service} on D-Bus @var{bus}. -@var{bus} is either the symbol @code{:system} or the symbol +@var{bus} is either the keyword @code{:system} or the keyword @code{:session}. @var{service} is the service name to be registered on the D-Bus. It @@ -1405,7 +1407,7 @@ We already are the primary owner. This function unregisters all objects from D-Bus @var{bus}, that were registered by Emacs for @var{service}. -@var{bus} is either the symbol @code{:system} or the symbol +@var{bus} is either the keyword @code{:system} or the keyword @code{:session}. @var{service} is the D-Bus service name of the D-Bus. It must be a @@ -1452,7 +1454,7 @@ The interface namespace @code{org.gnu.Emacs} used by Emacs. With this function, an application registers @var{method} on the D-Bus @var{bus}. -@var{bus} is either the symbol @code{:system} or the symbol +@var{bus} is either the keyword @code{:system} or the keyword @code{:session}. @var{service} is the D-Bus service name of the D-Bus object @@ -1477,8 +1479,8 @@ cons cell, @var{handler} can return this object directly, instead of returning a list containing the object. If @var{handler} returns a reply message with an empty argument list, -@var{handler} must return the symbol @code{:ignore} in order -to distinguish it from @code{nil} (the boolean false). +@var{handler} must return the keyword @code{:ignore} in order to +distinguish it from @code{nil} (the boolean false). If @var{handler} detects an error, it shall return the list @code{(:error @var{error-name} @var{error-message})}. @@ -1580,7 +1582,7 @@ The test then runs With this function, an application declares a @var{property} on the D-Bus @var{bus}. -@var{bus} is either the symbol @code{:system} or the symbol +@var{bus} is either the keyword @code{:system} or the keyword @code{:session}. @var{service} is the D-Bus service name of the D-Bus. It must be a @@ -1593,12 +1595,12 @@ discussion of @var{dont-register-service} below). @var{property} is the name of the property of @var{interface}. @var{access} indicates, whether the property can be changed by other -services via D-Bus. It must be either the symbol @code{:read}, +services via D-Bus. It must be either the keyword @code{:read}, @code{:write} or @code{:readwrite}. @var{value} is the initial value of the property, it can be of any valid type (@xref{dbus-call-method}, for details). @var{value} can be -preceded by a @var{type} symbol. +preceded by a @var{type} keyword. If @var{property} already exists on @var{path}, it will be overwritten. For properties with access type @code{:read} this is the @@ -1707,7 +1709,7 @@ This function is similar to @code{dbus-call-method}. The difference is, that there are no returning output parameters. The function emits @var{signal} on the D-Bus @var{bus}. @var{bus} is -either the symbol @code{:system} or the symbol @code{:session}. It +either the keyword @code{:system} or the keyword @code{:session}. It doesn't matter whether another object has registered for @var{signal}. Signals can be unicast or broadcast messages. For broadcast messages, @@ -1735,7 +1737,7 @@ arguments. They are converted into D-Bus types as described in With this function, an application registers for a signal on the D-Bus @var{bus}. -@var{bus} is either the symbol @code{:system} or the symbol +@var{bus} is either the keyword @code{:system} or the keyword @code{:session}. @var{service} is the D-Bus service name used by the sending D-Bus @@ -1837,18 +1839,17 @@ Until now, we have spoken about the system and the session buses, which are the default buses to be connected to. However, it is possible to connect to any bus with a known address. This is a UNIX domain or TCP/IP socket. Everywhere, where a @var{bus} is mentioned -as argument of a function (the symbol @code{:system} or the symbol +as argument of a function (the keyword @code{:system} or the keyword @code{:session}), this address can be used instead. The connection to this bus must be initialized first. @defun dbus-init-bus bus &optional private This function establishes the connection to D-Bus @var{bus}. -@var{bus} can be either the symbol @code{:system} or the symbol +@var{bus} can be either the keyword @code{:system} or the keyword @code{:session}, or it can be a string denoting the address of the -corresponding bus. For the system and session buses, this function -is called when loading @file{dbus.el}, there is no need to call it -again. +corresponding bus. For the system and session buses, this function is +called when loading @file{dbus.el}, there is no need to call it again. The function returns the number of connections this Emacs session has established to the @var{bus} under the same unique name @@ -1860,11 +1861,12 @@ established. When @var{private} is non-@code{nil}, a new connection is established instead of reusing an existing one. It results in a new unique name -at the bus. This can be used, if it is necessary to distinguish from -another connection used in the same Emacs process, like the one -established by GTK+. It should be used with care for at least the -@code{:system} and @code{:session} buses, because other Emacs Lisp -packages might already use this connection to those buses. +at the @var{bus}. This can be used, if it is necessary to distinguish +from another connection used in the same Emacs process, like the one +established by GTK+. If @var{bus} is the keyword @code{:system} or +the keyword @code{:session}, the new private connection is identified +by the keywords @code{:system-private} or @code{:session-private}, +respectively. Example: You initialize a connection to the AT-SPI bus on your host: @@ -1907,7 +1909,7 @@ is supported depends on the bus daemon configuration, however. This function sets the value of the @var{bus} environment @var{variable} to @var{value}. -@var{bus} is either a Lisp symbol, @code{:system} or @code{:session}, +@var{bus} is either a Lisp keyword, @code{:system} or @code{:session}, or a string denoting the bus address. Both @var{variable} and @var{value} should be strings. @@ -1973,23 +1975,31 @@ Events, , , elisp}. They are retrieved only, when Emacs runs in interactive mode. The generated event has this form: @lisp -(dbus-event @var{bus} @var{type} @var{serial} @var{service} @var{path} @var{interface} @var{member} @var{handler} - &rest @var{args}) +(dbus-event @var{bus} @var{type} @var{serial} @var{service} @var{destination} @var{path} @var{interface} @var{member} + @var{handler} &rest @var{args}) @end lisp @var{bus} identifies the D-Bus the message is coming from. It is -either the symbol @code{:system} or the symbol @code{:session}. +either a Lisp keyword, @code{:system}, @code{:session}, +@code{:system-private} or @code{:session-private}, or a string +denoting the bus address. @var{type} is the D-Bus message type which has caused the event. It can be @code{dbus-message-type-invalid}, @code{dbus-message-type-method-call}, @code{dbus-message-type-method-return}, @code{dbus-message-type-error}, or @code{dbus-message-type-signal}. -@var{serial} is the serial number of the received D-Bus message. +@var{serial} is the serial number of the received D-Bus message, +unless @var{type} is equal @code{dbus-message-type-error}. @var{service} and @var{path} are the unique name and the object path -of the D-Bus object emitting the message. @var{interface} and -@var{member} denote the message which has been sent. +of the D-Bus object emitting the message. @var{destination} is the +D-Bus name the message is dedicated to, or @code{nil} in case the +message is a broadcast signal. + +@var{interface} and @var{member} denote the message which has been +sent. When @var{type} is @code{dbus-message-type-error}, @var{member} +is the error name. @var{handler} is the callback function which has been registered for this message (@pxref{Signals}). @var{args} are the typed arguments as @@ -2010,7 +2020,7 @@ callback function in order to retrieve the information from the event. @defun dbus-event-bus-name event This function returns the bus name @var{event} is coming from. The -result is either the symbol @code{:system} or the symbol +result is either the keyword @code{:system} or the keyword @code{:session}. @end defun @@ -2029,6 +2039,11 @@ This function returns the unique name of the D-Bus object @var{event} is coming from. @end defun +@defun dbus-event-destination-name event +This function returns the unique name of the D-Bus object @var{event} +is dedicated to. +@end defun + @defun dbus-event-path-name event This function returns the object path of the D-Bus object @var{event} is coming from. @@ -2044,6 +2059,16 @@ This function returns the member name of the D-Bus object @var{event} is coming from. It is either a signal name or a method name. @end defun +@defun dbus-event-handler event +This function returns the handler the D-Bus object @var{event} is +applied with. +@end defun + +@defun dbus-event-arguments event +This function returns the arguments the D-Bus object @var{event} is +carrying on. +@end defun + D-Bus errors are not propagated during event handling, because it is usually not desired. D-Bus errors in events can be made visible by setting the variable @code{dbus-debug} to non-@code{nil}. They can @@ -2074,6 +2099,54 @@ D-Bus applications running. They should therefore check carefully, whether a given D-Bus error is related to them. +@node Monitoring Events +@chapter Monitoring events. +@cindex monitoring + +@defun dbus-register-monitor bus &optional handler &key type sender destination path interface member +This function registers @var{handler} for monitor events on the D-Bus +@var{bus}. + +@var{bus} is either a Lisp keyword, @code{:system} or @code{:session}, +or a string denoting the bus address. + +@findex dbus-monitor-handler +@var{handler} is the function to be called when a monitor event +arrives. It is called with the `args' slot of the monitor event, +which are stripped off the type keywords. If @var{handler} is +@code{nil}, the default handler @code{dbus-monitor-handler} is +applied. This default handler behaves similar to the +@command{dbus-monitor} program. + +The other arguments are keyword-value pairs. @code{:type @var{type}} +defines the message type to be monitored. If given, it must be equal +one of the strings @samp{method_call}, @samp{method_return}, +@samp{error} or @samp{signal}. + +@code{:sender @var{sender}} and @code{:destination @var{destination}} +are D-Bus names. They can be unique names, or well-known service +names. + +@code{:path @var{path}} is the D-Bus object to be monitored. +@code{:interface @var{interface}} is the name of an interface, and +@code{:member @var{member}} is either a method name, a signal name, or +an error name. + +The following form shows all D-Bus events on the session bus in buffer +@samp{*D-Bus Monitor*}: + +@lisp +(dbus-register-monitor :session) +@end lisp + +And this form restricts the monitoring on D-Bus errors: + +@lisp +(dbus-register-monitor :session nil :type "error") +@end lisp +@end defun + + @node Index @unnumbered Index diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index da47e5bc7f..b1bea55d98 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -51,6 +51,7 @@ (unless (boundp 'dbus-debug) (defvar dbus-debug nil)) +(require 'cl-lib) (require 'seq) (require 'subr-x) (require 'xml) @@ -245,7 +246,7 @@ caught in `condition-case' by `dbus-error'.") (defvar dbus-return-values-table (make-hash-table :test #'equal) "Hash table for temporarily storing arguments of reply messages. A key in this hash table is a list (:serial BUS SERIAL), like in -`dbus-registered-objects-table'. BUS is either a Lisp symbol, +`dbus-registered-objects-table'. BUS is either a Lisp keyword, `:system' or `:session', or a string denoting the bus address. SERIAL is the serial number of the reply message. @@ -279,8 +280,8 @@ The result will be made available in `dbus-return-values-table'." (defun dbus-call-method (bus service path interface method &rest args) "Call METHOD on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE is the D-Bus service name to be used. PATH is the D-Bus object path SERVICE is registered at. INTERFACE is an interface @@ -301,8 +302,8 @@ converted into D-Bus types via the following rules: string => DBUS_TYPE_STRING list => DBUS_TYPE_ARRAY -All arguments can be preceded by a type symbol. For details about -type symbols, see Info node `(dbus)Type Conversion'. +All arguments can be preceded by a type keyword. For details +about type keywords, see Info node `(dbus)Type Conversion'. `dbus-call-method' returns the resulting values of METHOD as a list of Lisp objects. The type conversion happens the other direction as for @@ -405,8 +406,8 @@ object is returned instead of a list containing this single Lisp object. (bus service path interface method handler &rest args) "Call METHOD on the D-Bus BUS asynchronously. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE is the D-Bus service name to be used. PATH is the D-Bus object path SERVICE is registered at. INTERFACE is an interface @@ -431,8 +432,8 @@ converted into D-Bus types via the following rules: string => DBUS_TYPE_STRING list => DBUS_TYPE_ARRAY -All arguments can be preceded by a type symbol. For details about -type symbols, see Info node `(dbus)Type Conversion'. +All arguments can be preceded by a type keyword. For details +about type keywords, see Info node `(dbus)Type Conversion'. If HANDLER is a Lisp function, the function returns a key into the hash table `dbus-registered-objects-table'. The corresponding entry @@ -472,9 +473,9 @@ Example: (defun dbus-send-signal (bus service path interface signal &rest args) "Send signal SIGNAL on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. The signal is sent from the D-Bus object -Emacs is registered at BUS. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. The signal is sent from the +D-Bus object Emacs is registered at BUS. SERVICE is the D-Bus name SIGNAL is sent to. It can be either a known name or a unique name. If SERVICE is nil, the signal is sent as @@ -492,8 +493,8 @@ converted into D-Bus types via the following rules: string => DBUS_TYPE_STRING list => DBUS_TYPE_ARRAY -All arguments can be preceded by a type symbol. For details about -type symbols, see Info node `(dbus)Type Conversion'. +All arguments can be preceded by a type keyword. For details +about type keywords, see Info node `(dbus)Type Conversion'. Example: @@ -586,8 +587,9 @@ hash table." (defun dbus-setenv (bus variable value) "Set the value of the BUS environment variable named VARIABLE to VALUE. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. Both VARIABLE and VALUE should be strings. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. Both VARIABLE and VALUE should +be strings. Normally, services inherit the environment of the BUS daemon. This function adds to or modifies that environment when activating services. @@ -601,8 +603,8 @@ Some bus instances, such as `:system', may disable setting the environment." (defun dbus-register-service (bus service &rest flags) "Register known name SERVICE on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE is the D-Bus service name that should be registered. It must be a known name. @@ -663,8 +665,9 @@ placed in the queue. (defun dbus-unregister-service (bus service) "Unregister all objects related to SERVICE from D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. SERVICE must be a known service name. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE must be a known service +name. The function returns a keyword, indicating the result of the operation. One of the following keywords is returned: @@ -699,8 +702,8 @@ queue of this service." (bus service path interface signal handler &rest args) "Register for a signal on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE is the D-Bus service name used by the sending D-Bus object. It can be either a known name or the unique name of the D-Bus object @@ -854,8 +857,8 @@ Example: (bus service path interface method handler &optional dont-register-service) "Register METHOD on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE is the D-Bus service name of the D-Bus object METHOD is registered for. It must be a known name (see discussion of @@ -869,7 +872,7 @@ HANDLER is a Lisp function to be called when a method call is received. It must accept the input arguments of METHOD. The return value of HANDLER is used for composing the returning D-Bus message. If HANDLER returns a reply message with an empty -argument list, HANDLER must return the symbol `:ignore' in order +argument list, HANDLER must return the keyword `:ignore' in order to distinguish it from nil (the boolean false). If HANDLER detects an error, it shall return the list `(:error @@ -1039,7 +1042,7 @@ EVENT is a list which starts with symbol `dbus-event': INTERFACE MEMBER HANDLER &rest ARGS) BUS identifies the D-Bus the message is coming from. It is -either a Lisp symbol, `:system', `:session', `:systemp-private' +either a Lisp keyword, `:system', `:session', `:systemp-private' or `:session-private', or a string denoting the bus address. TYPE is the D-Bus message type which has caused the event, SERIAL @@ -1048,7 +1051,7 @@ equal `dbus-message-type-method-return' or `dbus-message-type-error'. SERVICE and PATH are the unique name and the object path of the D-Bus object emitting the message. DESTINATION is the D-Bus name -the message is dedicated to, or nil in case thje message is a +the message is dedicated to, or nil in case the message is a broadcast signal. INTERFACE and MEMBER denote the message which has been sent. @@ -1064,7 +1067,7 @@ formed." (when dbus-debug (message "DBus-Event %s" event)) (unless (and (listp event) (eq (car event) 'dbus-event) - ;; Bus symbol. + ;; Bus keyword. (or (keywordp (nth 1 event)) (stringp (nth 1 event))) ;; Type. @@ -1181,8 +1184,8 @@ If the HANDLER returns a `dbus-error', it is propagated as return message." (defun dbus-event-bus-name (event) "Return the bus name the event is coming from. -The result is either a Lisp symbol, `:system' or `:session', or a -string denoting the bus address. EVENT is a D-Bus event, see +The result is either a Lisp keyword, `:system' or `:session', or +a string denoting the bus address. EVENT is a D-Bus event, see `dbus-check-event'. This function signals a `dbus-error' if the event is not well formed." (dbus-check-event event) @@ -1375,11 +1378,11 @@ It will be registered for all objects created by `dbus-register-service'." "Return all interfaces and sub-nodes of SERVICE, registered at object path PATH at bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. SERVICE must be a known service name, -and PATH must be a valid object path. The last two parameters -are strings. The result, the introspection data, is a string in -XML format." +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE must be a known service +name, and PATH must be a valid object path. The last two +parameters are strings. The result, the introspection data, is a +string in XML format." ;; We don't want to raise errors. (let (dbus-debug) (dbus-ignore-errors @@ -1596,7 +1599,7 @@ valid D-Bus value, or nil if there is no PROPERTY, or PROPERTY cannot be read." (defun dbus-set-property (bus service path interface property &rest args) "Set value of PROPERTY of INTERFACE to VALUE. It will be checked at BUS, SERVICE, PATH. VALUE can be preceded -by a TYPE symbol. When the value is successfully set, and the +by a TYPE keyword. When the value is successfully set, and the property's access type is not `:write', return VALUE. Otherwise, return nil. @@ -1651,8 +1654,8 @@ Filter out matching PATH." (bus service path interface property access &rest args) "Register PROPERTY on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. SERVICE is the D-Bus service name of the D-Bus. It must be a known name (see discussion of DONT-REGISTER-SERVICE below). @@ -1662,11 +1665,11 @@ discussion of DONT-REGISTER-SERVICE below). INTERFACE is the name of the interface used at PATH, PROPERTY is the name of the property of INTERFACE. ACCESS indicates, whether the property can be changed by other services via D-Bus. It must be either -the symbol `:read', `:write' or `:readwrite'. +the keyword `:read', `:write' or `:readwrite'. VALUE is the initial value of the property, it can be of any valid type (see `dbus-call-method' for details). VALUE can be -preceded by a TYPE symbol. +preceded by a TYPE keyword. If PROPERTY already exists on PATH, it will be overwritten. For properties with access type `:read' this is the only way to @@ -1688,7 +1691,7 @@ clients from discovering the still incomplete interface. \(dbus-register-property BUS SERVICE PATH INTERFACE PROPERTY ACCESS \ [TYPE] VALUE &optional EMITS-SIGNAL DONT-REGISTER-SERVICE)" - (let (;; Read basic type symbol. + (let (;; Read basic type keyword. (type (when (keywordp (car args)) (pop args))) (value (pop args)) (emits-signal (pop args)) @@ -1973,68 +1976,53 @@ It will be registered for all objects created by `dbus-register-service'." result) '(:signature "{oa{sa{sv}}}")))))) -(defun dbus-register-monitor - (bus &optional service path interface member handler &rest args) +(cl-defun dbus-register-monitor + (bus &optional handler &key type sender destination path interface member) "Register HANDLER for monitor events on the D-Bus BUS. -BUS is either a Lisp symbol, `:system' or `:session', or a string -denoting the bus address. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. -SERVICE is the D-Bus service name of the D-Bus. It must be a -known name (see discussion of DONT-REGISTER-SERVICE below). +HANDLER is the function to be called when a monitor event +arrives. It is called with the `args' slot of the monitor event, +which are stripped off the type keywords. If HANDLER is nil, the +default handler `dbus-monitor-handler' is applied. -PATH is the D-Bus object path SERVICE is registered at (see -discussion of DONT-REGISTER-SERVICE below). INTERFACE is the -name of the interface used at PATH. MEMBER is either a method -name, a signal name, or an error name. +The other arguments are keyword-value pairs. `:type TYPE' +defines the message type to be monitored. If given, it must be +equal one of the strings \"method_call\", \"method_return\", +\"error\" or \"signal\". -HANDLER is the function to be called when a monitor event -arrives. If nil, the default handler `dbus-monitor-handler' is -applied. It is called with ARGS as arguments." +`:sender SENDER' and `:destination DESTINATION' are D-Bus names. +They can be unique names, or well-known service names. +`:path PATH' is the D-Bus object to be monitored. `:interface +INTERFACE' is the name of an interface, and `:member MEMBER' is +either a method name, a signal name, or an error name." (let ((bus-private (if (eq bus :system) :system-private (if (eq bus :session) :session-private bus))) - keyword type rule1 rule2 key key1 value) + rule key key1 value) (unless handler (setq handler #'dbus-monitor-handler)) - ;; Read arguments. - (while args - (when (keywordp (setq keyword (pop args))) - (cond - ((eq :type keyword) - ;; Must be "signal", "method_call", "method_return", or "error". - (setq type (pop args)))))) - ;; Compose rules. - (setq rule1 - (or - (string-join - (delq nil - (list (when service (format "sender='%s'" service)) - (when path (format "path='%s'" path)) - (when interface (format "interface='%s'" interface)) - (when member (format "member='%s'" member)) - (when type (format "type='%s'" type)))) - ",") - "") - rule2 - (when service - (string-join - (delq nil - (list (format "destination='%s'" service) - (when path (format "path='%s'" path)) - (when interface (format "interface='%s'" interface)) - (when member (format "member='%s'" member)) - (when type (format "type='%s'" type)))) - ","))) + ;; Compose rule. + (setq rule + (string-join + (delq nil (mapcar + (lambda (item) + (when (cdr item) + (format "%s='%s'" (car item) (cdr item)))) + `(("type" . ,type) ("sender" . ,sender) + ("destination" . ,destination) ("path" . ,path) + ("interface" . ,interface) ("member" . ,member)))) + ",") + rule (or rule "")) (unless (ignore-errors (dbus-get-unique-name bus-private)) (dbus-init-bus bus 'private)) (dbus-call-method bus-private dbus-service-dbus dbus-path-dbus dbus-interface-monitoring - "BecomeMonitor" - (append `(:array :string ,rule1) (when rule2 `(:string ,rule2))) - :uint32 0) + "BecomeMonitor" `(:array :string ,rule) :uint32 0) - (when dbus-debug (message "Matching rule \"%s\" created" rule1)) + (when dbus-debug (message "Matching rule \"%s\" created" rule)) ;; Create a hash table entry. (setq key (list :monitor bus-private) @@ -2046,14 +2034,19 @@ applied. It is called with ARGS as arguments." (when dbus-debug (message "%s" dbus-registered-objects-table)) ;; Return the object. - (list key (list service path handler)))) + (list key key1))) (defun dbus-monitor-handler (&rest _args) "Default handler for the \"org.freedesktop.DBus.Monitoring.BecomeMonitor\" interface. -It will be applied all objects created by `dbus-register-monitor'." +It will be applied for all objects created by +`dbus-register-monitor' which don't declare an own handler.." (with-current-buffer (get-buffer-create "*D-Bus Monitor*") (special-mode) + ;; Move forward and backward between messages. + (local-set-key [?n] #'forward-paragraph) + (local-set-key [?p] #'backward-paragraph) (let* ((inhibit-read-only t) + (point (point)) (eobp (eobp)) (event last-input-event) (type (dbus-event-message-type event)) @@ -2079,7 +2072,33 @@ It will be applied all objects created by `dbus-register-monitor'." sender destination serial path interface member)) (dolist (arg arguments) (pp (dbus-flatten-types arg) (current-buffer))) - (insert "\n")) + (insert "\n") + ;; Show byte arrays as string. + (goto-char point) + (while (re-search-forward + "(:array\\( :byte [[:digit:]]+\\)+)" nil 'noerror) + (put-text-property + (match-beginning 0) (match-end 0) + 'help-echo (dbus-byte-array-to-string (read (match-string 0))))) + ;; Show fixed numbers. + (goto-char point) + (while (re-search-forward + (concat + (regexp-opt + '(":int16" ":uint16" ":int32" ":uint32" ":int64" ":uint64")) + " \\([-+[:digit:]]+\\)") + nil 'noerror) + (put-text-property + (match-beginning 1) (match-end 1) + 'help-echo + (format + "#o%o, #x%X" (read (match-string 1)) (read (match-string 1))))) + ;; Show floating numbers. + (goto-char point) + (while (re-search-forward ":double \\([-+.[:digit:]]+\\)" nil 'noerror) + (put-text-property + (match-beginning 1) (match-end 1) + 'help-echo (format "%e" (read (match-string 1)))))) (when eobp (goto-char (point-max)))))) @@ -2115,10 +2134,11 @@ pending at the time of disconnect to fail." (defun dbus-init-bus (bus &optional private) "Establish the connection to D-Bus BUS. -BUS can be either the symbol `:system' or the symbol `:session', or it -can be a string denoting the address of the corresponding bus. For -the system and session buses, this function is called when loading -`dbus.el', there is no need to call it again. +BUS can be either the keyword `:system' or the keyword +`:session', or it can be a string denoting the address of the +corresponding bus. For the system and session buses, this +function is called when loading `dbus.el', there is no need to +call it again. The function returns the number of connections this Emacs session has established to the BUS under the same unique name (see @@ -2128,13 +2148,13 @@ example, if Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware environment like GNOME, another connection might already be established. -When PRIVATE is non-nil, a new connection is established instead of -reusing an existing one. It results in a new unique name at the bus. -This can be used, if it is necessary to distinguish from another -connection used in the same Emacs process, like the one established by -GTK+. It should be used with care for at least the `:system' and -`:session' buses, because other Emacs Lisp packages might already use -this connection to those buses." +When PRIVATE is non-nil, a new connection is established instead +of reusing an existing one. It results in a new unique name at +the bus. This can be used, if it is necessary to distinguish +from another connection used in the same Emacs process, like the +one established by GTK+. If BUS is the keyword `:system' or the +keyword `:session', the new connection is identified by the +keywords `:system-private' or `:session-private', respectively." (or (featurep 'dbusbind) (signal 'dbus-error (list "Emacs not compiled with dbus support"))) (prog1 diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 0f5582bfc9..b853542a1f 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -66,6 +66,7 @@ (ert-deftest dbus-test01-type-conversion () "Check type conversion functions." (skip-unless dbus--test-enabled-session-bus) + (let ((ustr "0123abc_xyz\x01\xff") (mstr "Grüß Göttin")) (should @@ -97,6 +98,7 @@ (ert-deftest dbus-test01-basic-types () "Check basic D-Bus type arguments." (skip-unless dbus--test-enabled-session-bus) + ;; Unknown keyword. (should-error (dbus-check-arguments :session dbus--test-service :keyword) @@ -288,6 +290,8 @@ (ert-deftest dbus-test01-compound-types () "Check basic D-Bus type arguments." + (skip-unless dbus--test-enabled-session-bus) + ;; `:array'. It contains several elements of the same type. (should (dbus-check-arguments :session dbus--test-service '("string"))) (should (dbus-check-arguments :session dbus--test-service '(:array "string"))) @@ -327,6 +331,11 @@ (dbus-check-arguments :session dbus--test-service '(:array (:dict-entry :string "string" :boolean t)))) + ;; This is an alternative syntax. FIXME: Shall this be supported? + (should + (dbus-check-arguments + :session dbus--test-service + '(:array :dict-entry (:string "string" :boolean t)))) ;; The second element is `nil' (implicitly). FIXME: Is this right? (should (dbus-check-arguments commit f2a6bbefa919c0fcde66c0a8fb54aa5fb499de65 Merge: c8f295f503 0b78785a9b Author: Glenn Morris Date: Sun Sep 27 09:37:10 2020 -0700 Merge from origin/emacs-27 0b78785a9b (origin/emacs-27) Minor copyedits in the Emacs user manual 0dfc6fdc1f Followup to a recent change in menu-bar.el 767713682c Enable "Continue Tags Search" menu item only when it can b... 4bb7532163 Fix soap-client URL commit c8f295f50324d7612fe0c5d2dd27fc727f3719b4 Merge: 2e8c9ede15 cc7f971485 Author: Glenn Morris Date: Sun Sep 27 09:37:10 2020 -0700 ; Merge from origin/emacs-27 The following commit was skipped: cc7f971485 Fix out-of-source ‘make check’ emacs-module-tests commit 2e8c9ede155668167e509ddb80c6a46dab8d70fe Merge: a492013d07 f31c6792ab Author: Glenn Morris Date: Sun Sep 27 09:37:10 2020 -0700 Merge from origin/emacs-27 f31c6792ab Fix support for Zip64 zip files ba635a19fb * lisp/hi-lock.el (hi-lock-auto-select-face): Doc fix. (B... cc8fef2bdd Avoid infinite recursion with 'relative' line numbers display 395f10cb98 ; Fix more trivial typos bf4accb65e ; Fix some trivial typos # Conflicts: # etc/NEWS # lisp/arc-mode.el commit a492013d07c59fab8eb9779924b384181e878a1a Author: Pip Cet Date: Sun Sep 27 17:40:07 2020 +0200 Fix more single-byte accesses caused by bytepos/charpos confusion * src/cmds.c (internal_self_insert): Use FETCH_BYTE, not FETCH_CHAR, for a decremented byte position (bug#41520). * src/xdisp.c (Fwindow_text_pixel_size, trailing_whitespace_p): Ditto. diff --git a/src/cmds.c b/src/cmds.c index 90526612b7..c29cf00dad 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -390,7 +390,7 @@ internal_self_insert (int c, EMACS_INT n) by spaces so that the remaining text won't move. */ ptrdiff_t actual = PT_BYTE; actual -= prev_char_len (actual); - if (FETCH_CHAR (actual) == '\t') + if (FETCH_BYTE (actual) == '\t') /* Rather than add spaces, let's just keep the tab. */ chars_to_delete--; else diff --git a/src/xdisp.c b/src/xdisp.c index 3d40878be6..ecd23e0d0f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10619,7 +10619,7 @@ include the height of both, if present, in the return value. */) while (bpos > BEGV_BYTE) { dec_both (&start, &bpos); - c = FETCH_CHAR (bpos); + c = FETCH_BYTE (bpos); if (!(c == ' ' || c == '\t')) break; } @@ -10641,7 +10641,7 @@ include the height of both, if present, in the return value. */) while (bpos > BEGV_BYTE) { dec_both (&end, &bpos); - c = FETCH_CHAR (bpos); + c = FETCH_BYTE (bpos); if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) break; } @@ -22277,7 +22277,7 @@ trailing_whitespace_p (ptrdiff_t charpos) int c = 0; while (bytepos < ZV_BYTE - && (c = FETCH_CHAR (bytepos), + && (c = FETCH_BYTE (bytepos), c == ' ' || c == '\t')) ++bytepos; commit 433b6fc53dc9511077ed3a8c1ad130196dedbb55 Author: Pip Cet Date: Sun Sep 27 16:59:00 2020 +0200 Handle single-argument `apply' consistently (bug#40968) * src/eval.c (Fapply): Handle (apply nil) without crashing. Document single-argument form. * lisp/emacs-lisp/byte-opt.el (byte-optimize-apply): Don't attempt to optimize single-argument apply. * doc/lispref/functions.texi (Calling Functions): Document single-argument apply. Provide example (bug#40968). diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 26b212d05e..e8e22078d9 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -762,6 +762,11 @@ arguments, rather than a single list. We say that @code{apply} @dfn{spreads} this list so that each individual element becomes an argument. +@code{apply} with a single argument is special: the first element of +the argument, which must be a non-empty list, is called as a function +with the remaining elements as individual arguments. Passing two or +more arguments will be faster. + @code{apply} returns the result of calling @var{function}. As with @code{funcall}, @var{function} must either be a Lisp function or a primitive function; special forms and macros do not make sense in @@ -789,6 +794,11 @@ primitive function; special forms and macros do not make sense in (apply 'append '((a b c) nil (x y z) nil)) @result{} (a b c x y z) @end group + +@group +(apply '(+ 3 4)) + @result{} 7 +@end group @end example For an interesting example of using @code{apply}, see @ref{Definition diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 8a6c0b9a7f..65e4e44626 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1044,19 +1044,22 @@ (defun byte-optimize-apply (form) ;; If the last arg is a literal constant, turn this into a funcall. ;; The funcall optimizer can then transform (funcall 'foo ...) -> (foo ...). - (let ((fn (nth 1 form)) - (last (nth (1- (length form)) form))) ; I think this really is fastest - (or (if (or (null last) - (eq (car-safe last) 'quote)) - (if (listp (nth 1 last)) - (let ((butlast (nreverse (cdr (reverse (cdr (cdr form))))))) - (nconc (list 'funcall fn) butlast - (mapcar (lambda (x) (list 'quote x)) (nth 1 last)))) - (byte-compile-warn - "last arg to apply can't be a literal atom: `%s'" - (prin1-to-string last)) - nil)) - form))) + (if (= (length form) 2) + ;; single-argument `apply' is not worth optimizing (bug#40968) + form + (let ((fn (nth 1 form)) + (last (nth (1- (length form)) form))) ; I think this really is fastest + (or (if (or (null last) + (eq (car-safe last) 'quote)) + (if (listp (nth 1 last)) + (let ((butlast (nreverse (cdr (reverse (cdr (cdr form))))))) + (nconc (list 'funcall fn) butlast + (mapcar (lambda (x) (list 'quote x)) (nth 1 last)))) + (byte-compile-warn + "last arg to apply can't be a literal atom: `%s'" + (prin1-to-string last)) + nil)) + form)))) (put 'funcall 'byte-optimizer #'byte-optimize-funcall) (put 'apply 'byte-optimizer #'byte-optimize-apply) diff --git a/src/eval.c b/src/eval.c index 5d3c32326d..c34c11828c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2371,6 +2371,8 @@ eval_sub (Lisp_Object form) DEFUN ("apply", Fapply, Sapply, 1, MANY, 0, doc: /* Call FUNCTION with our remaining args, using our last arg as list of args. Then return the value FUNCTION returns. +With a single argument, call the argument's first element using the +other elements as args. Thus, (apply \\='+ 1 2 \\='(3 4)) returns 10. usage: (apply FUNCTION &rest ARGUMENTS) */) (ptrdiff_t nargs, Lisp_Object *args) @@ -2381,6 +2383,10 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) Lisp_Object fun = args[0]; USE_SAFE_ALLOCA; + if (nargs == 1) + /* Special case: FUN is really a list of (FUNCTION . ARGS). */ + return CALLN (Fapply, CAR (fun), CDR (fun)); + ptrdiff_t numargs = list_length (spread_arg); if (numargs == 0) commit 8d241e8840fdb02dcfce52425626dd8f2125e51a Author: Pip Cet Date: Sun Sep 27 15:07:34 2020 +0200 Avoid 1s sleep-for before sending the startfile to a comint process * lisp/comint.el (comint-exec): Simplify startup file code. (Bug#41640). diff --git a/lisp/comint.el b/lisp/comint.el index b4ea232767..b966fae936 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -820,18 +820,10 @@ series of processes in the same Comint buffer. The hook (goto-char (point-max)) (set-marker (process-mark proc) (point)) ;; Feed it the startfile. - (cond (startfile - ;;This is guaranteed to wait long enough - ;;but has bad results if the comint does not prompt at all - ;; (while (= size (buffer-size)) - ;; (sleep-for 1)) - ;;I hope 1 second is enough! - (sleep-for 1) - (goto-char (point-max)) - (insert-file-contents startfile) - (setq startfile (buffer-substring (point) (point-max))) - (delete-region (point) (point-max)) - (comint-send-string proc startfile))) + (when startfile + (comint-send-string proc (with-temp-buffer + (insert-file-contents startfile) + (buffer-string)))) (run-hooks 'comint-exec-hook) buffer))) commit c2da21c4cc2aec2b2271d6603f7d8e40f3039e62 Author: Eli Zaretskii Date: Sun Sep 27 16:00:39 2020 +0300 ; * doc/emacs/building.texi (Grep Searching): Fix a typo. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 5199724e69..5f7d9b7ab8 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -427,7 +427,7 @@ M-n}}, @key{RET}, and so forth, just like compilation errors. @xref{Compilation Mode}, for detailed description of commands and key bindings available in the @file{*grep*} buffer. -@vindex grep-match-regexp} +@vindex grep-match-regexp Some grep programs accept a @samp{--color} option to output special markers around matches for the purpose of highlighting. You can make use of this feature by setting @code{grep-highlight-matches} to commit cea06818a1e7462090df90d41d5298b975ee9b27 Author: Simon Lang Date: Sun Sep 27 14:55:22 2020 +0200 Add a new grep-match-regexp variable * doc/emacs/building.texi (Grep Searching): Document it. * lisp/progmodes/grep.el (grep-match-regexp): New variable (bug#41766). (grep-filter): Use it. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 7074bd45d7..5199724e69 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -427,11 +427,16 @@ M-n}}, @key{RET}, and so forth, just like compilation errors. @xref{Compilation Mode}, for detailed description of commands and key bindings available in the @file{*grep*} buffer. +@vindex grep-match-regexp} Some grep programs accept a @samp{--color} option to output special markers around matches for the purpose of highlighting. You can make use of this feature by setting @code{grep-highlight-matches} to @code{t}. When displaying a match in the source buffer, the exact match will be highlighted, instead of the entire source line. +Highlighting is provided via matching the @acronym{ANSI} escape +sequences emitted by @command{grep}. The matching of the sequences is +controlled by @code{grep-match-regexp}, which can be customized to +accommodate different @command{grep} programs. As with compilation commands (@pxref{Compilation}), while the grep command runs, the mode line shows the running number of matches found diff --git a/etc/NEWS b/etc/NEWS index 202cd689d3..61618af780 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -518,6 +518,15 @@ take the actual screenshot, and defaults to "ImageMagick import". A server entry retrieved by auth-source can request a desired smtp authentication mechanism by setting a value for the key 'smtp-auth'. +** Grep + ++++ +*** New variable 'grep-match-regexp' matches grep markers to highlight. +grep emits SGR ANSI escape sequences to color its output. The new variable +'grep-match-regexp' holds the regular expression to match the appropriate +markers in order to provide highlighting in the source buffer. The variable +can be customized to accommodate other grep-like tools. + ** Help +++ diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index c71a90344f..279eb4d54b 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -100,6 +100,13 @@ To change the default value, use \\[customize] or call the function :set #'grep-apply-setting :version "22.1") +(defcustom grep-match-regexp "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" + "Regular expression matching grep markers to highlight. +It matches SGR ANSI escape sequences which are emitted by grep to +color its output. This variable is used in `grep-filter'." + :type 'regexp + :version "28.1") + (defcustom grep-scroll-output nil "Non-nil to scroll the *grep* buffer window as output appears. @@ -590,7 +597,7 @@ This function is called from `compilation-filter-hook'." (when (< (point) end) (setq end (copy-marker end)) ;; Highlight grep matches and delete marking sequences. - (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 1) + (while (re-search-forward grep-match-regexp end 1) (replace-match (propertize (match-string 1) 'face nil 'font-lock-face grep-match-face) t t) commit 8bd233a7eb6bc4709d0adf0577d30aaf167e75bf Author: Mattias Engdegård Date: Sun Sep 27 14:28:07 2020 +0200 Minor string-search optimisations (bug#43598) * src/fns.c (Fstring_search): Perform cheap all-ASCII checks before more expensive ones. Use a faster loop when searching for non-ASCII non-raw bytes. * test/src/fns-tests.el (string-search): Add more test cases. diff --git a/src/fns.c b/src/fns.c index 0f76871154..f626fe11b2 100644 --- a/src/fns.c +++ b/src/fns.c @@ -5457,16 +5457,11 @@ It should not be used for anything security-related. See static bool string_ascii_p (Lisp_Object string) { - if (STRING_MULTIBYTE (string)) - return SBYTES (string) == SCHARS (string); - else - { - ptrdiff_t nbytes = SBYTES (string); - for (ptrdiff_t i = 0; i < nbytes; i++) - if (SREF (string, i) > 127) - return false; - return true; - } + ptrdiff_t nbytes = SBYTES (string); + for (ptrdiff_t i = 0; i < nbytes; i++) + if (SREF (string, i) > 127) + return false; + return true; } DEFUN ("string-search", Fstring_search, Sstring_search, 2, 3, 0, @@ -5505,9 +5500,14 @@ Case is always significant and text properties are ignored. */) haystart = SSDATA (haystack) + start_byte; haybytes = SBYTES (haystack) - start_byte; - if (STRING_MULTIBYTE (haystack) == STRING_MULTIBYTE (needle) - || string_ascii_p (needle) - || string_ascii_p (haystack)) + /* We can do a direct byte-string search if both strings have the + same multibyteness, or if at least one of them consists of ASCII + characters only. */ + if (STRING_MULTIBYTE (haystack) + ? (STRING_MULTIBYTE (needle) + || SCHARS (haystack) == SBYTES (haystack) || string_ascii_p (needle)) + : (!STRING_MULTIBYTE (needle) + || SCHARS (needle) == SBYTES (needle) || string_ascii_p (haystack))) res = memmem (haystart, haybytes, SSDATA (needle), SBYTES (needle)); else if (STRING_MULTIBYTE (haystack)) /* unibyte needle */ @@ -5521,26 +5521,21 @@ Case is always significant and text properties are ignored. */) /* The only possible way we can find the multibyte needle in the unibyte stack (since we know that neither are pure-ASCII) is if they contain "raw bytes" (and no other non-ASCII chars.) */ - ptrdiff_t chars = SCHARS (needle); - const unsigned char *src = SDATA (needle); - - for (ptrdiff_t i = 0; i < chars; i++) - { - int c = string_char_advance (&src); - - if (!CHAR_BYTE8_P (c) - && !ASCII_CHAR_P (c)) - /* Found a char that can't be in the haystack. */ - return Qnil; - } + ptrdiff_t nbytes = SBYTES (needle); + for (ptrdiff_t i = 0; i < nbytes; i++) + { + int c = SREF (needle, i); + if (CHAR_BYTE8_HEAD_P (c)) + i++; /* Skip raw byte. */ + else if (!ASCII_CHAR_P (c)) + return Qnil; /* Found a char that can't be in the haystack. */ + } - { - /* "Raw bytes" (aka eighth-bit) are represented differently in - multibyte and unibyte strings. */ - Lisp_Object uni_needle = Fstring_to_unibyte (needle); - res = memmem (haystart, haybytes, - SSDATA (uni_needle), SBYTES (uni_needle)); - } + /* "Raw bytes" (aka eighth-bit) are represented differently in + multibyte and unibyte strings. */ + Lisp_Object uni_needle = Fstring_to_unibyte (needle); + res = memmem (haystart, haybytes, + SSDATA (uni_needle), SBYTES (uni_needle)); } if (! res) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 41969f2af2..d3c22f966e 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -913,6 +913,7 @@ (should (equal (string-search "ab\0" "ab") nil)) (should (equal (string-search "ab" "abababab" 3) 4)) (should (equal (string-search "ab" "ababac" 3) nil)) + (should (equal (string-search "aaa" "aa") nil)) (let ((case-fold-search t)) (should (equal (string-search "ab" "AB") nil))) @@ -936,14 +937,16 @@ (should (equal (string-search (string-to-multibyte "\377") "ab\377c") 2)) (should (equal (string-search "\303" "aøb") nil)) (should (equal (string-search "\270" "aøb") nil)) - ;; This test currently fails, but it shouldn't! - ;;(should (equal (string-search "ø" "\303\270") nil)) + (should (equal (string-search "ø" "\303\270") nil)) + + (should (equal (string-search "a\U00010f98z" "a\U00010f98a\U00010f98z") 2)) (should-error (string-search "a" "abc" -1)) (should-error (string-search "a" "abc" 4)) (should-error (string-search "a" "abc" 100000000000)) (should (equal (string-search "a" "aaa" 3) nil)) + (should (equal (string-search "aa" "aa" 1) nil)) (should (equal (string-search "\0" "") nil)) (should (equal (string-search "" "") 0)) @@ -955,6 +958,21 @@ (should-error (string-search "" "abc" -1)) (should-not (string-search "ø" "foo\303\270")) + (should-not (string-search "\303\270" "ø")) + (should-not (string-search "\370" "ø")) + (should-not (string-search (string-to-multibyte "\370") "ø")) + (should-not (string-search "ø" "\370")) + (should-not (string-search "ø" (string-to-multibyte "\370"))) + (should-not (string-search "\303\270" "\370")) + (should-not (string-search (string-to-multibyte "\303\270") "\370")) + (should-not (string-search "\303\270" (string-to-multibyte "\370"))) + (should-not (string-search (string-to-multibyte "\303\270") + (string-to-multibyte "\370"))) + (should-not (string-search "\370" "\303\270")) + (should-not (string-search (string-to-multibyte "\370") "\303\270")) + (should-not (string-search "\370" (string-to-multibyte "\303\270"))) + (should-not (string-search (string-to-multibyte "\370") + (string-to-multibyte "\303\270"))) (should (equal (string-search (string-to-multibyte "o\303\270") "foo\303\270") 2)) (should (equal (string-search "\303\270" "foo\303\270") 3))) commit 583cb264ad386a3767a05233f0e50b788bcf31ac Author: Mattias Engdegård Date: Sun Sep 27 14:24:36 2020 +0200 Improve accuracy in string-replace description (bug#43598) * doc/lispref/searching.texi (Search and Replace): More careful description; string-replace does not necessarily return a copy. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 451283b4aa..b4fec6d1fd 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -2567,8 +2567,10 @@ of matching @var{regexp} against a substring of @var{string}. @end defun @defun string-replace fromstring tostring instring -This function copies @var{instring} and replaces any occurrences of -@var{fromstring} with @var{tostring}. +This function returns a string equal to @var{instring} where any +occurrences of @var{fromstring} have been replaced with +@var{tostring}. It may return one of its arguments. +Case is significant, and text properties are ignored. @end defun If you want to write a command along the lines of @code{query-replace}, commit 72e9ec96d0e68f57d5b357595e6dfb76114d8506 Author: Mattias Engdegård Date: Sun Sep 27 13:32:27 2020 +0200 ; * test/lisp/subr-tests.el (string-replace): Add more test cases diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 42dcf382e4..035c064d75 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -468,6 +468,19 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." "axb")) (should (equal (string-replace "\377" "x" "a\377ø") "axø")) + (should (equal (string-replace (string-to-multibyte "\377") "x" "a\377b") + "axb")) + (should (equal (string-replace (string-to-multibyte "\377") "x" "a\377ø") + "axø")) + + (should (equal (string-replace "ana" "ANA" "ananas") "ANAnas")) + + (should (equal (string-replace "a" "" "") "")) + (should (equal (string-replace "a" "" "aaaaa") "")) + (should (equal (string-replace "ab" "" "ababab") "")) + (should (equal (string-replace "ab" "" "abcabcabc") "ccc")) + (should (equal (string-replace "a" "aa" "aaa") "aaaaaa")) + (should (equal (string-replace "abc" "defg" "abc") "defg")) (should-error (string-replace "" "x" "abc"))) commit 0b78785a9b5ff475ea65c67b686a1ac19e5d858a (refs/remotes/origin/emacs-27) Author: Eli Zaretskii Date: Sun Sep 27 09:09:27 2020 +0300 Minor copyedits in the Emacs user manual * doc/emacs/emacs.texi (Top): Remove "real-time" from the Emacs description; add "advanced", to be consistent with what we say in the Introduction section. (Bug#43633) diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 6b82aeb823..a28b16aa39 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -108,10 +108,9 @@ Cover art by Etienne Suvasa; cover design by Matt Lee. @node Top @top The Emacs Editor -Emacs is the extensible, customizable, self-documenting real-time -display editor. This manual describes how to edit with Emacs and -some of the ways to customize it; it corresponds to GNU Emacs version -@value{EMACSVER}. +Emacs is the advanced, extensible, customizable, self-documenting +editor. This manual describes how to edit with Emacs and some of the +ways to customize it; it corresponds to GNU Emacs version @value{EMACSVER}. @c See 'manual-html-mono' and 'manual-html-node' in admin/admin.el. @ifset WWW_GNU_ORG commit 0dfc6fdc1f15cf234c3efc4152275ed1c8441df5 Author: Eli Zaretskii Date: Sat Sep 26 18:35:00 2020 +0300 Followup to a recent change in menu-bar.el * lisp/fileloop.el (fileloop--operate-function): Mention in a comment that menu-bar.el relies on the default value. diff --git a/lisp/fileloop.el b/lisp/fileloop.el index 833bb0401c..668b9d4cd1 100644 --- a/lisp/fileloop.el +++ b/lisp/fileloop.el @@ -55,6 +55,9 @@ (defvar fileloop--iterator iter-empty) (defvar fileloop--scan-function (lambda () (user-error "No operation in progress"))) +;; If the default value below is changed, the :enable form of +;; tags-continue and tags-repl-continue in menu-bar.el will have to be +;; updated accordingly. (defvar fileloop--operate-function #'ignore) (defvar fileloop--freshly-initialized nil) commit 767713682c21b2e96abdce11741c065899656f75 Author: Eli Zaretskii Date: Sat Sep 26 11:50:15 2020 +0300 Enable "Continue Tags Search" menu item only when it can be used * lisp/menu-bar.el (menu-bar-search-menu) : Enable only when there was a previous tags search. (Bug#43569) (menu-bar-replace-menu) : Enable only when there was a previous tags-replace. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 37e046ffdd..ef64c74acd 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -333,6 +333,8 @@ (bindings--define-key menu [tags-continue] '(menu-item "Continue Tags Search" fileloop-continue + :enable (and (featurep 'fileloop) + (not (eq fileloop--operate-function 'ignore))) :help "Continue last tags search operation")) (bindings--define-key menu [tags-srch] '(menu-item "Search Tagged Files..." tags-search @@ -382,6 +384,8 @@ (let ((menu (make-sparse-keymap "Replace"))) (bindings--define-key menu [tags-repl-continue] '(menu-item "Continue Replace" fileloop-continue + :enable (and (featurep 'fileloop) + (not (eq fileloop--operate-function 'ignore))) :help "Continue last tags replace operation")) (bindings--define-key menu [tags-repl] '(menu-item "Replace in Tagged Files..." tags-query-replace commit 4bb7532163ffb84a75d59997a43e48bf10d8a33a Author: Paul Eggert Date: Sat Sep 26 00:31:17 2020 -0700 Fix soap-client URL * lisp/net/soap-client.el (soap-create-envelope): Fix URL that I broke in 2019-09-23T06:53:30Z!eggert@cs.ucla.edu. Problem reported by Thomas Fitzsimmons. diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 7425e8763f..e3c38052a5 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -3027,7 +3027,7 @@ SERVICE-URL should be provided when WS-Addressing is being used." (insert "\n Date: Thu Jul 9 16:35:48 2020 -0700 Fix out-of-source ‘make check’ emacs-module-tests Problem reported by Koki Fukuda in: https://lists.gnu.org/r/emacs-devel/2020-07/msg00169.html * test/Makefile.in (MODULE_CFLAGS): Include from the same directories included from in ../src. * test/src/emacs-module-tests.el (module/describe-function-1): Strip path to source directory. (cherry picked from commit c86f3fe0d023cdd25edbbce91c5b32654f2b734e) diff --git a/test/Makefile.in b/test/Makefile.in index f03c194a7c..0003e763ab 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -258,9 +258,7 @@ endif GMP_LIB = @GMP_LIB@ GMP_OBJ = $(if @GMP_OBJ@, ../src/@GMP_OBJ@) -# Note: emacs-module.h is generated from emacs-module.h.in, hence we -# look in ../src, not $(srcdir)/../src. -MODULE_CFLAGS = -I../src -I$(srcdir)/../lib \ +MODULE_CFLAGS = -I../src -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib \ $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 91206156f8..9df0b25a0c 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -318,6 +318,9 @@ local reference." (with-temp-buffer (let ((standard-output (current-buffer))) (describe-function-1 #'mod-test-sum) + (goto-char (point-min)) + (while (re-search-forward "`[^']*/data/emacs-module/" nil t) + (replace-match "`data/emacs-module/")) (should (equal (buffer-substring-no-properties 1 (point-max)) (format "a module function in `data/emacs-module/mod-test%s'. commit f31c6792ab98c8be343838f59d96e35c05353521 Author: Eli Zaretskii Date: Fri Sep 25 17:11:11 2020 +0300 Fix support for Zip64 zip files * lisp/arc-mode.el (archive-zip-summarize): Fix detection of Zip64 central directory. Support 64-bit file size field used by Zip64. (Bug#43597) diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index d6e85bf383..c09f78e0d2 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1799,10 +1799,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." files visual emacs-int-has-32bits) - (when (= p -1) - ;; If the offset of end-of-central-directory is -1, this is a - ;; Zip64 extended ZIP file format, and we need to glean the info - ;; from Zip64 records instead. + (when (or (= p #xffffffff) (= p -1)) + ;; If the offset of end-of-central-directory is 0xFFFFFFFF, this + ;; is a Zip64 extended ZIP file format, and we need to glean the + ;; info from Zip64 records instead. ;; ;; First, find the Zip64 end-of-central-directory locator. (search-backward "PK\006\007") @@ -1828,6 +1828,15 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." (efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen)))) (decode-coding-string str archive-file-name-coding-system))) + (ucsize (if (and (or (= ucsize #xffffffff) (= ucsize -1)) + (> exlen 0)) + ;; APPNOTE.TXT, para 4.5.3: the Extra Field + ;; begins with 2 bytes of signature + ;; (\000\001), followed by 2 bytes that give + ;; the size of the extra block, followed by + ;; an 8-byte uncompressed size. + (archive-l-e (+ p 46 fnlen 4) 8) + ucsize)) (isdir (and (= ucsize 0) (string= (file-name-nondirectory efnname) ""))) (mode (cond ((memq creator '(2 3)) ; Unix commit ba635a19fb0143a2f9d486125f0b6f54034fdadb Author: Eli Zaretskii Date: Fri Sep 25 12:41:54 2020 +0300 * lisp/hi-lock.el (hi-lock-auto-select-face): Doc fix. (Bug#43600) diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 0f685464cd..b15731943f 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -136,9 +136,9 @@ patterns." (put 'hi-lock-file-patterns-policy 'risky-local-variable t) (defcustom hi-lock-auto-select-face nil - "Non-nil means highlighting commands do not prompt for the face to use. -Instead, each hi-lock command will cycle through the faces in -`hi-lock-face-defaults'." + "When nil, highlighting commands prompt for the face to use. +When non-nil, highlighting command determine the faces to use +by cycling through the faces in `hi-lock-face-defaults'." :type 'boolean :version "24.4") commit cc8fef2bddfcf4e1c3bab35a18621dd7666d022e Author: Eli Zaretskii Date: Fri Sep 25 11:55:51 2020 +0300 Avoid infinite recursion with 'relative' line numbers display * src/xdisp.c (display_count_lines_visually): Bind 'display-line-numbers' to 'relative' around 'start_display' as well, since that can invoke 'move_it_to' internally, thus causing infinite recursion. (Bug#43589) diff --git a/src/xdisp.c b/src/xdisp.c index d191ef5170..2af6144975 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22682,10 +22682,11 @@ display_count_lines_visually (struct it *it) SET_TEXT_POS (from, PT, PT_BYTE); to = IT_CHARPOS (*it); } - start_display (&tem_it, it->w, from); /* Need to disable visual mode temporarily, since otherwise the - call to move_it_to will cause infinite recursion. */ + call to move_it_to below and inside start_display will cause + infinite recursion. */ specbind (Qdisplay_line_numbers, Qrelative); + start_display (&tem_it, it->w, from); /* Some redisplay optimizations could invoke us very far from PT, which will make the caller painfully slow. There should be no need to go too far beyond the window's bottom, as any commit 395f10cb98af122404bcdc2eb60d30decf297625 Author: Stefan Kangas Date: Mon Sep 21 15:12:16 2020 +0200 ; Fix more trivial typos diff --git a/etc/NEWS b/etc/NEWS index 57fdada357..33e7ebec83 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1130,7 +1130,7 @@ prefer to rely upon existing Emacs facilities for formatting code but the 'sql-indent' package provides facilities to aid more casual SQL developers layout queries and complex expressions. -**** 'sql-use-indent-support' (default t) enables SQL indention support. +**** 'sql-use-indent-support' (default t) enables SQL indentation support. The 'sql-indent' package from ELPA must be installed to get the indentation support in 'sql-mode' and 'sql-interactive-mode'. diff --git a/etc/NEWS.1-17 b/etc/NEWS.1-17 index 8ca61a0a3b..c4ff83bb70 100644 --- a/etc/NEWS.1-17 +++ b/etc/NEWS.1-17 @@ -1944,7 +1944,7 @@ It's Beat CCA Week. described by dot and mark, at its corners; the existing text is pushed to the right. clear-rectangle: - replace the rectangle described by dot ane mark + replace the rectangle described by dot and mark with blanks. The previous text is deleted. delete-rectangle: delete the text of the specified rectangle, diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 70eb22b994..7d0650a405 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -1875,7 +1875,7 @@ yylex (void) /* Actually local to matching_regexp. These variables must be in - global scope for the case that `static' get's defined away. */ + global scope for the case that `static' gets defined away. */ static char *matching_regexp_buffer, *matching_regexp_end_buf; diff --git a/make-dist b/make-dist index 6901a4cfa1..de4f343ddd 100755 --- a/make-dist +++ b/make-dist @@ -110,7 +110,7 @@ while [ $# -gt 0 ]; do ;; ## Include the test/ directory. - ## This is for backward compability to when --no-tests was the default. + ## This is for backward compatibility to when --no-tests was the default. "--tests") with_tests=yes ;; commit bf4accb65e71997c082a23cf492563243b1f4c34 Author: Stefan Kangas Date: Mon Sep 21 15:03:57 2020 +0200 ; Fix some trivial typos diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1 index 3513c6616f..cf641beec1 100644 --- a/doc/emacs/ChangeLog.1 +++ b/doc/emacs/ChangeLog.1 @@ -2206,7 +2206,7 @@ Describe group levels more clearly. (Gnus Group Buffer, Gnus Summary Buffer): New nodes, split from Summary of Gnus. - (Document View): Copyedits. Move zoom commads to DocView + (Document View): Copyedits. Move zoom commands to DocView Navigation node. (DocView Navigation, DocView Searching, DocView Slicing) (DocView Conversion): Nodes renamed from Navigation, etc. @@ -10290,7 +10290,7 @@ * buffers.texi (Misc Buffer): Explain use of M-x rename-uniquely for multiple compile and grep buffers. - (Indirect Buffers): Don't recommand clone-indirect-buffer + (Indirect Buffers): Don't recommend clone-indirect-buffer for multiple compile and grep buffers. 2004-02-29 Juanma Barranquero diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 00c8ee4f98..6e2e045ddd 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2674,7 +2674,7 @@ basename.) Emacs can also look in an XDG-compatible location for @file{init.el}, the default is the directory @file{~/.config/emacs}. This can be -overriden by setting @env{XDG_CONFIG_HOME} in your environment, its +overridden by setting @env{XDG_CONFIG_HOME} in your environment, its value replaces @file{~/.config} in the name of the default XDG init file. However @file{~/.emacs.d}, @file{~/.emacs}, and @file{~/.emacs.el} are always preferred if they exist, which means diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index ebcdddfcae..e8b5608c62 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1458,7 +1458,7 @@ working tree to match the branch you switch to. Bazaar also supports co-located branches, in which case the @kbd{bzr switch} command will switch branches in the current directory. With Subversion, you switch to another branch using the @kbd{svn switch} command. With -Mercurial, command @kbd{hg update} is used to swith to another +Mercurial, command @kbd{hg update} is used to switch to another branch. The VC command to switch to another branch in the current directory diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 6f0e8c1ad2..be2de000c3 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -8256,7 +8256,7 @@ different. Emacs provides a primitive that applications can use to detect instances of text whose bidirectional properties were overridden so as to make a left-to-right character display as if it were a -right-to-left character, or vise versa. +right-to-left character, or vice versa. @defun bidi-find-overridden-directionality from to &optional object This function looks at the text of the specified @var{object} between diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 325841d8f8..e5b535bdab 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -1972,7 +1972,7 @@ ways. @cindex nonlocal exits, in modules Emacs Lisp supports nonlocal exits, whereby program control is -transfered from one point in a program to another remote point. +transferred from one point in a program to another remote point. @xref{Nonlocal Exits}. Thus, Lisp functions called by your module might exit nonlocally by calling @code{signal} or @code{throw}, and your module functions must handle such nonlocal exits properly. Such diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 4edda793e0..de40fa7f96 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3277,7 +3277,7 @@ is disabled, @code{font-lock-face} has no effect on the display. also use the normal Font Lock machinery. But if the mode does not use the normal Font Lock machinery, it should not set the variable @code{font-lock-defaults}. In this case the @code{face} property will -not be overriden, so using the @code{face} property could work too. +not be overridden, so using the @code{face} property could work too. However, using @code{font-lock-face} is generally preferable as it allows the user to control the fontification by toggling @code{font-lock-mode}, and lets the code work regardless of whether diff --git a/doc/misc/ChangeLog.1 b/doc/misc/ChangeLog.1 index a85971bdaf..f74e51f400 100644 --- a/doc/misc/ChangeLog.1 +++ b/doc/misc/ChangeLog.1 @@ -502,7 +502,7 @@ * org.texi (@LaTeX{} specific attributes): Update manual. * org.texi (Top, Exporting): Org has its own documentation and - should therefore be removed from "Other build-in back-ends". + should therefore be removed from "Other built-in back-ends". 2014-04-22 Stefan Monnier @@ -1161,7 +1161,7 @@ (Special agenda views): Mention the "agenda*" agenda view. * org.texi (Repeated tasks): Document how to ignore a repeater - when using both a scheduled and a deadline timetamp. + when using both a scheduled and a deadline timestamp. * org.texi (Global and local cycling): Wrap in a new subsection. (Initial visibility, Catching invisible edits): New subsections. @@ -3515,7 +3515,7 @@ 2012-01-03 Rafael Laboissiere (tiny change) * org.texi (External links): Add footnote on how the behavior - of the text search in Org files are controled by the variable + of the text search in Org files are controlled by the variable `org-link-search-must-match-exact-headline'. 2012-01-03 Eric Schulte @@ -6262,7 +6262,7 @@ information - it's hard to keep up-to-date, and adds nothing. Similarly with direct links to mailing lists. (Spell-checkers): Rename node from Ispell. Mention Aspell and Hunspell. - (Mailcrypt): Remove section - mailcrypt has not been updated in mnay + (Mailcrypt): Remove section - mailcrypt has not been updated in many years, and Emacs comes with tools for this now. (Patch): Remove section - this is a standard tool. (Using function keys under X): Remove section. @@ -6493,7 +6493,7 @@ specified in a property. (Text areas in HTML export): New section. (External links): Add examples for text search and ID links. - (Built-in table editor): Remove the descriptio of `C-c + (Built-in table editor): Remove the description of `C-c C-q', it not longer works. (Literal examples): Document that a space must follow the colon in short examples. diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi index 412176986c..63e3595a50 100644 --- a/doc/misc/ede.texi +++ b/doc/misc/ede.texi @@ -2436,7 +2436,7 @@ Argument @var{THIS} is the project to convert @var{PATH} to. @end deffn @deffn Method ede-name :AFTER this -Return the name of @var{THIS} targt. +Return the name of @var{THIS} target. @end deffn @deffn Method ede-target-buffer-in-sourcelist :AFTER this buffer source diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 19dcb19de7..c7bf99c641 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -465,7 +465,7 @@ string containing the text contained between those positions (if any), after the change was performed. @item @code{:changes-start} and @code{:changes-end} -The value is, repectively, the minimum and maximum buffer positions +The value is, respectively, the minimum and maximum buffer positions touched by the recent changes. These are provided for convenience and only if @code{:recent-changes} is also provided. diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 6d9d7113f7..254fab92c8 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3101,10 +3101,10 @@ % Allow a ragged right output to aid breaking long URL's. There can % be a break at the \allowbreak with no extra glue (if the existing stretch in -% the line is sufficent), a break at the \penalty100 with extra glue added +% the line is sufficient), a break at the \penalty100 with extra glue added % at the end of the line, or no break at all here. % Changing the value of the penalty and/or the amount of stretch affects how -% preferrable one choice is over the other. +% preferable one choice is over the other. \def\urefallowbreak{% \allowbreak \hskip 0pt plus 4 em\relax diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 97a26421f2..fd3415d1ca 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -3004,7 +3004,7 @@ to user @code{root} on host @code{remotehost}, starting with an @option{ssh} session on host @code{remotehost}: @samp{@value{prefix}ssh@value{postfixhop}%h|su@value{postfixhop}remotehost@value{postfix}}. -On the other hand, if a trailing hop does not specifiy a host name, +On the other hand, if a trailing hop does not specify a host name, the host name of the previous hop is reused. Therefore, the following file name is equivalent to the previous example: @samp{@value{prefix}ssh@value{postfixhop}remotehost|su@value{postfixhop}@value{postfix}}.