commit 6a4dee9b99a720a38725529b10c82f32b2c8528a (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Tue Nov 25 00:27:02 2014 -0800 * gnus-start.el (gnus-save-newsrc-file-check-timestamp): Add :version tag. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a3ce96c..f53bf02 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2014-11-25 Glenn Morris + + * gnus-start.el (gnus-save-newsrc-file-check-timestamp): + Add :version tag. + 2014-11-23 Lars Magne Ingebrigtsen * pop3.el (pop3-open-server): Warn unless encrypted. diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 70d0a28..24c2b48 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -447,6 +447,7 @@ See also `gnus-before-startup-hook'." When the newsrc.eld file is updated by multiple machines, checking the file's modification time is a good way to avoid overwriting updated data." + :version "25.1" :group 'gnus-newsrc :type 'boolean) commit a3e1f8ef251f7d25cccbd3198c1b7c2e7260b561 Author: Glenn Morris Date: Tue Nov 25 00:18:45 2014 -0800 * etc/MACHINES: State supported OS X versions. diff --git a/etc/MACHINES b/etc/MACHINES index a51b4c9..cb015d8 100644 --- a/etc/MACHINES +++ b/etc/MACHINES @@ -1,7 +1,7 @@ Emacs machines list -Copyright (C) 1989-1990, 1992-1993, 1998, 2001-2014 Free Software -Foundation, Inc. +Copyright (C) 1989-1990, 1992-1993, 1998, 2001-2014 + Free Software Foundation, Inc. See the end of the file for license conditions. This is a list of the status of GNU Emacs on various machines and systems. @@ -66,6 +66,7 @@ the list at the end of this file. ** Mac OS X + Version 10.6 or newer. PowerPC is not supported. For installation instructions see the file nextstep/INSTALL. ** Microsoft Windows commit 70d7aa8a289375a119f5d4e785c8a5882f0a2e99 Author: Oscar Fuentes Date: Tue Nov 25 03:29:43 2014 +0100 configure.ac [mingw]: Set $canonical default value ... as per the compiler's target. The value provided by MSYS2 `uname' is not correct when MSYS2 runs on one architecture (x86_64) and the user is building for another (i686). * configure.ac [mingw]: Set $canonical default value as per the compiler's target. diff --git a/ChangeLog b/ChangeLog index 5fe2a91..808f3a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-11-25 Oscar Fuentes + + * configure.ac [MINGW]: Set $canonical default value as per the + compiler's target. + 2014-11-24 Glenn Morris * configure.ac [HAVE_W32]: Generate nt/*.rc files when HAVE_W32, diff --git a/configure.ac b/configure.ac index 0f1508f..6b6b1c7 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,34 @@ case $canonical in *-mingw*) . $srcdir/nt/mingw-cfg.site + # When we build with MinGW under MSYS, we are cross-compiling. Hence + # we can't rely on the output of MSYS `uname' for the architecture + # (32 bit MinGW compiler with 64 bit MSYS2, for instance) and must + # use the compiler's target, unless when the user explicitly + # provides one: + if test -z $target_alias; then + AC_MSG_CHECKING([the compiler's target]) + if test -z $CC; then + cc=gcc + else + cc=$CC + fi + t=`$cc -v 2>&1 | sed -n 's/Target: //p'` + case "$t" in + *-*) canonical=$t + ;; + "") AC_MSG_ERROR([Impossible to obtain $cc compiler target. +Please explicitly provide --target]) + ;; + *) AC_MSG_WARN([Compiler reported non-standard target. +Defaulting to $canonical.]) + ;; + esac + AC_MSG_RESULT([$canonical]) + else + canonical=$target_alias + fi + case $srcdir in /* | ?:*) # srcdir is an absolute path. In this case, force the format commit 27f46ae31cd289dbff4c521fcf37a1d048693f6e Author: Sam Steingold Date: Mon Nov 24 15:54:07 2014 -0500 Remove a spurious comma * lisp/vc/vc-hooks.el (vc-directory-exclusion-list): Fix a trivial typo (bug#19171). diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 35141b6..12f81b7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Sam Steingold + + * vc/vc-hooks.el (vc-directory-exclusion-list): + Fix a trivial typo (bug#19171). + 2014-11-24 Stefan Monnier * vc/vc-hooks.el (vc-state-base-face): Don't override diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 9a277db..3a2ad40 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -124,7 +124,7 @@ An empty list disables VC altogether." ;; Note: we don't actually have a darcs back end yet. ;; Also, Meta-CVS (corresponding to MCVS) is unsupported. (defcustom vc-directory-exclusion-list (purecopy '("SCCS" "RCS" "CVS" "MCVS" - ".src", ".svn" ".git" ".hg" ".bzr" + ".src" ".svn" ".git" ".hg" ".bzr" "_MTN" "_darcs" "{arch}")) "List of directory names to be ignored when walking directory trees." :type '(repeat string) commit 8df5745cf5234391fdb4452e23a1aa75fb010b12 Author: Glenn Morris Date: Mon Nov 24 13:40:02 2014 -0500 * configure.ac: Relocate some recent changes to a more logical location. diff --git a/configure.ac b/configure.ac index 1c7ec54..0f1508f 100644 --- a/configure.ac +++ b/configure.ac @@ -1885,6 +1885,13 @@ if test "${HAVE_W32}" = "yes"; then x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;; *) EMACS_MANIFEST="emacs-x86.manifest" ;; esac + dnl Construct something of the form "24,4,0,0" with 4 components. + comma_version=`echo "$version.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'` + + comma_space_version=`echo "$comma_version" | sed 's/,/, /g'` + AC_SUBST(comma_version) + AC_SUBST(comma_space_version) + AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc]) if test "${opsys}" = "cygwin"; then W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool" @@ -4682,18 +4689,6 @@ case $opsys in ;; esac -if test "${HAVE_W32}" = "yes"; then - dnl Construct something of the form "24,4,0,0" with 4 components. - comma_version=`echo "$version.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'` - - comma_space_version=`echo "$comma_version" | sed 's/,/, /g'` - - AC_SUBST(comma_version) - AC_SUBST(comma_space_version) - AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc]) -fi - - XMENU_OBJ= XOBJ= FONT_OBJ= commit a6248f13906a2846bdae7eefe3b97e605944bdec Author: Eli Zaretskii Date: Mon Nov 24 20:07:51 2014 +0200 doc/emacs/misc.texi (Network Security): Improve wording and indexing. diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 198de4f..3db0e85 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Eli Zaretskii + + * misc.texi (Network Security): Improve wording and indexing of + last change. + 2014-11-24 Lars Magne Ingebrigtsen * misc.texi (Gnus Summary Buffer): Move the Network Security diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 2295414..f2828c5 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -252,27 +252,30 @@ Exit the summary buffer and return to the group buffer. @node Network Security @section Network Security -@cindex Network Security Manager +@cindex network security manager +@cindex NSM @cindex encryption @cindex SSL @cindex TLS @cindex STARTTLS -After establishing a network connection, the connection is then passed -on to the Network Security Manager (@acronym{NSM}). +Whenever Emacs establishes any network connection, it passes the +established connection to the @dfn{Network Security Manager} +(@acronym{NSM}). @acronym{NSM} is responsible for enforcing the +network security under your control. @vindex network-security-level The @code{network-security-level} variable determines the security -level. If this is @code{low}, no security checks are performed. +level that @acronym{NSM} enforces. If its value is @code{low}, no +security checks are performed. If this variable is @code{medium} (which is the default), a number of -checks will be performed. If the @acronym{NSM} determines that the -network connection might be unsafe, the user is made aware of this, -and the @acronym{NSM} will ask the user what to do about the network -connection. +checks will be performed. If as result @acronym{NSM} determines that +the network connection might be unsafe, it will make you aware of +that, and will ask you what to do about the network connection. -The user is given the choice of registering a permanent security -exception, a temporary one, or whether to refuse the connection +You can decide to register a permanent security exception for an +unsafe connection, a temporary exception, or refuse the connection entirely. Below is a list of the checks done on the @code{medium} level. @@ -281,24 +284,23 @@ Below is a list of the checks done on the @code{medium} level. @item unable to verify a @acronym{TLS} certificate If the connection is a @acronym{TLS}, @acronym{SSL} or -@acronym{STARTTLS} connection, the @acronym{NSM} will check whether +@acronym{STARTTLS} connection, @acronym{NSM} will check whether the certificate used to establish the identity of the server we're connecting to can be verified. -While an invalid certificate is often the cause for concern (there may -be a Man-in-the-Middle hijacking your network connection and stealing -your password), there may be valid reasons for going ahead with the -connection anyway. - -For instance, the server may be using a self-signed certificate, or -the certificate may have expired. It's up to the user to determine -whether it's acceptable to continue the connection. +While an invalid certificate is often the cause for concern (there +could be a Man-in-the-Middle hijacking your network connection and +stealing your password), there may be valid reasons for going ahead +with the connection anyway. For instance, the server may be using a +self-signed certificate, or the certificate may have expired. It's up +to you to determine whether it's acceptable to continue with the +connection. @item a self-signed certificate has changed If you've previously accepted a self-signed certificate, but it has -now changed, that either means that the server has just changed the -certificate, or this might mean that the network connection has been -hijacked. +now changed, that could mean that the server has just changed the +certificate, but it might also mean that the network connection has +been hijacked. @item previously encrypted connection now unencrypted If the connection is unencrypted, but it was encrypted in previous @@ -311,44 +313,44 @@ When connecting to an @acronym{IMAP} or @acronym{POP3} server, these should usually be encrypted, because it's common to send passwords over these connections. Similarly, if you're sending email via @acronym{SMTP} that requires a password, you usually want that -connection to be encrypted. If the connection isn't encrypted, the +connection to be encrypted. If the connection isn't encrypted, @acronym{NSM} will warn you. @end table If @code{network-security-level} is @code{high}, the following checks -will be made: +will be made, in addition to the above: @table @asis @item a validated certificate changes the public key Servers change their keys occasionally, and that is normally nothing to be concerned about. However, if you are worried that your network connections are being hijacked by agencies who have access to pliable -Certificate Authorities that issue new certificates for third-party +Certificate Authorities which issue new certificates for third-party services, you may want to keep track of these changes. @end table Finally, if @code{network-security-level} is @code{paranoid}, you will -also be notified the first time the @acronym{NSM} sees any new +also be notified the first time @acronym{NSM} sees any new certificate. This will allow you to inspect all the certificates from all the connections that Emacs makes. -The following additional variables can be used to control -@acronym{NSM} details. +The following additional variables can be used to control details of +@acronym{NSM} operation: @table @code @item nsm-settings-file @vindex nsm-settings-file -The @acronym{NSM} stores details on the connections in this file. It -defaults to @file{~/.emacs.d/network-security.data}. +This is the file where @acronym{NSM} stores details about connections. +It defaults to @file{~/.emacs.d/network-security.data}. @item nsm-save-host-names @vindex nsm-save-host-names -By default, host names will not be saved per non-@code{STARTTLS} -connection. Instead a host/port hash is used to identify connections. +By default, host names will not be saved for non-@code{STARTTLS} +connections. Instead a host/port hash is used to identify connections. This means that one can't casually read the settings file to see what -servers the user has connected to. If this variable is @code{t}, host -names will be saved in the file, too. +servers the user has connected to. If this variable is @code{t}, +@acronym{NSM} will also save host names in the nsm-settings-file. @end table commit e22f5c07d8bf514283221f337afb1ef7ca1cd2b8 Author: Lars Magne Ingebrigtsen Date: Mon Nov 24 18:29:47 2014 +0100 Moved the Network Security Manager to the Emacs manual * misc.texi (Gnus Summary Buffer): Moved the Network Security Manager stuff here from the lispref manual. diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index aa9804f..198de4f 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Lars Magne Ingebrigtsen + + * misc.texi (Gnus Summary Buffer): Move the Network Security + Manager stuff here from the lispref manual. + 2014-11-21 Eli Zaretskii * maintaining.texi (Version Control Systems): Move "@end itemize" diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 702aa64..66b1014 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -189,6 +189,7 @@ Advanced Features * Sending Mail:: Sending mail in Emacs. * Rmail:: Reading mail in Emacs. * Gnus:: A flexible mail and news reader. +* Network Security:: Managing the network security. * Document View:: Viewing PDF, PS and DVI files. * EWW:: A web browser in Emacs. * Shell:: Executing shell commands from Emacs. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index af5ced7..2295414 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -249,6 +249,109 @@ Search forward for articles containing a match for @var{regexp}. Exit the summary buffer and return to the group buffer. @end table + +@node Network Security +@section Network Security +@cindex Network Security Manager +@cindex encryption +@cindex SSL +@cindex TLS +@cindex STARTTLS + +After establishing a network connection, the connection is then passed +on to the Network Security Manager (@acronym{NSM}). + +@vindex network-security-level +The @code{network-security-level} variable determines the security +level. If this is @code{low}, no security checks are performed. + +If this variable is @code{medium} (which is the default), a number of +checks will be performed. If the @acronym{NSM} determines that the +network connection might be unsafe, the user is made aware of this, +and the @acronym{NSM} will ask the user what to do about the network +connection. + +The user is given the choice of registering a permanent security +exception, a temporary one, or whether to refuse the connection +entirely. + +Below is a list of the checks done on the @code{medium} level. + +@table @asis + +@item unable to verify a @acronym{TLS} certificate +If the connection is a @acronym{TLS}, @acronym{SSL} or +@acronym{STARTTLS} connection, the @acronym{NSM} will check whether +the certificate used to establish the identity of the server we're +connecting to can be verified. + +While an invalid certificate is often the cause for concern (there may +be a Man-in-the-Middle hijacking your network connection and stealing +your password), there may be valid reasons for going ahead with the +connection anyway. + +For instance, the server may be using a self-signed certificate, or +the certificate may have expired. It's up to the user to determine +whether it's acceptable to continue the connection. + +@item a self-signed certificate has changed +If you've previously accepted a self-signed certificate, but it has +now changed, that either means that the server has just changed the +certificate, or this might mean that the network connection has been +hijacked. + +@item previously encrypted connection now unencrypted +If the connection is unencrypted, but it was encrypted in previous +sessions, this might mean that there is a proxy between you and the +server that strips away @acronym{STARTTLS} announcements, leaving the +connection unencrypted. This is usually very suspicious. + +@item talking to an unencrypted service when sending a password +When connecting to an @acronym{IMAP} or @acronym{POP3} server, these +should usually be encrypted, because it's common to send passwords +over these connections. Similarly, if you're sending email via +@acronym{SMTP} that requires a password, you usually want that +connection to be encrypted. If the connection isn't encrypted, the +@acronym{NSM} will warn you. + +@end table + +If @code{network-security-level} is @code{high}, the following checks +will be made: + +@table @asis +@item a validated certificate changes the public key +Servers change their keys occasionally, and that is normally nothing +to be concerned about. However, if you are worried that your network +connections are being hijacked by agencies who have access to pliable +Certificate Authorities that issue new certificates for third-party +services, you may want to keep track of these changes. +@end table + +Finally, if @code{network-security-level} is @code{paranoid}, you will +also be notified the first time the @acronym{NSM} sees any new +certificate. This will allow you to inspect all the certificates from +all the connections that Emacs makes. + +The following additional variables can be used to control +@acronym{NSM} details. + +@table @code +@item nsm-settings-file +@vindex nsm-settings-file +The @acronym{NSM} stores details on the connections in this file. It +defaults to @file{~/.emacs.d/network-security.data}. + +@item nsm-save-host-names +@vindex nsm-save-host-names +By default, host names will not be saved per non-@code{STARTTLS} +connection. Instead a host/port hash is used to identify connections. +This means that one can't casually read the settings file to see what +servers the user has connected to. If this variable is @code{t}, host +names will be saved in the file, too. +@end table + + @node Document View @section Document Viewing @cindex DVI file diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 57c5c65..b0da266 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -3,6 +3,8 @@ * processes.texi (Network Security): Made into its own section and fleshed out. (Network Security): Mention more NSM variables. + (Processes): Moved the Network Security Manager stuff to the Emacs + manual. 2014-11-23 Lars Magne Ingebrigtsen diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 754140e..fa665da 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -1299,7 +1299,6 @@ Processes * System Processes:: Accessing other processes running on your system. * Transaction Queues:: Transaction-based communication with subprocesses. * Network:: Opening network connections. -* Network Security:: Managing the network security. * Network Servers:: Network servers let Emacs accept net connections. * Datagrams:: UDP network connections. * Low-Level Network:: Lower-level but more general function diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index c93288f..0952cc1 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -52,7 +52,6 @@ Processes}. * System Processes:: Accessing other processes running on your system. * Transaction Queues:: Transaction-based communication with subprocesses. * Network:: Opening network connections. -* Network Security:: Managing the network security. * Network Servers:: Network servers let Emacs accept net connections. * Datagrams:: UDP network connections. * Low-Level Network:: Lower-level but more general function @@ -2074,108 +2073,6 @@ The connection type: @samp{plain} or @samp{tls}. @end defun -@node Network Security -@section Network Security -@cindex Network Security Manager -@cindex encryption -@cindex SSL -@cindex TLS -@cindex STARTTLS - -After establishing a network connection, the connection is then passed -on to the Network Security Manager (@acronym{NSM}). - -@vindex network-security-level -The @code{network-security-level} variable determines the security -level. If this is @code{low}, no security checks are performed. - -If this variable is @code{medium} (which is the default), a number of -checks will be performed. If the @acronym{NSM} determines that the -network connection might be unsafe, the user is made aware of this, -and the @acronym{NSM} will ask the user what to do about the network -connection. - -The user is given the choice of registering a permanent security -exception, a temporary one, or whether to refuse the connection -entirely. - -Below is a list of the checks done on the @code{medium} level. - -@table @asis - -@item unable to verify a @acronym{TLS} certificate -If the connection is a @acronym{TLS}, @acronym{SSL} or -@acronym{STARTTLS} connection, the @acronym{NSM} will check whether -the certificate used to establish the identity of the server we're -connecting to can be verified. - -While an invalid certificate is often the cause for concern (there may -be a Man-in-the-Middle hijacking your network connection and stealing -your password), there may be valid reasons for going ahead with the -connection anyway. - -For instance, the server may be using a self-signed certificate, or -the certificate may have expired. It's up to the user to determine -whether it's acceptable to continue the connection. - -@item a self-signed certificate has changed -If you've previously accepted a self-signed certificate, but it has -now changed, that either means that the server has just changed the -certificate, or this might mean that the network connection has been -hijacked. - -@item previously encrypted connection now unencrypted -If the connection is unencrypted, but it was encrypted in previous -sessions, this might mean that there is a proxy between you and the -server that strips away @acronym{STARTTLS} announcements, leaving the -connection unencrypted. This is usually very suspicious. - -@item talking to an unencrypted service when sending a password -When connecting to an @acronym{IMAP} or @acronym{POP3} server, these -should usually be encrypted, because it's common to send passwords -over these connections. Similarly, if you're sending email via -@acronym{SMTP} that requires a password, you usually want that -connection to be encrypted. If the connection isn't encrypted, the -@acronym{NSM} will warn you. - -@end table - -If @code{network-security-level} is @code{high}, the following checks -will be made: - -@table @asis -@item a validated certificate changes the public key -Servers change their keys occasionally, and that is normally nothing -to be concerned about. However, if you are worried that your network -connections are being hijacked by agencies who have access to pliable -Certificate Authorities that issue new certificates for third-party -services, you may want to keep track of these changes. -@end table - -Finally, if @code{network-security-level} is @code{paranoid}, you will -also be notified the first time the @acronym{NSM} sees any new -certificate. This will allow you to inspect all the certificates from -all the connections that Emacs makes. - -The following additional variables can be used to control -@acronym{NSM} details. - -@table @code -@item nsm-settings-file -@vindex nsm-settings-file -The @acronym{NSM} stores details on the connections in this file. It -defaults to @file{~/.emacs.d/network-security.data}. - -@item nsm-save-host-names -@vindex nsm-save-host-names -By default, host names will not be saved per non-@code{STARTTLS} -connection. Instead a host/port hash is used to identify connections. -This means that one can't casually read the settings file to see what -servers the user has connected to. If this variable is @code{t}, host -names will be saved in the file, too. -@end table - - @node Network Servers @section Network Servers @cindex network servers diff --git a/etc/ChangeLog b/etc/ChangeLog index 867e4f5..5d61612 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Lars Magne Ingebrigtsen + + * NEWS: Mention NSM. + 2014-11-23 Lars Magne Ingebrigtsen * NEWS: Mention `url-request-noninteractive'. diff --git a/etc/NEWS b/etc/NEWS index da2edb6..6cad6a3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -49,6 +49,10 @@ Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to. * Changes in Emacs 25.1 +** Network security (TLS/SSL certificate validity and the like) is +added via the new Network Security Manager (NSM) and controlled via +the `network-security-level' variable. + ** C-h l now also lists the commands that were run. ** The new M-s M-w key binding uses eww to search the web for the commit b3b0b0971db990a39d1bf521a5c9dc604111ea89 Author: Stefan Monnier Date: Mon Nov 24 12:26:01 2014 -0500 * lisp/vc/vc-hooks.el (vc-state-base-face): Don't override mode-line-inactive. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb25996..35141b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Stefan Monnier + + * vc/vc-hooks.el (vc-state-base-face): Don't override + mode-line-inactive. + 2014-11-24 Lars Magne Ingebrigtsen * net/eww.el (eww-set-character-encoding): Use `read-coding-system'. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index a084f9d..9a277db 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -41,7 +41,7 @@ :version "25.1") (defface vc-state-base-face - '((default :inherit mode-line)) + '((default)) "Base face for VC state indicator." :group 'vc-faces :group 'mode-line commit 87ac4374374cbab07a18ef794a026a1fc2436d09 Author: Lars Magne Ingebrigtsen Date: Mon Nov 24 18:18:53 2014 +0100 eww input field fixup (eww-process-text-input): Inhibit read only so that input fields don't get shortened (bug#19085). diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 58f2a58..bb25996 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,8 @@ 2014-11-24 Lars Magne Ingebrigtsen * net/eww.el (eww-set-character-encoding): Use `read-coding-system'. + (eww-process-text-input): Inhibit read only so that input fields + don't get shortened (bug#19085). 2014-11-24 Leo Liu diff --git a/lisp/net/eww.el b/lisp/net/eww.el index a607e44..97939cb 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -973,6 +973,7 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (defun eww-process-text-input (beg end length) (let* ((form (get-text-property (min (1+ end) (point-max)) 'eww-form)) + (inhibit-read-only t) (properties (text-properties-at end)) (type (plist-get form :type))) (when (and form commit 409e4c82dccb9dc0d48c54735161c8f4cc383625 Author: Glenn Morris Date: Mon Nov 24 09:07:45 2014 -0800 * configure.ac [HAVE_W32]: Generate nt/*.rc files when HAVE_W32. diff --git a/ChangeLog b/ChangeLog index f40624c..5fe2a91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Glenn Morris + + * configure.ac [HAVE_W32]: Generate nt/*.rc files when HAVE_W32, + not just when using mingw32. + 2014-11-22 Glenn Morris Further reduce number of versioned files storing Emacs version number. diff --git a/configure.ac b/configure.ac index 85d1123..1c7ec54 100644 --- a/configure.ac +++ b/configure.ac @@ -4679,7 +4679,10 @@ AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure case $opsys in mingw32) AC_DEFINE(config_opsysfile, , []) + ;; +esac +if test "${HAVE_W32}" = "yes"; then dnl Construct something of the form "24,4,0,0" with 4 components. comma_version=`echo "$version.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'` @@ -4688,8 +4691,8 @@ case $opsys in AC_SUBST(comma_version) AC_SUBST(comma_space_version) AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc]) - ;; -esac +fi + XMENU_OBJ= XOBJ= commit f9bff82aa49b4380f7d2efa916207d2874616ba8 Author: Lars Magne Ingebrigtsen Date: Mon Nov 24 17:57:28 2014 +0100 (Network Security): Mention more NSM variables. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 3df6bfc..57c5c65 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -2,6 +2,7 @@ * processes.texi (Network Security): Made into its own section and fleshed out. + (Network Security): Mention more NSM variables. 2014-11-23 Lars Magne Ingebrigtsen diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index fcf5e8d..c93288f 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2157,6 +2157,24 @@ also be notified the first time the @acronym{NSM} sees any new certificate. This will allow you to inspect all the certificates from all the connections that Emacs makes. +The following additional variables can be used to control +@acronym{NSM} details. + +@table @code +@item nsm-settings-file +@vindex nsm-settings-file +The @acronym{NSM} stores details on the connections in this file. It +defaults to @file{~/.emacs.d/network-security.data}. + +@item nsm-save-host-names +@vindex nsm-save-host-names +By default, host names will not be saved per non-@code{STARTTLS} +connection. Instead a host/port hash is used to identify connections. +This means that one can't casually read the settings file to see what +servers the user has connected to. If this variable is @code{t}, host +names will be saved in the file, too. +@end table + @node Network Servers @section Network Servers commit 7f311629f0dc2b9f04acabb042347e1baf14fc23 Author: Lars Magne Ingebrigtsen Date: Mon Nov 24 17:47:00 2014 +0100 * processes.texi (Network Security): Made into its own section and fleshed out diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 5cc85aa..3df6bfc 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Lars Magne Ingebrigtsen + + * processes.texi (Network Security): Made into its own section and + fleshed out. + 2014-11-23 Lars Magne Ingebrigtsen * processes.texi (Network): Mention the new :warn-unless-encrypted diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index fa665da..754140e 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -1299,6 +1299,7 @@ Processes * System Processes:: Accessing other processes running on your system. * Transaction Queues:: Transaction-based communication with subprocesses. * Network:: Opening network connections. +* Network Security:: Managing the network security. * Network Servers:: Network servers let Emacs accept net connections. * Datagrams:: UDP network connections. * Low-Level Network:: Lower-level but more general function diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 3c9da5c..fcf5e8d 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -52,6 +52,7 @@ Processes}. * System Processes:: Accessing other processes running on your system. * Transaction Queues:: Transaction-based communication with subprocesses. * Network:: Opening network connections. +* Network Security:: Managing the network security. * Network Servers:: Network servers let Emacs accept net connections. * Datagrams:: UDP network connections. * Low-Level Network:: Lower-level but more general function @@ -2072,25 +2073,89 @@ The connection type: @samp{plain} or @samp{tls}. @end defun + +@node Network Security +@section Network Security @cindex Network Security Manager -After establishing the connection, the connection is then passed on to -the Network Security Manager (@acronym{NSM}). If the connection is a -@acronym{TLS} or @acronym{STARTTLS} connection, the @acronym{NSM} will -check whether the certificate used to establish the identity of the -server we're connecting to can be verified. If this can't be done, -the @acronym{NSM} will query the user whether to proceed with the +@cindex encryption +@cindex SSL +@cindex TLS +@cindex STARTTLS + +After establishing a network connection, the connection is then passed +on to the Network Security Manager (@acronym{NSM}). + +@vindex network-security-level +The @code{network-security-level} variable determines the security +level. If this is @code{low}, no security checks are performed. + +If this variable is @code{medium} (which is the default), a number of +checks will be performed. If the @acronym{NSM} determines that the +network connection might be unsafe, the user is made aware of this, +and the @acronym{NSM} will ask the user what to do about the network connection. The user is given the choice of registering a permanent security exception, a temporary one, or whether to refuse the connection entirely. +Below is a list of the checks done on the @code{medium} level. + +@table @asis + +@item unable to verify a @acronym{TLS} certificate +If the connection is a @acronym{TLS}, @acronym{SSL} or +@acronym{STARTTLS} connection, the @acronym{NSM} will check whether +the certificate used to establish the identity of the server we're +connecting to can be verified. + +While an invalid certificate is often the cause for concern (there may +be a Man-in-the-Middle hijacking your network connection and stealing +your password), there may be valid reasons for going ahead with the +connection anyway. + +For instance, the server may be using a self-signed certificate, or +the certificate may have expired. It's up to the user to determine +whether it's acceptable to continue the connection. + +@item a self-signed certificate has changed +If you've previously accepted a self-signed certificate, but it has +now changed, that either means that the server has just changed the +certificate, or this might mean that the network connection has been +hijacked. + +@item previously encrypted connection now unencrypted If the connection is unencrypted, but it was encrypted in previous -sessions, the user will also be notified about this. +sessions, this might mean that there is a proxy between you and the +server that strips away @acronym{STARTTLS} announcements, leaving the +connection unencrypted. This is usually very suspicious. + +@item talking to an unencrypted service when sending a password +When connecting to an @acronym{IMAP} or @acronym{POP3} server, these +should usually be encrypted, because it's common to send passwords +over these connections. Similarly, if you're sending email via +@acronym{SMTP} that requires a password, you usually want that +connection to be encrypted. If the connection isn't encrypted, the +@acronym{NSM} will warn you. -@vindex network-security-level -The @code{network-security-level} variable determines the security level. -If this is @code{low}, no security checks are performed. +@end table + +If @code{network-security-level} is @code{high}, the following checks +will be made: + +@table @asis +@item a validated certificate changes the public key +Servers change their keys occasionally, and that is normally nothing +to be concerned about. However, if you are worried that your network +connections are being hijacked by agencies who have access to pliable +Certificate Authorities that issue new certificates for third-party +services, you may want to keep track of these changes. +@end table + +Finally, if @code{network-security-level} is @code{paranoid}, you will +also be notified the first time the @acronym{NSM} sees any new +certificate. This will allow you to inspect all the certificates from +all the connections that Emacs makes. @node Network Servers commit f9fcf84a9c6e7a4510a60b41c29cadbef817af14 Author: Lars Magne Ingebrigtsen Date: Mon Nov 24 16:58:37 2014 +0100 * net/eww.el (eww-set-character-encoding): Use `read-coding-system'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 27cde86..58f2a58 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Lars Magne Ingebrigtsen + + * net/eww.el (eww-set-character-encoding): Use `read-coding-system'. + 2014-11-24 Leo Liu * emacs-lisp/macroexp.el (macroexp-let2*): New macro. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 077a004..a607e44 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1385,15 +1385,12 @@ Differences in #targets are ignored." (setq count (1+ count))) (expand-file-name file directory))) -(defun eww-set-character-encoding (encode) +(defun eww-set-character-encoding (charset) "Set character encoding." - (interactive "sSet Character Encoding (default utf-8): ") - (cond ((zerop (length encode)) - (eww-reload 'utf-8)) - (t - (if (not (coding-system-p (intern encode))) - (user-error "Invalid encodeing type.") - (eww-reload (intern encode)))))) + (interactive "zUse character set (default utf-8): ") + (if (null charset) + (eww-reload 'utf-8) + (eww-reload charset))) ;;; Bookmarks code commit 6dbaf0471927829126025f57315db02d78255790 Author: Leo Liu Date: Mon Nov 24 22:57:53 2014 +0800 New macro macroexp-let2* * emacs-lisp/macroexp.el (macroexp-let2*): New macro. * window.el (with-temp-buffer-window) (with-current-buffer-window, with-displayed-buffer-window): * emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin): * emacs-lisp/cl-lib.el (substring): * emacs-lisp/cl-extra.el (cl-getf): Use it. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 26376af..27cde86 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2014-11-24 Leo Liu + + * emacs-lisp/macroexp.el (macroexp-let2*): New macro. + + * window.el (with-temp-buffer-window) + (with-current-buffer-window, with-displayed-buffer-window): + * emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin): + * emacs-lisp/cl-lib.el (substring): + * emacs-lisp/cl-extra.el (cl-getf): Use it. + 2014-11-24 Eli Zaretskii * isearch.el (isearch-update): Don't assume diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 9ccfc8b..a94dcd3 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -606,15 +606,14 @@ PROPLIST is a list of the sort returned by `symbol-plist'. (declare (gv-expander (lambda (do) (gv-letplace (getter setter) plist - (macroexp-let2 nil k tag - (macroexp-let2 nil d def - (funcall do `(cl-getf ,getter ,k ,d) - (lambda (v) - (macroexp-let2 nil val v - `(progn - ,(funcall setter - `(cl--set-getf ,getter ,k ,val)) - ,val)))))))))) + (macroexp-let2* nil ((k tag) (d def)) + (funcall do `(cl-getf ,getter ,k ,d) + (lambda (v) + (macroexp-let2 nil val v + `(progn + ,(funcall setter + `(cl--set-getf ,getter ,k ,val)) + ,val))))))))) (setplist '--cl-getf-symbol-- plist) (or (get '--cl-getf-symbol-- tag) ;; Originally we called cl-get here, diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index c7d21c7..cc61597 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -723,12 +723,11 @@ If ALIST is non-nil, the new pairs are prepended to it." (gv-define-expander substring (lambda (do place from &optional to) (gv-letplace (getter setter) place - (macroexp-let2 nil start from - (macroexp-let2 nil end to - (funcall do `(substring ,getter ,start ,end) - (lambda (v) - (funcall setter `(cl--set-substring - ,getter ,start ,end ,v))))))))) + (macroexp-let2* nil ((start from) (end to)) + (funcall do `(substring ,getter ,start ,end) + (lambda (v) + (funcall setter `(cl--set-substring + ,getter ,start ,end ,v)))))))) ;;; Miscellaneous. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c90cc04..0a6e1c6 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2906,9 +2906,8 @@ The function's arguments should be treated as immutable. ;;;###autoload (defun cl--compiler-macro-adjoin (form a list &rest keys) (if (memq :key keys) form - (macroexp-let2 macroexp-copyable-p va a - (macroexp-let2 macroexp-copyable-p vlist list - `(if (cl-member ,va ,vlist ,@keys) ,vlist (cons ,va ,vlist)))))) + (macroexp-let2* macroexp-copyable-p ((va a) (vlist list)) + `(if (cl-member ,va ,vlist ,@keys) ,vlist (cons ,va ,vlist))))) (defun cl--compiler-macro-get (_form sym prop &optional def) (if def diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index a1dc6fa..b40e44e 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -344,6 +344,15 @@ be skipped; if nil, as is usual, `macroexp-const-p' is used." (macroexp-let* (list (list ,var ,expsym)) ,bodysym))))) +(defmacro macroexp-let2* (test bindings &rest body) + "Bind each binding in BINDINGS as `macroexp-let2' does." + (declare (indent 2) (debug (sexp (&rest (sexp form)) body))) + (pcase-exhaustive bindings + (`nil (macroexp-progn body)) + (`((,var ,exp) . ,tl) + `(macroexp-let2 ,test ,var ,exp + (macroexp-let2* ,test ,tl ,@body))))) + (defun macroexp--maxsize (exp size) (cond ((< size 0) size) ((symbolp exp) (1- size)) diff --git a/lisp/window.el b/lisp/window.el index 91a0e15..78257b6 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -185,19 +185,19 @@ argument replaces this)." (let ((buffer (make-symbol "buffer")) (window (make-symbol "window")) (value (make-symbol "value"))) - (macroexp-let2 nil vbuffer-or-name buffer-or-name - (macroexp-let2 nil vaction action - (macroexp-let2 nil vquit-function quit-function - `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name)) - (standard-output ,buffer) - ,window ,value) - (setq ,value (progn ,@body)) - (with-current-buffer ,buffer - (setq ,window (temp-buffer-window-show ,buffer ,vaction))) - - (if (functionp ,vquit-function) - (funcall ,vquit-function ,window ,value) - ,value))))))) + (macroexp-let2* nil ((vbuffer-or-name buffer-or-name) + (vaction action) + (vquit-function quit-function)) + `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name)) + (standard-output ,buffer) + ,window ,value) + (setq ,value (progn ,@body)) + (with-current-buffer ,buffer + (setq ,window (temp-buffer-window-show ,buffer ,vaction))) + + (if (functionp ,vquit-function) + (funcall ,vquit-function ,window ,value) + ,value))))) (defmacro with-current-buffer-window (buffer-or-name action quit-function &rest body) "Evaluate BODY with a buffer BUFFER-OR-NAME current and show that buffer. @@ -208,19 +208,19 @@ BODY." (let ((buffer (make-symbol "buffer")) (window (make-symbol "window")) (value (make-symbol "value"))) - (macroexp-let2 nil vbuffer-or-name buffer-or-name - (macroexp-let2 nil vaction action - (macroexp-let2 nil vquit-function quit-function - `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name)) - (standard-output ,buffer) - ,window ,value) - (with-current-buffer ,buffer - (setq ,value (progn ,@body)) - (setq ,window (temp-buffer-window-show ,buffer ,vaction))) - - (if (functionp ,vquit-function) - (funcall ,vquit-function ,window ,value) - ,value))))))) + (macroexp-let2* nil ((vbuffer-or-name buffer-or-name) + (vaction action) + (vquit-function quit-function)) + `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name)) + (standard-output ,buffer) + ,window ,value) + (with-current-buffer ,buffer + (setq ,value (progn ,@body)) + (setq ,window (temp-buffer-window-show ,buffer ,vaction))) + + (if (functionp ,vquit-function) + (funcall ,vquit-function ,window ,value) + ,value))))) (defmacro with-displayed-buffer-window (buffer-or-name action quit-function &rest body) "Show a buffer BUFFER-OR-NAME and evaluate BODY in that buffer. @@ -230,28 +230,28 @@ displays the buffer specified by BUFFER-OR-NAME before running BODY." (let ((buffer (make-symbol "buffer")) (window (make-symbol "window")) (value (make-symbol "value"))) - (macroexp-let2 nil vbuffer-or-name buffer-or-name - (macroexp-let2 nil vaction action - (macroexp-let2 nil vquit-function quit-function - `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name)) - (standard-output ,buffer) - ,window ,value) - (with-current-buffer ,buffer - (setq ,window (temp-buffer-window-show ,buffer ,vaction))) - - (let ((inhibit-read-only t) - (inhibit-modification-hooks t)) - (setq ,value (progn ,@body))) - - (set-window-point ,window (point-min)) - - (when (functionp (cdr (assq 'window-height (cdr ,vaction)))) - (ignore-errors - (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window))) - - (if (functionp ,vquit-function) - (funcall ,vquit-function ,window ,value) - ,value))))))) + (macroexp-let2* nil ((vbuffer-or-name buffer-or-name) + (vaction action) + (vquit-function quit-function)) + `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name)) + (standard-output ,buffer) + ,window ,value) + (with-current-buffer ,buffer + (setq ,window (temp-buffer-window-show ,buffer ,vaction))) + + (let ((inhibit-read-only t) + (inhibit-modification-hooks t)) + (setq ,value (progn ,@body))) + + (set-window-point ,window (point-min)) + + (when (functionp (cdr (assq 'window-height (cdr ,vaction)))) + (ignore-errors + (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window))) + + (if (functionp ,vquit-function) + (funcall ,vquit-function ,window ,value) + ,value))))) ;; The following two functions are like `window-next-sibling' and ;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so commit d71a2d495f688083faa97f7ea305fdc6b595750c Author: Lars Magne Ingebrigtsen Date: Mon Nov 24 15:42:34 2014 +0100 * gnutls.c: Fix compilation warnings given fix --enable-gcc-warnings. diff --git a/src/ChangeLog b/src/ChangeLog index a441016..448de36 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Lars Magne Ingebrigtsen + + * gnutls.c: Fix compilation warnings given fix --enable-gcc-warnings. + 2014-11-24 Glenn Morris * emacs.c (main) <--version>: Make use of PACKAGE_NAME. diff --git a/src/gnutls.c b/src/gnutls.c index 22e3aec..dd9c801 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -62,10 +62,10 @@ static void gnutls_log_function2 (int, const char *, const char *); static void gnutls_audit_log_function (gnutls_session_t, const char *); #endif -static enum - { - CERTIFICATE_NOT_MATCHING = 2, - } extra_peer_verification_t; +enum extra_peer_verification +{ + CERTIFICATE_NOT_MATCHING = 2 +}; #ifdef WINDOWSNT @@ -768,8 +768,8 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, #endif } -Lisp_Object -gnutls_hex_string (char *buf, size_t buf_size, char *prefix) { +static Lisp_Object +gnutls_hex_string (char *buf, size_t buf_size, const char *prefix) { size_t prefix_length = strlen (prefix); char *string = malloc (buf_size * 3 + prefix_length); Lisp_Object ret; @@ -786,7 +786,7 @@ gnutls_hex_string (char *buf, size_t buf_size, char *prefix) { return ret; } -Lisp_Object +static Lisp_Object gnutls_certificate_details (gnutls_x509_crt_t cert) { Lisp_Object res = Qnil; commit 9faf591a66aa0c5ab4522f2077c170b79e95c9ec Author: Eli Zaretskii Date: Mon Nov 24 15:32:14 2014 +0200 Fix bug #19157 with incorrect hscroll during I-search. lisp/isearch.el (isearch-update): Don't assume pos-visible-in-window-p will return nil when point is hscrolled out of view. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c3a01da..26376af 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-11-24 Eli Zaretskii + + * isearch.el (isearch-update): Don't assume + pos-visible-in-window-p will return nil when point is hscrolled + out of view. (Bug#19157) + 2014-11-20 Andrey Kotlarski * net/eww.el (eww-browse-url): Optionally create new eww buffer. diff --git a/lisp/isearch.el b/lisp/isearch.el index f0ce705..c3e473a 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -974,10 +974,17 @@ The last thing it does is to run `isearch-update-post-hook'." (other-window 1)) (goto-char found-point)) ;; Keep same hscrolling as at the start of the search when possible - (let ((current-scroll (window-hscroll))) + (let ((current-scroll (window-hscroll)) + visible-p) (set-window-hscroll (selected-window) isearch-start-hscroll) - (unless (pos-visible-in-window-p) - (set-window-hscroll (selected-window) current-scroll)))) + (setq visible-p (pos-visible-in-window-p nil nil t)) + (if (or (not visible-p) + ;; When point is not visible because of hscroll, + ;; pos-visible-in-window-p returns non-nil, but + ;; the X coordinate it returns is 1 pixel beyond + ;; the last visible one. + (>= (car visible-p) (window-body-width nil t))) + (set-window-hscroll (selected-window) current-scroll)))) (if isearch-other-end (if (< isearch-other-end (point)) ; isearch-forward? (isearch-highlight isearch-other-end (point)) commit e01ec2ed084776b370e0634120deec6b65424b8a Author: Glenn Morris Date: Sun Nov 23 17:11:51 2014 -0800 * src/emacs.c (main) <--version>: Make use of PACKAGE_NAME. diff --git a/src/ChangeLog b/src/ChangeLog index 8d5f786..a441016 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2014-11-24 Glenn Morris + * emacs.c (main) <--version>: Make use of PACKAGE_NAME. + * Makefile.in (emacs.res): Use ../nt rule, rather than duplicating it. (ntsource, WINDRES, EMACS_MANIFEST): Remove, now unused. diff --git a/src/emacs.c b/src/emacs.c index 62f03c6..da34eaa 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -803,10 +803,10 @@ main (int argc, char **argv) version = emacs_version; copyright = emacs_copyright; } - printf ("GNU Emacs %s\n", version); + printf ("%s %s\n", PACKAGE_NAME, version); printf ("%s\n", copyright); - printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n"); - printf ("You may redistribute copies of Emacs\n"); + printf ("%s comes with ABSOLUTELY NO WARRANTY.\n", PACKAGE_NAME); + printf ("You may redistribute copies of %s\n", PACKAGE_NAME); printf ("under the terms of the GNU General Public License.\n"); printf ("For more information about these matters, "); printf ("see the file named COPYING.\n"); commit 825351bcce8a6697905310793d82c57449500755 Author: Glenn Morris Date: Sun Nov 23 16:16:57 2014 -0800 Reduce nt and src Makefile duplication wrt emacs.res * nt/Makefile.in (../src/emacs.res): New target. * src/Makefile.in (emacs.res): Use ../nt rule, rather than duplicating it. (ntsource, WINDRES, EMACS_MANIFEST): Remove, now unused. diff --git a/nt/ChangeLog b/nt/ChangeLog index 168f1dd..01dc0b1 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Glenn Morris + + * Makefile.in (../src/emacs.res): New target. + 2014-11-22 Glenn Morris * emacs.rc.in, emacsclient.rc.in: Rename from emacs.rc, emacsclient.rc. diff --git a/nt/Makefile.in b/nt/Makefile.in index c6b2f0b..56e3e82 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -224,7 +224,7 @@ cmdproxy${EXEEXT}: ${srcdir}/cmdproxy.c runemacs${EXEEXT}: ${srcdir}/runemacs.c $(EMACSRES) $(CC) ${ALL_CFLAGS} $^ -mwindows -o $@ -## This rule (and file) is duplicated in src/: why? -emacs.res: emacs.rc ${srcdir}/icons/emacs.ico \ +## Also used in ../src/Makefile. +emacs.res ../src/emacs.res: emacs.rc ${srcdir}/icons/emacs.ico \ ${srcdir}/icons/hand.cur ${srcdir}/$(EMACS_MANIFEST) ${WINDRES} -I ${srcdir} -O coff -o $@ $< diff --git a/src/ChangeLog b/src/ChangeLog index b7c9a95..8d5f786 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Glenn Morris + + * Makefile.in (emacs.res): Use ../nt rule, rather than duplicating it. + (ntsource, WINDRES, EMACS_MANIFEST): Remove, now unused. + 2014-11-23 Lars Magne Ingebrigtsen * gnutls.c: Fix Windows function definition of diff --git a/src/Makefile.in b/src/Makefile.in index 4bc5fdfa..61cb938 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -31,10 +31,8 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ # MinGW CPPFLAGS may use this. abs_top_srcdir=@abs_top_srcdir@ -ntsource = $(top_srcdir)/nt VPATH = $(srcdir) CC = @CC@ -WINDRES = @WINDRES@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ @@ -264,8 +262,6 @@ W32_LIBS=@W32_LIBS@ ## emacs.res if HAVE_W32 EMACSRES = @EMACSRES@ -## emacs-*.manifest if HAVE_W32 -EMACS_MANIFEST = @EMACS_MANIFEST@ ## If HAVE_W32, compiler arguments for including ## the resource file in the binary. ## Cygwin: -Wl,emacs.res @@ -548,12 +544,8 @@ $(top_srcdir)/aclocal.m4 $(top_srcdir)/configure config.in ../config.status \ doc.o: buildobj.h -## This rule (and file) is duplicated in nt/: why? -emacs.res: ../nt/emacs.rc \ - $(ntsource)/icons/emacs.ico \ - $(ntsource)/icons/hand.cur \ - $(ntsource)/$(EMACS_MANIFEST) - $(WINDRES) -O COFF --include-dir=$(top_srcdir)/nt -o $@ $< +emacs.res: FORCE + $(MAKE) -C ../nt ../src/emacs.res .PHONY: ns-app ns-app: emacs$(EXEEXT) commit 8c4475f9cecc2bdae4f419273fe8e9c3e01351b1 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 23:55:58 2014 +0100 * gnutls.c: Fix Windows function definition of gnutls_x509_crt_get_fingerprint. diff --git a/src/ChangeLog b/src/ChangeLog index 8cd0fd9..b7c9a95 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,10 @@ 2014-11-23 Lars Magne Ingebrigtsen - * gnutls.c: Fixed Windows function definition of + * gnutls.c: Fix Windows function definition of gnutls_x509_crt_get_fingerprint. + * gnutls.c: Fix Windows return value for gnutls_pk_algorithm_get_name. + * gnutls.c (Fgnutls_boot): Save certificate for later inspection. * process.h: Added more fields to Lisp_Process to track diff --git a/src/gnutls.c b/src/gnutls.c index 7863513..22e3aec 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -169,7 +169,8 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_get_dn, (gnutls_x509_crt_t, char *, size_t *)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_pk_algorithm, (gnutls_x509_crt_t, unsigned int *)); -DEF_GNUTLS_FN (int, gnutls_pk_algorithm_get_name, (gnutls_pk_algorithm_t)); +DEF_GNUTLS_FN (const char*, gnutls_pk_algorithm_get_name, + (gnutls_pk_algorithm_t)); DEF_GNUTLS_FN (int, gnutls_pk_bits_to_sec_param, (gnutls_pk_algorithm_t, unsigned int)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_issuer_unique_id, commit 1653296fa233002e252b72b641d1327a3147ac3b Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 23:09:00 2014 +0100 Typo fix from previous check-in diff --git a/src/gnutls.c b/src/gnutls.c index e012a90..7863513 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -154,7 +154,7 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import, DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_fingerprint, (gnutls_x509_crt_t, - gnutls_digest_algorithm_t, void *, size_t *_buf)); + gnutls_digest_algorithm_t, void *, size_t *)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_version, (gnutls_x509_crt_t)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_serial, commit 1aafa6b682cf38a14bbb27ae860b83a32bd477c6 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 23:06:08 2014 +0100 gnutls.c windows compilation fix * gnutls.c: Fixed Windows function definition of gnutls_x509_crt_get_fingerprint. diff --git a/src/ChangeLog b/src/ChangeLog index 10ef4fa..8cd0fd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2014-11-23 Lars Magne Ingebrigtsen + * gnutls.c: Fixed Windows function definition of + gnutls_x509_crt_get_fingerprint. + * gnutls.c (Fgnutls_boot): Save certificate for later inspection. * process.h: Added more fields to Lisp_Process to track diff --git a/src/gnutls.c b/src/gnutls.c index 37d797a..e012a90 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -153,8 +153,8 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import, gnutls_x509_crt_fmt_t)); DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_fingerprint, - (gnutls_digest_algorithm_t, - const gnutls_datum_t*, void *, size_t *)); + (gnutls_x509_crt_t, + gnutls_digest_algorithm_t, void *, size_t *_buf)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_version, (gnutls_x509_crt_t)); DEF_GNUTLS_FN (int, gnutls_x509_crt_get_serial, commit 5a0e58af1ede71cea02cab4ac42ccaa71929f4dc Author: Glenn Morris Date: Sun Nov 23 11:33:56 2014 -0800 * lib-src/Makefile.in (emacsclient.res): Fix yesterday's thinko. diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 4fc3b4d..5260ed0 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2014-11-23 Glenn Morris + + * Makefile.in (emacsclient.res): Fix yesterday's thinko. + 2014-11-22 Glenn Morris * Makefile.in (emacsclient.res): Update deps for nt/emacsclient.rc diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 432314f..77d3b78 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -388,7 +388,7 @@ update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h) -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ $< $(LOADLIBES) $(NTLIB) -o $@ -emacsclient.res: ../nt/emacsclient.rc ${srcdir}/icons/emacs.ico +emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $< ## Makefile ends here. commit 2c783bb66163278e77af333c02feaba1443c5e84 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 18:31:47 2014 +0100 Fix bug marking diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 799c774..c3a01da 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,7 +2,7 @@ * net/eww.el (eww-browse-url): Optionally create new eww buffer. (eww-follow-link): Follow in new buffer in case of prefix - argument, open externally with double prefix. + argument, open externally with double prefix (bug#19130). 2014-11-23 Lars Magne Ingebrigtsen commit 79d187f4cac1028913fcba25051b8e324b817ae1 Author: Andrey Kotlarski Date: Sun Nov 23 18:30:17 2014 +0100 Allow opening eww links in a new buffer * net/eww.el (eww-browse-url): Optionally create new eww buffer. (eww-follow-link): Follow in new buffer in case of prefix argument, open externally with double prefix. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 74fdd42..799c774 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-11-20 Andrey Kotlarski + + * net/eww.el (eww-browse-url): Optionally create new eww buffer. + (eww-follow-link): Follow in new buffer in case of prefix + argument, open externally with double prefix. + 2014-11-23 Lars Magne Ingebrigtsen * net/eww.el (eww-display-html): Decode the document-defined charset. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index bad9b55..077a004 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -693,10 +693,18 @@ the like." (setq buffer-read-only t)) ;;;###autoload -(defun eww-browse-url (url &optional _new-window) - (when (and (equal major-mode 'eww-mode) - (plist-get eww-data :url)) - (eww-save-history)) +(defun eww-browse-url (url &optional new-window) + (cond (new-window + (let ((new-buffer "*eww*") + (num 0)) + (while (get-buffer new-buffer) + (setq num (1+ num) + new-buffer (format "*eww*<%d>" num))) + (switch-to-buffer new-buffer)) + (eww-mode)) + ((and (equal major-mode 'eww-mode) + (plist-get eww-data :url)) + (eww-save-history))) (eww url)) (defun eww-back-url () @@ -1307,7 +1315,8 @@ The browser to used is specified by the `shr-external-browser' variable." (defun eww-follow-link (&optional external mouse-event) "Browse the URL under point. -If EXTERNAL, browse the URL using `shr-external-browser'." +If EXTERNAL is single prefix, browse in new buffer. +If EXTERNAL is double prefix, browse the URL using `shr-external-browser'." (interactive (list current-prefix-arg last-nonmenu-event)) (mouse-set-point mouse-event) (let ((url (get-text-property (point) 'shr-url))) @@ -1316,7 +1325,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'." (message "No link under point")) ((string-match "^mailto:" url) (browse-url-mail url)) - (external + ((and (consp external) (< 4 (car external))) (funcall shr-external-browser url)) ;; This is a #target url in the same page as the current one. ((and (url-target (url-generic-parse-url url)) @@ -1325,7 +1334,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'." (eww-save-history) (eww-display-html 'utf-8 url dom nil (current-buffer)))) (t - (eww-browse-url url))))) + (eww-browse-url url external))))) (defun eww-same-page-p (url1 url2) "Return non-nil if both URLs represent the same page. commit b7278cdccf4651bbaebc6c58e02d0240ab0c68d6 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 17:37:58 2014 +0100 (eww-follow-link): Make going to #targets in the page work again. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f743575..74fdd42 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -6,6 +6,7 @@ (eww-display-html): Don't pop the *eww* buffer. (eww-display-raw): Ditto. (eww-display-image): Ditto. + (eww-follow-link): Make going to #targets in the page work again. 2014-11-23 Ivan Shmakov diff --git a/lisp/net/eww.el b/lisp/net/eww.el index b4d1486..bad9b55 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -359,7 +359,9 @@ See the `eww-search-prefix' variable for the search engine used." (list 'base (list (cons 'href url)) (progn - (unless (eq charset encode) + (when (or (and encode + (not (eq charset encode))) + (not (eq charset 'utf-8))) (condition-case nil (decode-coding-region (point) (point-max) (or encode charset)) @@ -1319,9 +1321,9 @@ If EXTERNAL, browse the URL using `shr-external-browser'." ;; This is a #target url in the same page as the current one. ((and (url-target (url-generic-parse-url url)) (eww-same-page-p url (plist-get eww-data :url))) - (eww-save-history) - (eww-display-html 'utf-8 url (plist-get eww-data :url) - nil (current-buffer))) + (let ((dom (plist-get eww-data :dom))) + (eww-save-history) + (eww-display-html 'utf-8 url dom nil (current-buffer)))) (t (eww-browse-url url))))) commit 6fd82d61a2b82e772e8cde0e04516f5c3ca98ed3 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 17:22:41 2014 +0100 Switch to the *eww* buffer immediately to avoid doing it asynchronously (eww): Pop to the *eww* buffer immediately after executing the `M-x eww' command to avoid having buffers pop up later. (eww-display-html): Don't pop the *eww* buffer. (eww-display-raw): Ditto. (eww-display-image): Ditto. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd8f3ce..f743575 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,11 @@ 2014-11-23 Lars Magne Ingebrigtsen * net/eww.el (eww-display-html): Decode the document-defined charset. + (eww): Pop to the *eww* buffer immediately after executing the + `M-x eww' command to avoid having buffers pop up later. + (eww-display-html): Don't pop the *eww* buffer. + (eww-display-raw): Ditto. + (eww-display-image): Ditto. 2014-11-23 Ivan Shmakov diff --git a/lisp/net/eww.el b/lisp/net/eww.el index ba21cc8..b4d1486 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -253,10 +253,13 @@ word(s) will be searched for via `eww-search-prefix'." (setq url (concat url "/")))) (setq url (concat eww-search-prefix (replace-regexp-in-string " " "+" url)))))) + (unless (eq major-mode 'eww-mode) + (eww-setup-buffer) + (eww-update-header-line-format) + (let ((inhibit-read-only t)) + (insert (format "Loading %s..." url)))) (url-retrieve url 'eww-render - (list url nil - (and (eq major-mode 'eww-mode) - (current-buffer))))) + (list url nil (current-buffer)))) ;;;###autoload (defalias 'browse-web 'eww) @@ -344,8 +347,10 @@ See the `eww-search-prefix' variable for the search engine used." (start end &optional base-url)) (defun eww-display-html (charset url &optional document point buffer encode) - (or (fboundp 'libxml-parse-html-region) - (error "This function requires Emacs to be compiled with libxml2")) + (unless (fboundp 'libxml-parse-html-region) + (error "This function requires Emacs to be compiled with libxml2")) + (unless (buffer-live-p buffer) + (error "Buffer %s doesn't exist" buffer)) ;; There should be a better way to abort loading images ;; asynchronously. (setq url-queue nil) @@ -362,41 +367,42 @@ See the `eww-search-prefix' variable for the search engine used." (libxml-parse-html-region (point) (point-max)))))) (source (and (null document) (buffer-substring (point) (point-max))))) - (eww-setup-buffer buffer) - (plist-put eww-data :source source) - (plist-put eww-data :dom document) - (let ((inhibit-read-only t) - (after-change-functions nil) - (shr-target-id (url-target (url-generic-parse-url url))) - (shr-external-rendering-functions - '((title . eww-tag-title) - (form . eww-tag-form) - (input . eww-tag-input) - (textarea . eww-tag-textarea) - (body . eww-tag-body) - (select . eww-tag-select) - (link . eww-tag-link) - (a . eww-tag-a)))) - (shr-insert-document document) - (cond - (point - (goto-char point)) - (shr-target-id - (goto-char (point-min)) - (let ((point (next-single-property-change - (point-min) 'shr-target-id))) - (when point - (goto-char point)))) - (t - (goto-char (point-min)) - ;; Don't leave point inside forms, because the normal eww - ;; commands aren't available there. - (while (and (not (eobp)) - (get-text-property (point) 'eww-form)) - (forward-line 1))))) - (plist-put eww-data :url url) - (setq eww-history-position 0) - (eww-update-header-line-format))) + (with-current-buffer buffer + (plist-put eww-data :source source) + (plist-put eww-data :dom document) + (let ((inhibit-read-only t) + (after-change-functions nil) + (shr-target-id (url-target (url-generic-parse-url url))) + (shr-external-rendering-functions + '((title . eww-tag-title) + (form . eww-tag-form) + (input . eww-tag-input) + (textarea . eww-tag-textarea) + (body . eww-tag-body) + (select . eww-tag-select) + (link . eww-tag-link) + (a . eww-tag-a)))) + (erase-buffer) + (shr-insert-document document) + (cond + (point + (goto-char point)) + (shr-target-id + (goto-char (point-min)) + (let ((point (next-single-property-change + (point-min) 'shr-target-id))) + (when point + (goto-char point)))) + (t + (goto-char (point-min)) + ;; Don't leave point inside forms, because the normal eww + ;; commands aren't available there. + (while (and (not (eobp)) + (get-text-property (point) 'eww-form)) + (forward-line 1))))) + (plist-put eww-data :url url) + (setq eww-history-position 0) + (eww-update-header-line-format)))) (defun eww-handle-link (cont) (let* ((rel (assq :rel cont)) @@ -440,7 +446,7 @@ See the `eww-search-prefix' variable for the search engine used." ;; FIXME? Title can be blank. Default to, eg, last component ;; of url? (format-spec eww-header-line-format - `((?u . ,(plist-get eww-data :url)) + `((?u . ,(or (plist-get eww-data :url) "")) (?t . ,(or (plist-get eww-data :title) "")))))) (setq header-line-format nil))) @@ -465,24 +471,30 @@ See the `eww-search-prefix' variable for the search engine used." (shr-generic cont) (shr-colorize-region start (point) fgcolor bgcolor))) -(defun eww-display-raw (&optional buffer encode) +(defun eww-display-raw (buffer &optional encode) (let ((data (buffer-substring (point) (point-max)))) - (eww-setup-buffer buffer) - (let ((inhibit-read-only t)) - (insert data) - (unless (eq encode 'utf-8) - (encode-coding-region (point-min) (1+ (length data)) 'utf-8) - (condition-case nil - (decode-coding-region (point-min) (1+ (length data)) encode) - (coding-system-error nil)))) - (goto-char (point-min)))) - -(defun eww-display-image (&optional buffer) + (unless (buffer-live-p buffer) + (error "Buffer %s doesn't exist" buffer)) + (with-current-buffer buffer + (let ((inhibit-read-only t)) + (erase-buffer) + (insert data) + (unless (eq encode 'utf-8) + (encode-coding-region (point-min) (1+ (length data)) 'utf-8) + (condition-case nil + (decode-coding-region (point-min) (1+ (length data)) encode) + (coding-system-error nil)))) + (goto-char (point-min))))) + +(defun eww-display-image (buffer) (let ((data (shr-parse-image-data))) - (eww-setup-buffer buffer) - (let ((inhibit-read-only t)) - (shr-put-image data nil)) - (goto-char (point-min)))) + (unless (buffer-live-p buffer) + (error "Buffer %s doesn't exist" buffer)) + (with-current-buffer buffer + (let ((inhibit-read-only t)) + (erase-buffer) + (shr-put-image data nil)) + (goto-char (point-min))))) (defun eww-display-pdf () (let ((data (buffer-substring (point) (point-max)))) commit 7f902e70b57f3a49ccfbcb52b0e438163b3d760c Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 17:00:55 2014 +0100 * net/eww.el (eww-display-html): Decode the document-defined charset. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cc9f451..dd8f3ce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * net/eww.el (eww-display-html): Decode the document-defined charset. + 2014-11-23 Ivan Shmakov * net/eww.el (eww-suggest-uris): New variable. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3ccbeb0..ba21cc8 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -356,7 +356,8 @@ See the `eww-search-prefix' variable for the search engine used." (progn (unless (eq charset encode) (condition-case nil - (decode-coding-region (point) (point-max) encode) + (decode-coding-region (point) (point-max) + (or encode charset)) (coding-system-error nil))) (libxml-parse-html-region (point) (point-max)))))) (source (and (null document) commit 5d9ddb9698391d18480a595ed9cac7058a870add Author: Ivan Shmakov Date: Sun Nov 23 16:55:03 2014 +0100 Make `M-x eww' default to the URL under point * net/eww.el (eww-suggest-uris): New variable. (eww-suggested-uris): New function. (eww): Default to URL under point. (eww-links-at-point): New function. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8cabef9..cc9f451 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-11-23 Ivan Shmakov + + * net/eww.el (eww-suggest-uris): New variable. + (eww-suggested-uris): New function. + (eww): Default to URL under point. + (eww-links-at-point): New function. + 2014-11-20 Mark Oteiza (tiny change) * net/eww.el (eww-add-bookmark): Fix bookmark titles. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 12b27bc..3ccbeb0 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -29,6 +29,7 @@ (require 'shr) (require 'url) (require 'url-queue) +(require 'url-util) ; for url-get-url-at-point (require 'mm-url) (eval-when-compile (require 'subr-x)) ;; for string-trim @@ -59,6 +60,21 @@ :group 'eww :type 'string) +(defcustom eww-suggest-uris + '(eww-links-at-point + url-get-url-at-point + eww-current-url) + "List of functions called to form the list of default URIs for `eww'. +Each of the elements is a function returning either a string or a list +of strings. The results will be joined into a single list with +duplicate entries (if any) removed." + :version "25.1" + :group 'eww + :type 'hook + :options '(eww-links-at-point + url-get-url-at-point + eww-current-url)) + (defcustom eww-bookmarks-directory user-emacs-directory "Directory where bookmark files will be stored." :version "25.1" @@ -101,6 +117,7 @@ The string will be passed through `substitute-command-keys'." :group 'eww :type '(choice (const :tag "Unlimited" nil) integer)) + (defcustom eww-use-external-browser-for-content-type "\\`\\(video/\\|audio/\\|application/ogg\\)" "Always use external browser for specified content-type." @@ -194,12 +211,30 @@ See also `eww-form-checkbox-selected-symbol'." (define-key map "\r" 'eww-follow-link) map)) +(defun eww-suggested-uris nil + "Return the list of URIs to suggest at the `eww' prompt. +This list can be customized via `eww-suggest-uris'." + (let ((obseen (make-vector 42 0)) + (uris nil)) + (dolist (fun eww-suggest-uris) + (let ((ret (funcall fun))) + (dolist (uri (if (stringp ret) (list ret) ret)) + (when (and uri (not (intern-soft uri obseen))) + (intern uri obseen) + (push uri uris))))) + (nreverse uris))) + ;;;###autoload (defun eww (url) "Fetch URL and render the page. If the input doesn't look like an URL or a domain name, the word(s) will be searched for via `eww-search-prefix'." - (interactive "sEnter URL or keywords: ") + (interactive + (let* ((uris (eww-suggested-uris)) + (prompt (concat "Enter URL or keywords" + (if uris (format " (default %s)" (car uris)) "") + ": "))) + (list (read-string prompt nil nil uris)))) (setq url (string-trim url)) (cond ((string-match-p "\\`file:/" url)) ;; Don't mangle file: URLs at all. @@ -469,6 +504,16 @@ See the `eww-search-prefix' variable for the search engine used." (unless (eq major-mode 'eww-mode) (eww-mode))) +(defun eww-current-url nil + "Return URI of the Web page the current EWW buffer is visiting." + (plist-get eww-data :url)) + +(defun eww-links-at-point (&optional pt) + "Return list of URIs, if any, linked at point." + (remq nil + (list (get-text-property (point) 'shr-url) + (get-text-property (point) 'image-url)))) + (defun eww-view-source () "View the HTML source code of the current page." (interactive) @@ -553,6 +598,7 @@ the like." (suppress-keymap map) (define-key map "q" 'quit-window) (define-key map "g" 'eww-reload) + (define-key map "G" 'eww) (define-key map [?\t] 'shr-next-link) (define-key map [?\M-\t] 'shr-previous-link) (define-key map [backtab] 'shr-previous-link) commit e791d4dfb2e65efa9362d77f4d5853df51e3b503 Author: Ivan Shmakov Date: Sun Nov 23 16:44:22 2014 +0100 Document the eww Desktop stuff Fixes: debbugs:18010 * eww.texi (Advanced): Mention the Desktop stuff (bug#18010). diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index e9029d5..76545b2 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-23 Ivan Shmakov + + * eww.texi (Advanced): Mention the Desktop stuff (bug#18010). + 2014-11-23 Michael Albinus * tramp.texi (Remote processes): Let-bind environment variables to diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 3529883..8261b27 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -219,6 +219,40 @@ contrast. If that is still too low for you, you can customize the variables @code{shr-color-visible-distance-min} and @code{shr-color-visible-luminance-min} to get a better contrast. +@cindex Desktop Support +@cindex Saving Sessions + In addition to maintaining the history at run-time, EWW will also +save the partial state of its buffers (the URIs and the titles of the +pages visited) in the desktop file if one is used. @xref{Saving Emacs +Sessions, , emacs, The GNU Emacs Manual} + +@vindex eww-desktop-remove-duplicates + EWW history may sensibly contain multiple entries for the same page +URI. At run-time, these entries may still have different associated +point positions or the actual Web page contents. +The latter, however, tend to be overly large to preserve in the +desktop file, so they get omitted, thus rendering the respective +entries entirely equivalent. By default, such duplicate entries are +not saved. Setting @code{eww-desktop-remove-duplicates} to nil will +force EWW to save them anyway. + +@vindex eww-restore-desktop + Restoring EWW buffers' contents may prove to take too long to +finish. When the @code{eww-restore-desktop} variable is set to +@code{nil} (the default), EWW will not try to reload the last visited +Web page when the buffer is restored from the desktop file, thus +allowing for faster Emacs start-up times. When set to @code{t}, +restoring the buffers will also initiate the reloading of such pages. + +@vindex eww-restore-reload-prompt + The EWW buffer restored from the desktop file but not yet reloaded +will contain a prompt, as specified by the +@code{eww-restore-reload-prompt} variable. The value of this variable +will be passed through @code{substitute-command-keys} upon each use, +thus allowing for the use of the usual substitutions, such as +@code{\[eww-reload]} for the current key binding of the +@code{eww-reload} command. + @node History and Acknowledgments @appendix History and Acknowledgments diff --git a/etc/NEWS b/etc/NEWS index a88902a..da2edb6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -177,6 +177,9 @@ the like off the page. *** You can now use several eww buffers in parallel by renaming eww buffers you want to keep separate. +*** Partial state of the eww buffers (the URIs and the titles of the +pages visited) is now preserved in the desktop file. + *** `eww-after-render-hook' is now called after eww has rendered the data in the buffer. commit 0445aff69108da12e5e445cb2bd11fac16d84945 Author: Mark Oteiza Date: Sun Nov 23 16:40:45 2014 +0100 * net/eww.el (eww-add-bookmark): Fix bookmark titles. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4b72eb8..8cabef9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,10 @@ +2014-11-20 Mark Oteiza (tiny change) + + * net/eww.el (eww-add-bookmark): Fix bookmark titles. + 2014-11-17 Mark Oteiza (tiny change) - * net/eww.el (eww-mode-map): Bind backtab to shr-previous-link + * net/eww.el (eww-mode-map): Bind backtab to shr-previous-link. 2014-11-23 Kenjiro Nakayama diff --git a/lisp/net/eww.el b/lisp/net/eww.el index f2a1631..12b27bc 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1339,7 +1339,7 @@ Differences in #targets are ignored." (if (y-or-n-p "bookmark this page? ") (progn (let ((title (replace-regexp-in-string "[\n\t\r]" " " - (plist-get eww-data :url)))) + (plist-get eww-data :title)))) (setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title)) (push (list :url (plist-get eww-data :url) :title title commit dd01e20628a846a9a75fcd0d6e38ac1c3e9687db Author: Mark Oteiza Date: Sun Nov 23 16:34:44 2014 +0100 (eww-mode-map): Bind backtab to shr-previous-link * net/eww.el (eww-mode-map): Bind backtab to shr-previous-link diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7937507..4b72eb8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-17 Mark Oteiza (tiny change) + + * net/eww.el (eww-mode-map): Bind backtab to shr-previous-link + 2014-11-23 Kenjiro Nakayama * net/eww.el (eww-set-character-encoding): New command and keystroke. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3c1621c..f2a1631 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -555,6 +555,7 @@ the like." (define-key map "g" 'eww-reload) (define-key map [?\t] 'shr-next-link) (define-key map [?\M-\t] 'shr-previous-link) + (define-key map [backtab] 'shr-previous-link) (define-key map [delete] 'scroll-down-command) (define-key map [?\S-\ ] 'scroll-down-command) (define-key map "\177" 'scroll-down-command) commit 7f223a582e586f69e034981925db9ad70d9d6965 Author: Kenjiro Nakayama Date: Sun Nov 23 16:30:40 2014 +0100 Allow setting the charset in eww Fixes: debbugs:16225 * net/eww.el (eww-set-character-encoding): New command and keystroke. (eww-display-raw): Use it. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4e5b79..7937507 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-23 Kenjiro Nakayama + + * net/eww.el (eww-set-character-encoding): New command and keystroke. + (eww-display-raw): Use it (bug#16225). + 2014-11-23 Lars Magne Ingebrigtsen * net/nsm.el (network-security-level): Rename from diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 6746668..3c1621c 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -241,7 +241,7 @@ See the `eww-search-prefix' variable for the search engine used." (interactive "r") (eww (buffer-substring beg end))) -(defun eww-render (status url &optional point buffer) +(defun eww-render (status url &optional point buffer encode) (let ((redirect (plist-get status :redirect))) (when redirect (setq url redirect))) @@ -255,7 +255,7 @@ See the `eww-search-prefix' variable for the search engine used." (or (cdr (assq 'charset (cdr content-type))) (eww-detect-charset (equal (car content-type) "text/html")) - "utf8")))) + "utf-8")))) (data-buffer (current-buffer))) (unwind-protect (progn @@ -265,14 +265,14 @@ See the `eww-search-prefix' variable for the search engine used." (car content-type))) (eww-browse-with-external-browser url)) ((equal (car content-type) "text/html") - (eww-display-html charset url nil point buffer)) + (eww-display-html charset url nil point buffer encode)) ((equal (car content-type) "application/pdf") (eww-display-pdf)) ((string-match-p "\\`image/" (car content-type)) (eww-display-image buffer) (eww-update-header-line-format)) (t - (eww-display-raw buffer) + (eww-display-raw buffer encode) (eww-update-header-line-format))) (plist-put eww-data :url url) (setq eww-history-position 0) @@ -308,7 +308,7 @@ See the `eww-search-prefix' variable for the search engine used." (declare-function libxml-parse-html-region "xml.c" (start end &optional base-url)) -(defun eww-display-html (charset url &optional document point buffer) +(defun eww-display-html (charset url &optional document point buffer encode) (or (fboundp 'libxml-parse-html-region) (error "This function requires Emacs to be compiled with libxml2")) ;; There should be a better way to abort loading images @@ -319,9 +319,9 @@ See the `eww-search-prefix' variable for the search engine used." (list 'base (list (cons 'href url)) (progn - (unless (eq charset 'utf-8) + (unless (eq charset encode) (condition-case nil - (decode-coding-region (point) (point-max) charset) + (decode-coding-region (point) (point-max) encode) (coding-system-error nil))) (libxml-parse-html-region (point) (point-max)))))) (source (and (null document) @@ -429,11 +429,16 @@ See the `eww-search-prefix' variable for the search engine used." (shr-generic cont) (shr-colorize-region start (point) fgcolor bgcolor))) -(defun eww-display-raw (&optional buffer) +(defun eww-display-raw (&optional buffer encode) (let ((data (buffer-substring (point) (point-max)))) (eww-setup-buffer buffer) (let ((inhibit-read-only t)) - (insert data)) + (insert data) + (unless (eq encode 'utf-8) + (encode-coding-region (point-min) (1+ (length data)) 'utf-8) + (condition-case nil + (decode-coding-region (point-min) (1+ (length data)) encode) + (coding-system-error nil)))) (goto-char (point-min)))) (defun eww-display-image (&optional buffer) @@ -567,6 +572,7 @@ the like." (define-key map "v" 'eww-view-source) (define-key map "R" 'eww-readable) (define-key map "H" 'eww-list-histories) + (define-key map "E" 'eww-set-character-encoding) (define-key map "b" 'eww-add-bookmark) (define-key map "B" 'eww-list-bookmarks) @@ -589,7 +595,8 @@ the like." ["List histories" eww-list-histories t] ["Add bookmark" eww-add-bookmark t] ["List bookmarks" eww-list-bookmarks t] - ["List cookies" url-cookie-list t])) + ["List cookies" url-cookie-list t] + ["Character Encoding" eww-set-character-encoding])) map)) (defvar eww-tool-bar-map @@ -700,12 +707,12 @@ appears in a or tag." (eww-browse-url (shr-expand-url best-url (plist-get eww-data :url))) (user-error "No `top' for this page")))) -(defun eww-reload () +(defun eww-reload (&optional encode) "Reload the current page." (interactive) (let ((url (plist-get eww-data :url))) (url-retrieve url 'eww-render - (list url (point) (current-buffer))))) + (list url (point) (current-buffer) encode)))) ;; Form support. @@ -1307,6 +1314,16 @@ Differences in #targets are ignored." (setq count (1+ count))) (expand-file-name file directory))) +(defun eww-set-character-encoding (encode) + "Set character encoding." + (interactive "sSet Character Encoding (default utf-8): ") + (cond ((zerop (length encode)) + (eww-reload 'utf-8)) + (t + (if (not (coding-system-p (intern encode))) + (user-error "Invalid encodeing type.") + (eww-reload (intern encode)))))) + ;;; Bookmarks code (defvar eww-bookmarks nil) commit b10d90066338c88a371fef1b59e2f455a37a3ba2 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 15:13:13 2014 +0100 Rename `nsm-security-level' to `network-security-level' * net/nsm.el (network-security-level): Rename from `nsm-security-level' and documented. diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 48429e6..3c9da5c 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2088,8 +2088,8 @@ entirely. If the connection is unencrypted, but it was encrypted in previous sessions, the user will also be notified about this. -@vindex nsm-security-level -The @code{nsm-security-level} variable determines the security level. +@vindex network-security-level +The @code{network-security-level} variable determines the security level. If this is @code{low}, no security checks are performed. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 34ac2d3..b4e5b79 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-11-23 Lars Magne Ingebrigtsen + * net/nsm.el (network-security-level): Rename from + `nsm-security-level' and documented. + * mail/smtpmail.el (smtpmail-via-smtp): Warn unless encrypted and we're sending a password. diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index f51201a..fdbcd13 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el @@ -34,8 +34,31 @@ :version "25.1" :group 'comm) -(defcustom nsm-security-level 'medium - "How secure the network should be." +(defcustom network-security-level 'low + "How secure the network should be. +If a potential problem with the security of the network +connection is found, the user is asked to give input into how the +connection should be handled. + +The following values are possible: + +`low': Absolutely no checks are performed. + +`medium': This is the default level, and the following things will +be prompted for. + +* invalid, self-signed or otherwise unverifiable certificates +* whether a previously accepted unverifiable certificate has changed +* when a connection that was previously protected by STARTTLS is + now unencrypted + +`high': In addition to the above. + +* any certificate that changes its public key + +`paranoid': In addition to the above. + +* any new certificate that you haven't seen before" :version "25.1" :group 'nsm :type '(choice (const :tag "Low" low) @@ -80,7 +103,7 @@ to keep track of the TLS status of STARTTLS servers. If WARN-UNENCRYPTED, query the user if the connection is unencrypted." - (if (eq nsm-security-level 'low) + (if (eq network-security-level 'low) process (let* ((status (gnutls-peer-status process)) (id (nsm-id host port)) @@ -108,21 +131,21 @@ unencrypted." ;; certificate pinning. ((null warnings) (cond - ((< (nsm-level nsm-security-level) (nsm-level 'high)) + ((< (nsm-level network-security-level) (nsm-level 'high)) process) ;; The certificate is fine, but if we're paranoid, we might ;; want to check whether it's changed anyway. - ((and (>= (nsm-level nsm-security-level) (nsm-level 'high)) + ((and (>= (nsm-level network-security-level) (nsm-level 'high)) (not (nsm-fingerprint-ok-p host port status settings))) (delete-process process) nil) ;; We haven't seen this before, and we're paranoid. - ((and (eq nsm-security-level 'paranoid) + ((and (eq network-security-level 'paranoid) (null settings) (not (nsm-new-fingerprint-ok-p host port status))) (delete-process process) nil) - ((>= (nsm-level nsm-security-level) (nsm-level 'high)) + ((>= (nsm-level network-security-level) (nsm-level 'high)) ;; Save the host fingerprint so that we can check it the ;; next time we connect. (nsm-save-host host port status 'fingerprint 'always) @@ -131,7 +154,7 @@ unencrypted." process))) ;; The certificate did not validate. - ((not (equal nsm-security-level 'low)) + ((not (equal network-security-level 'low)) ;; We always want to pin the certificate of invalid connections ;; to track man-in-the-middle or the like. (if (not (nsm-fingerprint-ok-p host port status settings)) commit a345ff6bf2af54db2ee03296965165127f7758ec Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 15:05:18 2014 +0100 Implement a new url parameter `url-request-noninteractive' * url-http.el (url-http): Respect `url-request-noninteractive'. * url-queue.el (url-queue-start-retrieve): Fetching through url-queue should always be noninteractive. * url-vars.el (url-request-noninteractive): New variable. diff --git a/etc/ChangeLog b/etc/ChangeLog index d57190f..867e4f5 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * NEWS: Mention `url-request-noninteractive'. + 2014-11-19 Leo Liu * NEWS: Mention new macro define-advice. diff --git a/etc/NEWS b/etc/NEWS index 769d2c6..a88902a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -262,14 +262,20 @@ plain text parts, if display of HTML email is possible; customize the ** In sh-mode, you can now use `sh-shell' as a file-local variable to specify the type of shell in use (bash, csh, etc). -** The URL package accepts now the protocols "ssh", "scp" and "rsync". +** URL + +*** The URL package accepts now the protocols "ssh", "scp" and "rsync". When `url-handler-mode' is enabled, file operations for these protocols as well as for "telnet" and "ftp" are passed to Tramp. -** The URL package allows customizing the `url-user-agent' string. +*** The URL package allows customizing the `url-user-agent' string. The new `url-user-agent' variable can be customized to be a string or a function. +*** The new interface variable `url-request-noninteractive' can be used +to specify that we're running in a noninteractive context, and that +we should not be queried about things like TLS certificate validity. + ** Tramp *** New connection method "nc", which allows to access dumb busyboxes. diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 1be4ca7..7ba9de0 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,12 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * url-http.el (url-http): Respect `url-request-noninteractive'. + + * url-queue.el (url-queue-start-retrieve): Fetching through + url-queue should always be noninteractive. + + * url-vars.el (url-request-noninteractive): New variable. + 2014-11-14 David Reitter * url-domsuf.el (url-domsuf-parse-file): Read compressed diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index a51785a..1001c4d 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -40,6 +40,7 @@ (defvar url-http-data) (defvar url-http-end-of-headers) (defvar url-http-extra-headers) +(defvar url-http-noninteractive) (defvar url-http-method) (defvar url-http-no-retry) (defvar url-http-process) @@ -1201,6 +1202,9 @@ overriding the value of `url-gateway-method'." (cl-check-type url vector "Need a pre-parsed URL.") (let* ((host (url-host (or url-using-proxy url))) (port (url-port (or url-using-proxy url))) + (nsm-noninteractive (or url-request-noninteractive + (and (boundp 'url-http-noninteractive) + url-http-noninteractive))) (connection (url-http-find-free-connection host port gateway-method)) (buffer (or retry-buffer (generate-new-buffer @@ -1232,6 +1236,7 @@ overriding the value of `url-gateway-method'." url-http-process url-http-method url-http-extra-headers + url-http-noninteractive url-http-data url-http-target-url url-http-no-retry @@ -1241,6 +1246,7 @@ overriding the value of `url-gateway-method'." (setq url-http-method (or url-request-method "GET") url-http-extra-headers url-request-extra-headers + url-http-noninteractive url-request-noninteractive url-http-data url-request-data url-http-process connection url-http-chunked-length nil diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el index 87469b9..9c4b402 100644 --- a/lisp/url/url-queue.el +++ b/lisp/url/url-queue.el @@ -133,10 +133,11 @@ The variable `url-queue-timeout' sets a timeout." (defun url-queue-start-retrieve (job) (setf (url-queue-buffer job) (ignore-errors - (url-retrieve (url-queue-url job) - #'url-queue-callback-function (list job) - (url-queue-silentp job) - (url-queue-inhibit-cookiesp job))))) + (let ((url-request-noninteractive t)) + (url-retrieve (url-queue-url job) + #'url-queue-callback-function (list job) + (url-queue-silentp job) + (url-queue-inhibit-cookiesp job)))))) (defun url-queue-prune-old-entries () (let (dead-jobs) diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 62b7b85..bc23b98 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -209,6 +209,9 @@ document." "A list of extra headers to send with the next request. Should be an assoc list of headers/contents.") +(defvar url-request-noninteractive nil + "If non-nil, the request is done in a noninteractive context.") + (defvar url-request-method nil "The method to use for the next request.") (defvar url-mime-encoding-string (and (fboundp 'zlib-available-p) commit c43b706ab3a699c107a91d1ab6f16014fff65b54 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 15:00:48 2014 +0100 Make some network connections warn unless they are encrypted * mail/smtpmail.el (smtpmail-via-smtp): Warn unless encrypted and we're sending a password. * pop3.el (pop3-open-server): Warn unless encrypted. * nnimap.el (nnimap-open-connection-1): Warn unless encrypted. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e503a6e..34ac2d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-11-23 Lars Magne Ingebrigtsen + * mail/smtpmail.el (smtpmail-via-smtp): Warn unless encrypted and + we're sending a password. + * net/nsm.el: New file that implements a Network Security Manager. * net/network-stream.el (open-network-stream): Add a new diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index f18565a..a3ce96c 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * pop3.el (pop3-open-server): Warn unless encrypted. + + * nnimap.el (nnimap-open-connection-1): Warn unless encrypted. + 2014-11-17 Albert Krewinkel * message.el (message-valid-fqdn-regexp): Add non-internaional new diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 7992151..45d10dd 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -405,6 +405,7 @@ textual parts.") "*nnimap*" (current-buffer) nnimap-address (nnimap-map-port (car ports)) :type nnimap-stream + :warn-unless-encrypted t :return-list t :shell-command nnimap-shell-program :capability-command "1 CAPABILITY\r\n" diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el index dfc646b..64a704f 100644 --- a/lisp/gnus/pop3.el +++ b/lisp/gnus/pop3.el @@ -561,6 +561,7 @@ Returns the process associated with the connection." 'tls) (t (or pop3-stream-type 'network))) + :warn-unless-encrypted t :capability-command "CAPA\r\n" :end-of-command "^\\(-ERR\\|+OK\\).*\n" :end-of-capability "^\\.\r?\n\\|^-ERR" diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 3440741..e70499f 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -687,6 +687,7 @@ Returns an error if the server cannot be contacted." "smtpmail" process-buffer host port :type smtpmail-stream-type :return-list t + :warn-unless-encrypted ask-for-password :capability-command (format "EHLO %s\r\n" (smtpmail-fqdn)) :end-of-command "^[0-9]+ .*\r\n" :success "^2.*\n" commit 4c298b2a73bda5ad99c1a7c2428b0db91e950820 Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 14:56:43 2014 +0100 Implement a Network Security Manager * processes.texi (Network): Mention the new :warn-unless-encrypted parameter to `open-network-stream'. (Network): Mention the Network Security Manager. * net/nsm.el: New file that implements a Network Security Manager. * net/network-stream.el (open-network-stream): Add a new :warn-unless-encrypted parameter. (network-stream-open-plain): Allow warning unless encrypted. (network-stream-open-starttls): Call the Network Security Manager. (network-stream-open-tls): Ditto. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 0c8792a..5cc85aa 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,9 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * processes.texi (Network): Mention the new :warn-unless-encrypted + parameter to `open-network-stream'. + (Network): Mention the Network Security Manager. + 2014-11-21 Ulf Jasper * text.texi (Parsing HTML/XML): Document new optional parameter diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index db80f05..48429e6 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2041,6 +2041,12 @@ Regular expression matching a successful @acronym{STARTTLS} negotiation. If non-@code{nil}, do opportunistic @acronym{STARTTLS} upgrades even if Emacs doesn't have built-in @acronym{TLS} support. +@item :warn-unless-encrypted @var{boolean} +If non-@code{nil}, and @code{:return-value} is also non-@code{nil}, +Emacs will warn if the connection isn't encrypted. This is useful for +protocols like @acronym{IMAP} and the like, where most users would +expect the network traffic to be encrypted. + @item :client-certificate @var{list-or-t} Either a list of the form @code{(@var{key-file} @var{cert-file})}, naming the certificate key file and certificate file itself, or @@ -2066,6 +2072,27 @@ The connection type: @samp{plain} or @samp{tls}. @end defun +@cindex Network Security Manager +After establishing the connection, the connection is then passed on to +the Network Security Manager (@acronym{NSM}). If the connection is a +@acronym{TLS} or @acronym{STARTTLS} connection, the @acronym{NSM} will +check whether the certificate used to establish the identity of the +server we're connecting to can be verified. If this can't be done, +the @acronym{NSM} will query the user whether to proceed with the +connection. + +The user is given the choice of registering a permanent security +exception, a temporary one, or whether to refuse the connection +entirely. + +If the connection is unencrypted, but it was encrypted in previous +sessions, the user will also be notified about this. + +@vindex nsm-security-level +The @code{nsm-security-level} variable determines the security level. +If this is @code{low}, no security checks are performed. + + @node Network Servers @section Network Servers @cindex network servers diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 43b3f9a..e503a6e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * net/nsm.el: New file that implements a Network Security Manager. + + * net/network-stream.el (open-network-stream): Add a new + :warn-unless-encrypted parameter. + (network-stream-open-plain): Allow warning unless encrypted. + (network-stream-open-starttls): Call the Network Security Manager. + (network-stream-open-tls): Ditto. + 2014-11-23 Leo Liu * calendar/cal-china.el (calendar-chinese-from-absolute-for-diary) diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 28e9d0c..a1e9729 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -45,6 +45,7 @@ (require 'tls) (require 'starttls) (require 'auth-source) +(require 'nsm) (autoload 'gnutls-negotiate "gnutls") (autoload 'open-gnutls-stream "gnutls") @@ -128,11 +129,14 @@ values: :use-starttls-if-possible is a boolean that says to do opportunistic STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality. +:warn-unless-encrypted is a boolean which, if :return-list is +non-nil, is used warn the user if the connection isn't encrypted. + :nogreeting is a boolean that can be used to inhibit waiting for a greeting from the server. :nowait is a boolean that says the connection should be made - asynchronously, if possible." +asynchronously, if possible." (unless (featurep 'make-network-process) (error "Emacs was compiled without networking support")) (let ((type (plist-get parameters :type)) @@ -196,6 +200,8 @@ a greeting from the server. (stream (make-network-process :name name :buffer buffer :host host :service service :nowait (plist-get parameters :nowait)))) + (when (plist-get parameters :warn-unless-encrypted) + (setq stream (nsm-verify-connection stream host service nil t))) (list stream (network-stream-get-response stream start (plist-get parameters :end-of-command)) @@ -319,6 +325,12 @@ a greeting from the server. "' program was found")))) (delete-process stream) (setq stream nil)) + ;; Check certificate validity etc. + (when builtin-starttls + (setq stream (nsm-verify-connection + stream host service + (eq resulting-type 'tls) + (plist-get parameters :warn-unless-encrypted)))) ;; Return value: (list stream greeting capabilities resulting-type error))) @@ -352,6 +364,9 @@ a greeting from the server. 'open-tls-stream) name buffer host service)) (eoc (plist-get parameters :end-of-command))) + ;; Check certificate validity etc. + (when (and use-builtin-gnutls stream) + (setq stream (nsm-verify-connection stream host service))) (if (null stream) (list nil nil nil 'plain) ;; If we're using tls.el, we have to delete the output from diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el new file mode 100644 index 0000000..f51201a --- /dev/null +++ b/lisp/net/nsm.el @@ -0,0 +1,409 @@ +;;; nsm.el --- Network Security Manager + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Lars Magne Ingebrigtsen +;; Keywords: encryption, security, network + +;; 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: + +;;; Code: + +(require 'cl-lib) + +(defvar nsm-permanent-host-settings nil) +(defvar nsm-temporary-host-settings nil) + +(defgroup nsm nil + "Network Security Manager" + :version "25.1" + :group 'comm) + +(defcustom nsm-security-level 'medium + "How secure the network should be." + :version "25.1" + :group 'nsm + :type '(choice (const :tag "Low" low) + (const :tag "Medium" medium) + (const :tag "High" high) + (const :tag "Paranoid" paranoid))) + +(defcustom nsm-settings-file (expand-file-name "network-security.data" + user-emacs-directory) + "The file the security manager settings will be stored in." + :version "25.1" + :group 'nsm + :type 'file) + +(defcustom nsm-save-host-names nil + "If non-nil, always save host names in the structures in `nsm-settings-file'. +By default, only hosts that have exceptions have their names +stored in plain text." + :version "25.1" + :group 'nsm + :type 'boolean) + +(defvar nsm-noninteractive nil + "If non-nil, the connection is opened in a non-interactive context. +This means that no queries should be performed.") + +(defun nsm-verify-connection (process host port &optional + save-fingerprint warn-unencrypted) + "Verify the security status of PROCESS that's connected to HOST:PORT. +If PROCESS is a gnutls connection, the certificate validity will +be examined. If it's a non-TLS connection, it may be compared +against previous connections. If the function determines that +there is something odd about the connection, the user will be +queried about what to do about it. + +The process it returned if everything is OK, and otherwise, the +process will be deleted and nil is returned. + +If SAVE-FINGERPRINT, always save the fingerprint of the +server (if the connection is a TLS connection). This is useful +to keep track of the TLS status of STARTTLS servers. + +If WARN-UNENCRYPTED, query the user if the connection is +unencrypted." + (if (eq nsm-security-level 'low) + process + (let* ((status (gnutls-peer-status process)) + (id (nsm-id host port)) + (settings (nsm-host-settings id))) + (cond + ((not (process-live-p process)) + nil) + ((not status) + ;; This is a non-TLS connection. + (nsm-check-plain-connection process host port settings + warn-unencrypted)) + (t + (let ((process + (nsm-check-tls-connection process host port status settings))) + (when (and process save-fingerprint + (null (nsm-host-settings id))) + (nsm-save-host host port status 'fingerprint 'always)) + process)))))) + +(defun nsm-check-tls-connection (process host port status settings) + (let ((warnings (plist-get status :warnings))) + (cond + + ;; The certificate validated, but perhaps we want to do + ;; certificate pinning. + ((null warnings) + (cond + ((< (nsm-level nsm-security-level) (nsm-level 'high)) + process) + ;; The certificate is fine, but if we're paranoid, we might + ;; want to check whether it's changed anyway. + ((and (>= (nsm-level nsm-security-level) (nsm-level 'high)) + (not (nsm-fingerprint-ok-p host port status settings))) + (delete-process process) + nil) + ;; We haven't seen this before, and we're paranoid. + ((and (eq nsm-security-level 'paranoid) + (null settings) + (not (nsm-new-fingerprint-ok-p host port status))) + (delete-process process) + nil) + ((>= (nsm-level nsm-security-level) (nsm-level 'high)) + ;; Save the host fingerprint so that we can check it the + ;; next time we connect. + (nsm-save-host host port status 'fingerprint 'always) + process) + (t + process))) + + ;; The certificate did not validate. + ((not (equal nsm-security-level 'low)) + ;; We always want to pin the certificate of invalid connections + ;; to track man-in-the-middle or the like. + (if (not (nsm-fingerprint-ok-p host port status settings)) + (progn + (delete-process process) + nil) + ;; We have a warning, so query the user. + (if (and (not (nsm-warnings-ok-p status settings)) + (not (nsm-query + host port status 'conditions + "The TLS connection to %s:%s is insecure\nfor the following reason%s:\n\n%s" + host port + (if (> (length warnings) 1) + "s" "") + (mapconcat 'cadr warnings "\n")))) + (progn + (delete-process process) + nil) + process)))))) + +(defun nsm-fingerprint (status) + (plist-get (plist-get status :certificate) :public-key-id)) + +(defun nsm-fingerprint-ok-p (host port status settings) + (let ((did-query nil)) + (if (and settings + (not (eq (plist-get settings :fingerprint) :none)) + (not (equal (nsm-fingerprint status) + (plist-get settings :fingerprint))) + (not + (setq did-query + (nsm-query + host port status 'fingerprint + "The fingerprint for the connection to %s:%s has changed from\n%s to\n%s" + host port + (plist-get settings :fingerprint) + (nsm-fingerprint status))))) + ;; Not OK. + nil + (when did-query + ;; Remove any exceptions that have been set on the previous + ;; certificate. + (plist-put settings :conditions nil)) + t))) + +(defun nsm-new-fingerprint-ok-p (host port status) + (nsm-query + host port nil 'fingerprint + "The fingerprint for the connection to %s:%s is new:\n%s" + host port + (nsm-fingerprint status))) + +(defun nsm-check-plain-connection (process host port settings warn-unencrypted) + ;; If this connection used to be TLS, but is now plain, then it's + ;; possible that we're being Man-In-The-Middled by a proxy that's + ;; stripping out STARTTLS announcements. + (cond + ((and (plist-get settings :fingerprint) + (not (eq (plist-get settings :fingerprint) :none)) + (not + (nsm-query + host port nil 'conditions + "The connection to %s:%s used to be an encrypted\nconnection, but is now unencrypted. This might mean that there's a\nman-in-the-middle tapping this connection." + host port))) + (delete-process process) + nil) + ((and warn-unencrypted + (not (memq :unencrypted (plist-get settings :conditions))) + (not (nsm-query + host port nil 'conditions + "The connection to %s:%s is unencrypted." + host port))) + (delete-process process) + nil) + (t + process))) + +(defun nsm-query (host port status what message &rest args) + ;; If there is no user to answer queries, then say `no' to everything. + (if (or noninteractive + nsm-noninteractive) + nil + (let ((response + (condition-case nil + (nsm-query-user message args (nsm-format-certificate status)) + ;; Make sure we manage to close the process if the user hits + ;; `C-g'. + (quit 'no) + (error 'no)))) + (if (eq response 'no) + nil + (nsm-save-host host port status what response) + t)))) + +(defun nsm-query-user (message args cert) + (let ((buffer (get-buffer-create "*Network Security Manager*"))) + (with-help-window buffer + (with-current-buffer buffer + (erase-buffer) + (when (> (length cert) 0) + (insert cert "\n")) + (insert (apply 'format message args)))) + (let ((responses '((?n . no) + (?s . session) + (?a . always))) + (prefix "") + response) + (while (not response) + (setq response + (cdr + (assq (downcase + (read-char + (concat prefix + "Continue connecting? (No, Session only, Always)"))) + responses))) + (unless response + (ding) + (setq prefix "Invalid choice. "))) + (kill-buffer buffer) + ;; If called from a callback, `read-char' will insert things + ;; into the pending input. Clear that. + (clear-this-command-keys) + response))) + +(defun nsm-save-host (host port status what permanency) + (let* ((id (nsm-id host port)) + (saved + (list :id id + :fingerprint (or (nsm-fingerprint status) + ;; Plain connection. + :none)))) + (when (or (eq what 'conditions) + nsm-save-host-names) + (nconc saved (list :host (format "%s:%s" host port)))) + ;; We either want to save/update the fingerprint or the conditions + ;; of the certificate/unencrypted connection. + (when (eq what 'conditions) + (nconc saved (list :host (format "%s:%s" host port))) + (cond + ((not status) + (nconc saved `(:conditions (:unencrypted)))) + ((plist-get status :warnings) + (nconc saved + `(:conditions ,(mapcar 'car (plist-get status :warnings))))))) + (if (eq permanency 'always) + (progn + (nsm-remove-temporary-setting id) + (nsm-remove-permanent-setting id) + (push saved nsm-permanent-host-settings) + (nsm-write-settings)) + (nsm-remove-temporary-setting id) + (push saved nsm-temporary-host-settings)))) + +(defun nsm-write-settings () + (with-temp-file nsm-settings-file + (insert "(\n") + (dolist (setting nsm-permanent-host-settings) + (insert " ") + (prin1 setting (current-buffer)) + (insert "\n")) + (insert ")\n"))) + +(defun nsm-read-settings () + (setq nsm-permanent-host-settings + (with-temp-buffer + (insert-file-contents nsm-settings-file) + (goto-char (point-min)) + (ignore-errors (read (current-buffer)))))) + +(defun nsm-id (host port) + (concat "sha1:" (sha1 (format "%s:%s" host port)))) + +(defun nsm-host-settings (id) + (when (and (not nsm-permanent-host-settings) + (file-exists-p nsm-settings-file)) + (nsm-read-settings)) + (let ((result nil)) + (dolist (elem (append nsm-temporary-host-settings + nsm-permanent-host-settings)) + (when (and (not result) + (equal (plist-get elem :id) id)) + (setq result elem))) + result)) + +(defun nsm-warnings-ok-p (status settings) + (let ((not-ok nil) + (conditions (plist-get settings :conditions))) + (dolist (warning (plist-get status :warnings)) + (when (memq (car warning) conditions) + (setq not-ok t))) + not-ok)) + +(defun nsm-remove-permanent-setting (id) + (setq nsm-permanent-host-settings + (cl-delete-if + (lambda (elem) + (equal (plist-get elem :id) id)) + nsm-permanent-host-settings))) + +(defun nsm-remove-temporary-setting (id) + (setq nsm-temporary-host-settings + (cl-delete-if + (lambda (elem) + (equal (plist-get elem :id) id)) + nsm-temporary-host-settings))) + +(defun nsm-format-certificate (status) + (let ((cert (plist-get status :certificate))) + (when cert + (with-temp-buffer + (insert + "Certificate information\n" + "Issued by:" + (nsm-certificate-part (plist-get cert :issuer) "CN" t) "\n" + "Issued to:" + (or (nsm-certificate-part (plist-get cert :subject) "O") + (nsm-certificate-part (plist-get cert :subject) "OU" t)) + "\n" + "Hostname:" + (nsm-certificate-part (plist-get cert :subject) "CN" t) "\n" + "Public key:" (plist-get cert :public-key-algorithm) + ", signature: " (plist-get cert :signature-algorithm) "\n" + "Security level:" + (propertize (plist-get cert :certificate-security-level) + 'face 'bold) + "\n" + "Valid:From " (plist-get cert :valid-from) + " to " (plist-get cert :valid-to) "\n\n") + (goto-char (point-min)) + (while (re-search-forward "^[^:]+:" nil t) + (insert (make-string (- 20 (current-column)) ? ))) + (buffer-string))))) + +(defun nsm-certificate-part (string part &optional full) + (let ((part (cadr (assoc part (nsm-parse-subject string))))) + (cond + (part part) + (full string) + (t nil)))) + +(defun nsm-parse-subject (string) + (with-temp-buffer + (insert string) + (goto-char (point-min)) + (let ((start (point)) + (result nil)) + (while (not (eobp)) + (push (replace-regexp-in-string + "[\\]\\(.\\)" "\\1" + (buffer-substring start + (if (re-search-forward "[^\\]," nil 'move) + (1- (point)) + (point)))) + result) + (setq start (point))) + (mapcar + (lambda (elem) + (let ((pos (cl-position ?= elem))) + (if pos + (list (substring elem 0 pos) + (substring elem (1+ pos))) + elem))) + (nreverse result))))) + +(defun nsm-level (symbol) + "Return a numerical level for SYMBOL for easier comparison." + (cond + ((eq symbol 'low) 0) + ((eq symbol 'medium) 1) + ((eq symbol 'high) 2) + (t 3))) + +(provide 'nsm) + +;;; nsm.el ends here commit a85950469e6fc045de6157f9ad739e28f30ecd8d Author: Lars Magne Ingebrigtsen Date: Sun Nov 23 14:52:04 2014 +0100 Add functions to gnutls.c for exporting certificate details * gnutls.c (gnutls_hex_string, gnutls_certificate_details) (Fgnutls_peer_status): New functions to export TLS certificate details to Emacs Lisp. * process.h: Added more fields to Lisp_Process to track certificate details. * gnutls.c (Fgnutls_boot): Save certificate for later inspection. diff --git a/src/ChangeLog b/src/ChangeLog index b75b2f7..10ef4fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * gnutls.c (Fgnutls_boot): Save certificate for later inspection. + + * process.h: Added more fields to Lisp_Process to track + certificate details. + + * gnutls.c (gnutls_hex_string, gnutls_certificate_details) + (Fgnutls_peer_status): New functions to export TLS certificate + details to Emacs Lisp. + 2014-11-23 Jan Djärv * gtkutil.c (gtk_adjustment_configure): Define for Gtk+ < 2.14. diff --git a/src/gnutls.c b/src/gnutls.c index 5d48f78..37d797a 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -18,6 +18,7 @@ along with GNU Emacs. If not, see . */ #include #include +#include #include "lisp.h" #include "process.h" @@ -61,6 +62,11 @@ static void gnutls_log_function2 (int, const char *, const char *); static void gnutls_audit_log_function (gnutls_session_t, const char *); #endif +static enum + { + CERTIFICATE_NOT_MATCHING = 2, + } extra_peer_verification_t; + #ifdef WINDOWSNT @@ -146,6 +152,40 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import, (gnutls_x509_crt_t, const gnutls_datum_t *, gnutls_x509_crt_fmt_t)); DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_fingerprint, + (gnutls_digest_algorithm_t, + const gnutls_datum_t*, void *, size_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_version, + (gnutls_x509_crt_t)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_serial, + (gnutls_x509_crt_t, void *, size_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_issuer_dn, + (gnutls_x509_crt_t, char *, size_t *)); +DEF_GNUTLS_FN (time_t, gnutls_x509_crt_get_activation_time, + (gnutls_x509_crt_t)); +DEF_GNUTLS_FN (time_t, gnutls_x509_crt_get_expiration_time, + (gnutls_x509_crt_t)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_dn, + (gnutls_x509_crt_t, char *, size_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_pk_algorithm, + (gnutls_x509_crt_t, unsigned int *)); +DEF_GNUTLS_FN (int, gnutls_pk_algorithm_get_name, (gnutls_pk_algorithm_t)); +DEF_GNUTLS_FN (int, gnutls_pk_bits_to_sec_param, + (gnutls_pk_algorithm_t, unsigned int)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_issuer_unique_id, + (gnutls_x509_crt_t, char *, size_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_subject_unique_id, + (gnutls_x509_crt_t, char *, size_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_signature_algorithm, + (gnutls_x509_crt_t)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_signature, + (gnutls_x509_crt_t, char *, size_t *)); +DEF_GNUTLS_FN (int, gnutls_x509_crt_get_key_id, + (gnutls_x509_crt_t, unsigned int, + unsigned char *, size_t *_size)); +DEF_GNUTLS_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t)); +DEF_GNUTLS_FN (const char*, gnutls_sign_algorithm_get_name, + (gnutls_sign_algorithm_t)); static bool init_gnutls_functions (void) @@ -205,6 +245,23 @@ init_gnutls_functions (void) LOAD_GNUTLS_FN (library, gnutls_x509_crt_deinit); LOAD_GNUTLS_FN (library, gnutls_x509_crt_import); LOAD_GNUTLS_FN (library, gnutls_x509_crt_init); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_fingerprint); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_version); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_serial); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_issuer_dn); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_activation_time); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_expiration_time); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_dn); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_pk_algorithm); + LOAD_GNUTLS_FN (library, gnutls_pk_algorithm_get_name); + LOAD_GNUTLS_FN (library, gnutls_pk_bits_to_sec_param); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_issuer_unique_id); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_subject_unique_id); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_signature_algorithm); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_signature); + LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_key_id); + LOAD_GNUTLS_FN (library, gnutls_sec_param_get_name); + LOAD_GNUTLS_FN (library, gnutls_sign_algorithm_get_name); max_log_level = global_gnutls_log_level; @@ -260,6 +317,23 @@ init_gnutls_functions (void) #define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit #define fn_gnutls_x509_crt_import gnutls_x509_crt_import #define fn_gnutls_x509_crt_init gnutls_x509_crt_init +#define fn_gnutls_x509_crt_get_fingerprint gnutls_x509_crt_get_fingerprint +#define fn_gnutls_x509_crt_get_version gnutls_x509_crt_get_version +#define fn_gnutls_x509_crt_get_serial gnutls_x509_crt_get_serial +#define fn_gnutls_x509_crt_get_issuer_dn gnutls_x509_crt_get_issuer_dn +#define fn_gnutls_x509_crt_get_activation_time gnutls_x509_crt_get_activation_time +#define fn_gnutls_x509_crt_get_expiration_time gnutls_x509_crt_get_expiration_time +#define fn_gnutls_x509_crt_get_dn gnutls_x509_crt_get_dn +#define fn_gnutls_x509_crt_get_pk_algorithm gnutls_x509_crt_get_pk_algorithm +#define fn_gnutls_pk_algorithm_get_name gnutls_pk_algorithm_get_name +#define fn_gnutls_pk_bits_to_sec_param gnutls_pk_bits_to_sec_param +#define fn_gnutls_x509_crt_get_issuer_unique_id gnutls_x509_crt_get_issuer_unique_id +#define fn_gnutls_x509_crt_get_subject_unique_id gnutls_x509_crt_get_subject_unique_id +#define fn_gnutls_x509_crt_get_signature_algorithm gnutls_x509_crt_get_signature_algorithm +#define fn_gnutls_x509_crt_get_signature gnutls_x509_crt_get_signature +#define fn_gnutls_x509_crt_get_key_id gnutls_x509_crt_get_key_id +#define fn_gnutls_sec_param_get_name gnutls_sec_param_get_name +#define fn_gnutls_sign_algorithm_get_name gnutls_sign_algorithm_get_name #endif /* !WINDOWSNT */ @@ -693,6 +767,273 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, #endif } +Lisp_Object +gnutls_hex_string (char *buf, size_t buf_size, char *prefix) { + size_t prefix_length = strlen (prefix); + char *string = malloc (buf_size * 3 + prefix_length); + Lisp_Object ret; + + strcpy (string, prefix); + + for (int i = 0; i < buf_size; i++) + sprintf (string + i * 3 + prefix_length, + i == buf_size - 1? "%02x": "%02x:", + ((unsigned char*)buf)[i]); + + ret = build_string (string); + free (string); + return ret; +} + +Lisp_Object +gnutls_certificate_details (gnutls_x509_crt_t cert) +{ + Lisp_Object res = Qnil; + int err; + + /* Version. */ + { + int version = fn_gnutls_x509_crt_get_version (cert); + if (version >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":version"), + make_number (version))); + } + + /* Serial. */ + { + size_t serial_size = 0; + + err = fn_gnutls_x509_crt_get_serial (cert, NULL, &serial_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *serial = malloc (serial_size); + err = fn_gnutls_x509_crt_get_serial (cert, serial, &serial_size); + if (err >= GNUTLS_E_SUCCESS) { + res = nconc2 (res, list2 (intern (":serial-number"), + gnutls_hex_string (serial, serial_size, ""))); + } + free (serial); + } + } + + /* Issuer. */ + { + size_t dn_size = 0; + + err = fn_gnutls_x509_crt_get_issuer_dn (cert, NULL, &dn_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *dn = malloc (dn_size); + err = fn_gnutls_x509_crt_get_issuer_dn (cert, dn, &dn_size); + if (err >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":issuer"), + make_string (dn, dn_size))); + free (dn); + } + } + + /* Validity. */ + { + char buf[11]; + size_t buf_size = sizeof (buf); + struct tm t; + time_t tim = fn_gnutls_x509_crt_get_activation_time (cert); + + if (gmtime_r (&tim, &t) != NULL && + strftime (buf, buf_size, "%Y-%m-%d", &t) != 0) + res = nconc2 (res, list2 (intern (":valid-from"), build_string (buf))); + + tim = fn_gnutls_x509_crt_get_expiration_time (cert); + if (gmtime_r (&tim, &t) != NULL && + strftime (buf, buf_size, "%Y-%m-%d", &t) != 0) + res = nconc2 (res, list2 (intern (":valid-to"), build_string (buf))); + } + + /* Subject. */ + { + size_t dn_size = 0; + + err = fn_gnutls_x509_crt_get_dn (cert, NULL, &dn_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *dn = malloc (dn_size); + err = fn_gnutls_x509_crt_get_dn (cert, dn, &dn_size); + if (err >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":subject"), + make_string (dn, dn_size))); + free (dn); + } + } + + /* SubjectPublicKeyInfo. */ + { + unsigned int bits; + + err = fn_gnutls_x509_crt_get_pk_algorithm (cert, &bits); + if (err >= GNUTLS_E_SUCCESS) { + const char *name = fn_gnutls_pk_algorithm_get_name (err); + if (name) + res = nconc2 (res, list2 (intern (":public-key-algorithm"), + build_string (name))); + + name = fn_gnutls_sec_param_get_name (fn_gnutls_pk_bits_to_sec_param + (err, bits)); + res = nconc2 (res, list2 (intern (":certificate-security-level"), + build_string (name))); + } + } + + /* Unique IDs. */ + { + size_t buf_size = 0; + + err = fn_gnutls_x509_crt_get_issuer_unique_id (cert, NULL, &buf_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *buf = malloc (buf_size); + err = fn_gnutls_x509_crt_get_issuer_unique_id (cert, buf, &buf_size); + if (err >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":issuer-unique-id"), + make_string (buf, buf_size))); + free (buf); + } + + buf_size = 0; + err = fn_gnutls_x509_crt_get_subject_unique_id (cert, NULL, &buf_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *buf = malloc (buf_size); + err = fn_gnutls_x509_crt_get_subject_unique_id (cert, buf, &buf_size); + if (err >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":subject-unique-id"), + make_string (buf, buf_size))); + free (buf); + } + } + + /* Signature. */ + { + size_t buf_size = 0; + + err = fn_gnutls_x509_crt_get_signature_algorithm (cert); + if (err >= GNUTLS_E_SUCCESS) { + const char *name = fn_gnutls_sign_algorithm_get_name (err); + if (name) + res = nconc2 (res, list2 (intern (":signature-algorithm"), + build_string (name))); + + err = fn_gnutls_x509_crt_get_signature (cert, NULL, &buf_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *buf = malloc (buf_size); + err = fn_gnutls_x509_crt_get_signature (cert, buf, &buf_size); + if (err >= GNUTLS_E_SUCCESS) { + res = nconc2 (res, list2 (intern (":signature"), + gnutls_hex_string (buf, buf_size, ""))); + } + free (buf); + } + } + } + + /* Public key ID. */ + { + size_t buf_size = 0; + + err = fn_gnutls_x509_crt_get_key_id (cert, 0, NULL, &buf_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + unsigned char *buf = malloc (buf_size); + err = fn_gnutls_x509_crt_get_key_id (cert, 0, buf, &buf_size); + if (err >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":public-key-id"), + gnutls_hex_string ((char *)buf, + buf_size, "sha1:"))); + free (buf); + } + } + + /* Certificate fingerprint. */ + { + size_t buf_size = 0; + + err = fn_gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, + NULL, &buf_size); + if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) { + unsigned char *buf = malloc (buf_size); + err = fn_gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, + buf, &buf_size); + if (err >= GNUTLS_E_SUCCESS) + res = nconc2 (res, list2 (intern (":certificate-id"), + gnutls_hex_string ((char *)buf, + buf_size, "sha1:"))); + free (buf); + } + } + + return res; +} + +DEFUN ("gnutls-peer-status", Fgnutls_peer_status, Sgnutls_peer_status, 1, 1, 0, + doc: /* Return the status of the gnutls PROC peer certificate. +The return value is a property list. */) + (Lisp_Object proc) +{ + Lisp_Object warnings = Qnil, result = Qnil; + unsigned int verification; + + CHECK_PROCESS (proc); + + if (XPROCESS (proc)->gnutls_p == 0) + return Qnil; + + /* Then collect any warnings already computed by the handshake. */ + verification = XPROCESS (proc)->gnutls_peer_verification; + + if (verification & GNUTLS_CERT_INVALID) + warnings = Fcons (list2 (intern (":invalid"), + build_string("certificate could not be verified")), + warnings); + + if (verification & GNUTLS_CERT_REVOKED) + warnings = Fcons (list2 (intern (":revoked"), + build_string("certificate was revoked (CRL)")), + warnings); + + if (verification & GNUTLS_CERT_SIGNER_NOT_FOUND) + warnings = Fcons (list2 (intern (":self-signed"), + build_string("certificate signer was not found (self-signed)")), + warnings); + + if (verification & GNUTLS_CERT_SIGNER_NOT_CA) + warnings = Fcons (list2 (intern (":not-ca"), + build_string("certificate signer is not a CA")), + warnings); + + if (verification & GNUTLS_CERT_INSECURE_ALGORITHM) + warnings = Fcons (list2 (intern (":insecure"), + build_string("certificate was signed with an insecure algorithm")), + warnings); + + if (verification & GNUTLS_CERT_NOT_ACTIVATED) + warnings = Fcons (list2 (intern (":not-activated"), + build_string("certificate is not yet activated")), + warnings); + + if (verification & GNUTLS_CERT_EXPIRED) + warnings = Fcons (list2 (intern (":expired"), + build_string("certificate has expired")), + warnings); + + if (XPROCESS (proc)->gnutls_extra_peer_verification & + CERTIFICATE_NOT_MATCHING) + warnings = Fcons (list2 (intern (":no-host-match"), + build_string("certificate host does not match hostname")), + warnings); + + if (!NILP (warnings)) + result = list2 (intern (":warnings"), warnings); + + result = nconc2 (result, list2 + (intern (":certificate"), + gnutls_certificate_details(XPROCESS (proc)->gnutls_certificate))); + + return result; +} + /* Initializes global GnuTLS state to defaults. Call `gnutls-global-deinit' when GnuTLS usage is no longer needed. @@ -1048,6 +1389,8 @@ one trustfile (usually a CA bundle). */) if (ret < GNUTLS_E_SUCCESS) return gnutls_make_error (ret); + XPROCESS (proc)->gnutls_peer_verification = peer_verification; + if (XINT (loglevel) > 0 && peer_verification & GNUTLS_CERT_INVALID) message ("%s certificate could not be verified.", c_hostname); @@ -1126,8 +1469,12 @@ one trustfile (usually a CA bundle). */) return gnutls_make_error (ret); } + XPROCESS (proc)->gnutls_certificate = gnutls_verify_cert; + if (!fn_gnutls_x509_crt_check_hostname (gnutls_verify_cert, c_hostname)) { + XPROCESS (proc)->gnutls_extra_peer_verification |= + CERTIFICATE_NOT_MATCHING; if (verify_error_all || !NILP (Fmember (QCgnutls_bootprop_hostname, verify_error))) { @@ -1141,7 +1488,6 @@ one trustfile (usually a CA bundle). */) c_hostname); } } - fn_gnutls_x509_crt_deinit (gnutls_verify_cert); } /* Set this flag only if the whole initialization succeeded. */ @@ -1173,6 +1519,8 @@ This function may also return `gnutls-e-again', or state = XPROCESS (proc)->gnutls_state; + fn_gnutls_x509_crt_deinit (XPROCESS (proc)->gnutls_certificate); + ret = fn_gnutls_bye (state, NILP (cont) ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR); @@ -1224,6 +1572,7 @@ syms_of_gnutls (void) defsubr (&Sgnutls_deinit); defsubr (&Sgnutls_bye); defsubr (&Sgnutls_available_p); + defsubr (&Sgnutls_peer_status); DEFVAR_INT ("gnutls-log-level", global_gnutls_log_level, doc: /* Logging level used by the GnuTLS functions. diff --git a/src/process.h b/src/process.h index 273ad92..56c0f6d 100644 --- a/src/process.h +++ b/src/process.h @@ -162,6 +162,9 @@ struct Lisp_Process gnutls_session_t gnutls_state; gnutls_certificate_client_credentials gnutls_x509_cred; gnutls_anon_client_credentials_t gnutls_anon_cred; + gnutls_x509_crt_t gnutls_certificate; + unsigned int gnutls_peer_verification; + unsigned int gnutls_extra_peer_verification; int gnutls_log_level; int gnutls_handshakes_tried; bool_bf gnutls_p : 1; commit 0b1d7cd596b9784584812d1bde8aa2d376891cdb Author: Jan D Date: Sun Nov 23 14:30:52 2014 +0100 Fixes: debbugs:19149 * gtkutil.c (gtk_adjustment_configure): Don't use 2.14 functions (Bug#19149). diff --git a/src/ChangeLog b/src/ChangeLog index 50cbc2a..b75b2f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * gtkutil.c (gtk_adjustment_configure): Define for Gtk+ < 2.14. (xg_set_toolkit_horizontal_scroll_bar_thumb): Remove wrong version check for gtk_adjustment_configure (Bug#19149). + (gtk_adjustment_configure): Don't use 2.14 functions (Bug#19149). 2014-11-22 Glenn Morris diff --git a/src/gtkutil.c b/src/gtkutil.c index 035e5af..9465d54 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -80,16 +80,16 @@ along with GNU Emacs. If not, see . */ #endif #if ! GTK_CHECK_VERSION (2, 14, 0) -#define gtk_adjustment_configure(adj, value, lower, \ - upper, step_increment, \ - page_increment, pagesize) \ - do { \ - gtk_adjustment_set_lower (adj, lower); \ - gtk_adjustment_set_upper (adj, upper); \ - gtk_adjustment_set_page_size (adj, pagesize); \ - gtk_adjustment_set_value (adj, value); \ - gtk_adjustment_set_page_increment (adj, page_increment); \ - gtk_adjustment_set_step_increment (adj, step_increment); \ +#define gtk_adjustment_configure(adj, xvalue, xlower, \ + xupper, xstep_increment, \ + xpage_increment, xpagesize) \ + do { \ + adj->lower = xlower; \ + adj->upper = xupper; \ + adj->page_size = xpagesize; \ + gtk_adjustment_set_value (adj, xvalue); \ + adj->page_increment = xpage_increment; \ + adj->step_increment = xstep_increment; \ } while (0) #endif /* < Gtk+ 2.14 */ commit 600f3d0528bf9acfea89985755d94e05a78df341 Author: Michael Albinus Date: Sun Nov 23 12:33:45 2014 +0100 * tramp.texi (Remote processes): Let-bind environment variables to `process-environment' when running `process-file' or `start-file-process'. diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 0e9300a..e9029d5 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-23 Michael Albinus + + * tramp.texi (Remote processes): Let-bind environment variables to + `process-environment' when running `process-file' or + `start-file-process'. + 2014-11-19 Ivan Shmakov * eww.texi (Basics): Document `eww-history-limit'. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index a245de8..8eb25c6 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2711,6 +2711,21 @@ following code in your @file{.emacs}: (setq tramp-remote-process-environment process-environment)) @end lisp +When running @code{process-file} or @code{start-file-process} on a +remote @code{default-directory}, the default settings in +@code{process-environment} are not used as it is the case for local +processes. However, if you need environment variables other than set +in @code{tramp-remote-process-environment}, you can let-bind them to +@code{process-environment}. Only those variables will be set then: + +@lisp +(let ((process-environment (cons "HGPLAIN=1" process-environment))) + (process-file @dots{})) +@end lisp + +This works only for environment variables which are not set already in +@code{process-environment}. + If you use other @value{emacsname} packages which do not run out-of-the-box on a remote host, please let us know. We will try to integrate them as well. @xref{Bug Reports}. commit 4ad0a308551e02fc8d2d6cf57403888c10ab50ad Author: Jan D Date: Sun Nov 23 11:57:19 2014 +0100 Fixes: debbugs:19149 * gtkutil.c (gtk_adjustment_configure): Define for Gtk+ < 2.14. (xg_set_toolkit_horizontal_scroll_bar_thumb): Remove wrong version check for gtk_adjustment_configure (Bug#19149). diff --git a/src/ChangeLog b/src/ChangeLog index a474398..50cbc2a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-11-23 Jan Djärv + + * gtkutil.c (gtk_adjustment_configure): Define for Gtk+ < 2.14. + (xg_set_toolkit_horizontal_scroll_bar_thumb): Remove wrong version + check for gtk_adjustment_configure (Bug#19149). + 2014-11-22 Glenn Morris * Makefile.in (emacs.res): Add dependency on icons/hand.cur. Use $<. diff --git a/src/gtkutil.c b/src/gtkutil.c index 6db8858..035e5af 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -79,6 +79,20 @@ along with GNU Emacs. If not, see . */ #define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) #endif +#if ! GTK_CHECK_VERSION (2, 14, 0) +#define gtk_adjustment_configure(adj, value, lower, \ + upper, step_increment, \ + page_increment, pagesize) \ + do { \ + gtk_adjustment_set_lower (adj, lower); \ + gtk_adjustment_set_upper (adj, upper); \ + gtk_adjustment_set_page_size (adj, pagesize); \ + gtk_adjustment_set_value (adj, value); \ + gtk_adjustment_set_page_increment (adj, page_increment); \ + gtk_adjustment_set_step_increment (adj, step_increment); \ + } while (0) +#endif /* < Gtk+ 2.14 */ + #ifdef HAVE_FREETYPE #if GTK_CHECK_VERSION (3, 2, 0) #define USE_NEW_GTK_FONT_CHOOSER 1 @@ -3938,18 +3952,9 @@ xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, block_input (); adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); -#if GTK_CHECK_VERSION (2, 3, 16) gtk_adjustment_configure (adj, (gdouble) value, (gdouble) lower, (gdouble) upper, (gdouble) step_increment, (gdouble) page_increment, (gdouble) pagesize); -#else - gtk_adjustment_set_lower (adj, (gdouble) lower); - gtk_adjustment_set_upper (adj, (gdouble) upper); - gtk_adjustment_set_page_size (adj, (gdouble) pagesize); - gtk_adjustment_set_value (adj, (gdouble) value); - gtk_adjustment_set_page_increment (adj, (gdouble) page_increment); - gtk_adjustment_set_step_increment (adj, (gdouble) step_increment); -#endif gtk_adjustment_changed (adj); unblock_input (); } commit b1d07e31d0acf7c8e831e443aaebfbc372955ce7 Author: Michael Albinus Date: Sun Nov 23 10:07:00 2014 +0100 * erc-desktop-notifications.el (erc-notifications-bus): Change version to 25.1. diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index c8945cf..323788e 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -48,7 +48,7 @@ (defcustom erc-notifications-bus :session "D-Bus bus to use for notification." - :version "24.5" + :version "25.1" :group 'erc-notifications :type '(choice (const :tag "Session bus" :session) string)) commit 1b3e992e3945f19716f9088a26ce32807f07f301 Merge: 709a517 9c33811 Author: Michael Albinus Date: Sun Nov 23 10:01:18 2014 +0100 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 709a5173cd98d1e67724d1d02c437fa63681c3b6 Author: Michael Albinus Date: Sun Nov 23 10:00:28 2014 +0100 * erc-desktop-notifications.el (erc-notifications-bus): New customer option. Supports cases when Emacs hasn't been invoked in the same environment where the notifications shall go to. (erc-notifications-notify): Use it. diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 9b8ec66..2004de4 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,10 @@ +2014-11-23 Michael Albinus + + * erc-desktop-notifications.el (erc-notifications-bus): + New customer option. Supports cases when Emacs hasn't been + invoked in the same environment where the notifications shall go to. + (erc-notifications-notify): Use it. + 2014-11-10 Kelvin White * erc-stamp.el (erc-timestamp-intangible): Change version tag to 24.5. diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index c0362b7..c8945cf 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -46,6 +46,12 @@ :group 'erc-notifications :type '(choice (const :tag "No icon" nil) file)) +(defcustom erc-notifications-bus :session + "D-Bus bus to use for notification." + :version "24.5" + :group 'erc-notifications + :type '(choice (const :tag "Session bus" :session) string)) + (defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors (defun erc-notifications-notify (nick msg) @@ -53,7 +59,8 @@ This will replace the last notification sent with this function." (dbus-ignore-errors (setq erc-notifications-last-notification - (notifications-notify :title (xml-escape-string nick) + (notifications-notify :bus erc-notifications-bus + :title (xml-escape-string nick) :body (xml-escape-string msg) :replaces-id erc-notifications-last-notification :app-icon erc-notifications-icon)))) commit 9c3381106fa40ef7a6d41e09e8fab0e1553b088e Author: Leo Liu Date: Sun Nov 23 15:58:16 2014 +0800 Handle leap months in Chinese calendar Fixes: debbugs:18953 * calendar/cal-china.el (calendar-chinese-from-absolute-for-diary) (calendar-chinese-to-absolute-for-diary) (calendar-chinese-mark-date-pattern, diary-chinese-anniversary): Handle leap months in Chinese calendar. (Bug#18953) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4223363..43b3f9a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-11-23 Leo Liu + + * calendar/cal-china.el (calendar-chinese-from-absolute-for-diary) + (calendar-chinese-to-absolute-for-diary) + (calendar-chinese-mark-date-pattern, diary-chinese-anniversary): + Handle leap months in Chinese calendar. (Bug#18953) + 2014-11-22 Alan Mackenzie Fix error with `mark-defun' and "protected:" in C++ Mode. diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el index c586065..8b61ef1 100644 --- a/lisp/calendar/cal-china.el +++ b/lisp/calendar/cal-china.el @@ -662,18 +662,30 @@ Echo Chinese date unless NOECHO is non-nil." ;;; These two functions convert to and back from this representation. (defun calendar-chinese-from-absolute-for-diary (date) (pcase-let ((`(,c ,y ,m ,d) (calendar-chinese-from-absolute date))) - (list m d (+ (* c 100) y)))) - -(defun calendar-chinese-to-absolute-for-diary (date) - (pcase-let ((`(,m ,d ,y) date)) + ;; Note: For leap months M is a float. + (list (floor m) d (+ (* c 100) y)))) + +(defun calendar-chinese-to-absolute-for-diary (date &optional prefer-leap) + (pcase-let* ((`(,m ,d ,y) date) + (cycle (floor y 100)) + (year (mod y 100)) + (months (calendar-chinese-months cycle year)) + (lm (+ (floor m) 0.5))) (calendar-chinese-to-absolute - (list (floor y 100) (mod y 100) m d)))) + (if (and prefer-leap (memql lm months)) + (list cycle year lm d) + (list cycle year m d))))) (defun calendar-chinese-mark-date-pattern (month day year &optional color) (calendar-mark-1 month day year #'calendar-chinese-from-absolute-for-diary #'calendar-chinese-to-absolute-for-diary - color)) + color) + (unless (zerop month) + (calendar-mark-1 month day year + #'calendar-chinese-from-absolute-for-diary + (lambda (date) (calendar-chinese-to-absolute-for-diary date t)) + color))) ;;;###cal-autoload (defun diary-chinese-mark-entries () @@ -717,7 +729,10 @@ This function is provided for use with `diary-nongregorian-listing-hook'." (diff (if (and dc dy) (+ (* 60 (- cc dc)) (- cy dy)) 100))) - (and (> diff 0) (= dm cm) (= dd cd) + (and (> diff 0) + ;; The Chinese month can differ by 0.5 in a leap month. + (or (= dm cm) (= (+ 0.5 dm) cm)) + (= dd cd) (cons mark (format entry diff (diary-ordinal-suffix diff)))))) ;;;###cal-autoload commit 116be2828b1c36a02471019d6a6ed68b67a32497 Author: Glenn Morris Date: Sat Nov 22 15:02:57 2014 -0800 * .gitignore: Add emacs.rc and emacsclient.rc in nt/. diff --git a/.gitignore b/.gitignore index 1fb7d49..16b92c4 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,5 @@ lwlib/deps/ lwlib/liblw.a leim/changed.misc leim/changed.tit +nt/emacs.rc +nt/emacsclient.rc commit 6d099b2e18ee784a84b82a5c8b5962983fba875a Author: Glenn Morris Date: Sat Nov 22 14:57:39 2014 -0800 * admin/admin.el: Fix paren typo in previous. diff --git a/admin/admin.el b/admin/admin.el index d6c702a..f5e9646 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -109,15 +109,15 @@ Root must be the root of an Emacs source tree." (set-version-in-file root "nt/makefile.w32-in" version (rx (and "VERSION" (0+ space) "=" (0+ space) (submatch (1+ (in "0-9.")))))) - ;; Major version only. - (when (string-match "\\([0-9]\\{2,\\}\\)" version) - (setq version (match-string 1 version)) - (set-version-in-file root "src/msdos.c" version - (rx (and "Vwindow_system_version" (1+ not-newline) - ?\( (submatch (1+ (in "0-9"))) ?\)))) - (set-version-in-file root "etc/refcards/ru-refcard.tex" version - "\\\\newcommand{\\\\versionemacs}\\[0\\]\ -{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs"))) + ;; Major version only. + (when (string-match "\\([0-9]\\{2,\\}\\)" version) + (setq version (match-string 1 version)) + (set-version-in-file root "src/msdos.c" version + (rx (and "Vwindow_system_version" (1+ not-newline) + ?\( (submatch (1+ (in "0-9"))) ?\)))) + (set-version-in-file root "etc/refcards/ru-refcard.tex" version + "\\\\newcommand{\\\\versionemacs}\\[0\\]\ +{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs")) (message "Setting version numbers...done")) ;; Note this makes some assumptions about form of short copyright. commit 8662e9d448723878a87bd7a573be98f12e7791c1 Author: Glenn Morris Date: Sat Nov 22 14:24:36 2014 -0800 * nt/emacs.rc, nt/emacsclient.rc: Remove files. Accidentally left out of previous commit. Apparently "git mv" doesn't do what I thought it did... diff --git a/nt/emacs.rc b/nt/emacs.rc deleted file mode 100644 index 15455d9..0000000 --- a/nt/emacs.rc +++ /dev/null @@ -1,45 +0,0 @@ -Emacs ICON icons/emacs.ico -32649 CURSOR icons/hand.cur -#if defined (WIN64) || defined (__x86_64__) -1 24 "emacs-x64.manifest" -#else -1 24 "emacs-x86.manifest" -#endif - -#ifndef VS_VERSION_INFO -#define VS_VERSION_INFO 1 -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 25,0,50,0 - PRODUCTVERSION 25,0,50,0 - FILEFLAGSMASK 0x3FL -#ifdef EMACSDEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Free Software Foundation\0" - VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0" - VALUE "FileVersion", "25, 0, 50, 0\0" - VALUE "InternalName", "Emacs\0" - VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" - VALUE "OriginalFilename", "emacs.exe" - VALUE "ProductName", "Emacs\0" - VALUE "ProductVersion", "25, 0, 50, 0\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/nt/emacsclient.rc b/nt/emacsclient.rc deleted file mode 100644 index 9318492..0000000 --- a/nt/emacsclient.rc +++ /dev/null @@ -1,39 +0,0 @@ -Emacs ICON icons\emacs.ico - -#ifndef VS_VERSION_INFO -#define VS_VERSION_INFO 1 -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 25,0,50,0 - PRODUCTVERSION 25,0,50,0 - FILEFLAGSMASK 0x3FL -#ifdef EMACSDEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Free Software Foundation\0" - VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0" - VALUE "FileVersion", "25, 0, 50, 0\0" - VALUE "InternalName", "EmacsClient\0" - VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" - VALUE "OriginalFilename", "emacsclientw.exe" - VALUE "ProductName", "EmacsClient\0" - VALUE "ProductVersion", "25, 0, 50, 0\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END commit 84e2f13cd50a7ef6af736559107f0a8e6bcec6c5 Author: Glenn Morris Date: Sat Nov 22 14:04:32 2014 -0800 Further reduce number of versioned files storing Emacs version number. * configure.ac (comma_version, comma_space_version) [mingw32]: New output variables. (nt/emacs.rc, nt/emacsclient.rc) [mingw32]: New output files. * make-dist: Update nt/ for *.rc -> *.rc.in changes. * nt/emacs.rc.in, nt/emacsclient.rc.in: Rename from nt/emacs.rc, emacsclient.rc. Let configure generate the real files, and set the version numbers. * lib-src/Makefile.in (emacsclient.res): Update deps for nt/emacsclient.rc now being in the build directory, not the source directory. * nt/Makefile.in (distclean): Delete *.rc. (emacs.res): Update deps for nt/emacsclient.rc now being in the build directory, not the source directory. * admin/admin.el (set-version): No more need to update nt/*.rc. * admin/authors.el (authors-renamed-files-alist): Add .rc.in files. diff --git a/ChangeLog b/ChangeLog index 749c020..f40624c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-11-22 Glenn Morris + + Further reduce number of versioned files storing Emacs version number. + * configure.ac (comma_version, comma_space_version) [mingw32]: + New output variables. + (nt/emacs.rc, nt/emacsclient.rc) [mingw32]: New output files. + * make-dist: Update nt/ for *.rc -> *.rc.in changes. + 2014-11-19 Dani Moncayo * build-aux/msys-to-w32: Simplify implementation and docstring; diff --git a/admin/ChangeLog b/admin/ChangeLog index 96a98e5..cc69367 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2014-11-22 Glenn Morris + + * admin.el (set-version): No more need to update nt/*.rc. + * authors.el (authors-renamed-files-alist): Add .rc.in files. + 2014-11-16 Glenn Morris * update_autogen: Auto-detect VCS in use. diff --git a/admin/admin.el b/admin/admin.el index b22160e..d6c702a 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -99,6 +99,8 @@ Root must be the root of an Emacs source tree." (rx (and bol "#" (0+ blank) "define" (1+ blank) "VERSION" (1+ blank) "\"" (submatch (1+ (in "0-9.")))))) + ;; TODO: msdos could easily extract the version number from + ;; configure.ac with sed, rather than duplicating the information. (set-version-in-file root "msdos/sed2v2.inp" version (rx (and bol "/^#undef " (1+ not-newline) "define VERSION" (1+ space) "\"" @@ -107,49 +109,6 @@ Root must be the root of an Emacs source tree." (set-version-in-file root "nt/makefile.w32-in" version (rx (and "VERSION" (0+ space) "=" (0+ space) (submatch (1+ (in "0-9.")))))) - ;; nt/emacs.rc also contains the version number, but in an awkward - ;; format. It must contain four components, separated by commas, and - ;; in two places those commas are followed by space, in two other - ;; places they are not. - (let* ((version-components (append (split-string version "\\.") - '("0" "0"))) - (comma-version - (concat (car version-components) "," - (cadr version-components) "," - (cadr (cdr version-components)) "," - (cadr (cdr (cdr version-components))))) - (comma-space-version - (concat (car version-components) ", " - (cadr version-components) ", " - (cadr (cdr version-components)) ", " - (cadr (cdr (cdr version-components)))))) - (set-version-in-file root "nt/emacs.rc" comma-version - (rx (and "FILEVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacs.rc" comma-version - (rx (and "PRODUCTVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacs.rc" comma-space-version - (rx (and "\"FileVersion\"" (0+ space) ?, (0+ space) - ?\" (submatch (1+ (in "0-9, "))) "\\0\""))) - (set-version-in-file root "nt/emacs.rc" comma-space-version - (rx (and "\"ProductVersion\"" (0+ space) ?, - (0+ space) ?\" (submatch (1+ (in "0-9, "))) - "\\0\""))) - ;; Likewise for emacsclient.rc - (set-version-in-file root "nt/emacsclient.rc" comma-version - (rx (and "FILEVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacsclient.rc" comma-version - (rx (and "PRODUCTVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacsclient.rc" comma-space-version - (rx (and "\"FileVersion\"" (0+ space) ?, (0+ space) - ?\" (submatch (1+ (in "0-9, "))) "\\0\""))) - (set-version-in-file root "nt/emacsclient.rc" comma-space-version - (rx (and "\"ProductVersion\"" (0+ space) ?, - (0+ space) ?\" (submatch (1+ (in "0-9, "))) - "\\0\""))) ;; Major version only. (when (string-match "\\([0-9]\\{2,\\}\\)" version) (setq version (match-string 1 version)) diff --git a/admin/authors.el b/admin/authors.el index aefd947..b05f37b 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -730,6 +730,8 @@ in the repository.") ("paths.h-dist" . "epaths.in") ("paths.h.in" . "epaths.in") ("paths.in" . "epaths.in") + ("emacs.rc" . "emacs.rc.in") + ("emacsclient.rc" . "emacsclient.rc.in") ("patch1" . "sed1.inp") ("INSTALL.MSYS" . "INSTALL") ("server.c" . "emacsserver.c") diff --git a/configure.ac b/configure.ac index 5d71c2f..85d1123 100644 --- a/configure.ac +++ b/configure.ac @@ -4679,6 +4679,15 @@ AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure case $opsys in mingw32) AC_DEFINE(config_opsysfile, , []) + + dnl Construct something of the form "24,4,0,0" with 4 components. + comma_version=`echo "$version.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'` + + comma_space_version=`echo "$comma_version" | sed 's/,/, /g'` + + AC_SUBST(comma_version) + AC_SUBST(comma_space_version) + AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc]) ;; esac diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index a8281a5..4fc3b4d 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,5 +1,8 @@ 2014-11-22 Glenn Morris + * Makefile.in (emacsclient.res): Update deps for nt/emacsclient.rc + now being in the build directory, not the source directory. + * Makefile.in (emacsclient.res): Add dependency on icons/emacs.ico. 2014-10-20 Glenn Morris diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index eb16c33..432314f 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -388,7 +388,7 @@ update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h) -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ $< $(LOADLIBES) $(NTLIB) -o $@ -emacsclient.res: $(NTINC)/../emacsclient.rc ${srcdir}/icons/emacs.ico +emacsclient.res: ../nt/emacsclient.rc ${srcdir}/icons/emacs.ico $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $< ## Makefile ends here. diff --git a/make-dist b/make-dist index 45df561..6e85f1d 100755 --- a/make-dist +++ b/make-dist @@ -392,10 +392,10 @@ echo "Making links to \`m4'" echo "Making links to \`nt'" (cd nt - ln emacs-x86.manifest emacs-x64.manifest emacs.rc ../${tempdir}/nt - ln config.nt emacsclient.rc emacs-src.tags ../${tempdir}/nt + ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt + ln config.nt emacs-src.tags ../${tempdir}/nt ln nmake.defs gmake.defs subdirs.el [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt - ln Makefile.in gnulib.mk ../${tempdir}/nt + ln *.in gnulib.mk ../${tempdir}/nt ln mingw-cfg.site epaths.nt INSTALL.OLD ../${tempdir}/nt ln ChangeLog INSTALL README README.W32 makefile.w32-in ../${tempdir}/nt) diff --git a/nt/ChangeLog b/nt/ChangeLog index 49ef65a..168f1dd 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,5 +1,11 @@ 2014-11-22 Glenn Morris + * emacs.rc.in, emacsclient.rc.in: Rename from emacs.rc, emacsclient.rc. + Let configure generate the real files, and set the version numbers. + * Makefile.in (distclean): Delete *.rc. + (emacs.res): Update deps for nt/emacsclient.rc now being in the + build directory, not the source directory. + * Makefile.in (emacs.res): Add dependency on icons/hand.cur. 2014-11-18 Glenn Morris diff --git a/nt/Makefile.in b/nt/Makefile.in index c456d55..c6b2f0b 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -195,8 +195,7 @@ clean: mostlyclean -rm -f ${EXE_FILES} distclean: clean - -rm -f TAGS - -rm -f Makefile + -rm -f TAGS Makefile *.rc bootstrap-clean maintainer-clean: distclean true @@ -225,6 +224,7 @@ cmdproxy${EXEEXT}: ${srcdir}/cmdproxy.c runemacs${EXEEXT}: ${srcdir}/runemacs.c $(EMACSRES) $(CC) ${ALL_CFLAGS} $^ -mwindows -o $@ -emacs.res: ${srcdir}/emacs.rc ${srcdir}/icons/emacs.ico \ +## This rule (and file) is duplicated in src/: why? +emacs.res: emacs.rc ${srcdir}/icons/emacs.ico \ ${srcdir}/icons/hand.cur ${srcdir}/$(EMACS_MANIFEST) ${WINDRES} -I ${srcdir} -O coff -o $@ $< diff --git a/nt/emacs.rc.in b/nt/emacs.rc.in new file mode 100644 index 0000000..d2d17b8 --- /dev/null +++ b/nt/emacs.rc.in @@ -0,0 +1,45 @@ +Emacs ICON icons/emacs.ico +32649 CURSOR icons/hand.cur +#if defined (WIN64) || defined (__x86_64__) +1 24 "emacs-x64.manifest" +#else +1 24 "emacs-x86.manifest" +#endif + +#ifndef VS_VERSION_INFO +#define VS_VERSION_INFO 1 +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @comma_version@ + PRODUCTVERSION @comma_version@ + FILEFLAGSMASK 0x3FL +#ifdef EMACSDEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0" + VALUE "FileVersion", "@comma_space_version@\0" + VALUE "InternalName", "Emacs\0" + VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" + VALUE "OriginalFilename", "emacs.exe" + VALUE "ProductName", "Emacs\0" + VALUE "ProductVersion", "@comma_space_version@\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/nt/emacsclient.rc.in b/nt/emacsclient.rc.in new file mode 100644 index 0000000..5c3b65d --- /dev/null +++ b/nt/emacsclient.rc.in @@ -0,0 +1,39 @@ +Emacs ICON icons\emacs.ico + +#ifndef VS_VERSION_INFO +#define VS_VERSION_INFO 1 +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @comma_version@ + PRODUCTVERSION @comma_version@ + FILEFLAGSMASK 0x3FL +#ifdef EMACSDEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0" + VALUE "FileVersion", "@comma_space_version@\0" + VALUE "InternalName", "EmacsClient\0" + VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" + VALUE "OriginalFilename", "emacsclientw.exe" + VALUE "ProductName", "EmacsClient\0" + VALUE "ProductVersion", "@comma_space_version@\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/src/Makefile.in b/src/Makefile.in index 7defb4d..4bc5fdfa 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -549,7 +549,7 @@ $(top_srcdir)/aclocal.m4 $(top_srcdir)/configure config.in ../config.status \ doc.o: buildobj.h ## This rule (and file) is duplicated in nt/: why? -emacs.res: $(ntsource)/emacs.rc \ +emacs.res: ../nt/emacs.rc \ $(ntsource)/icons/emacs.ico \ $(ntsource)/icons/hand.cur \ $(ntsource)/$(EMACS_MANIFEST) commit 239cd5b62759b23020cb308d993b7e26933943d7 Merge: ec02f4f d00c866 Author: Alan Mackenzie Date: Sat Nov 22 21:44:23 2014 +0000 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit ec02f4fe1d5ac0f7e306872434f96fcdfe00aead Author: Alan Mackenzie Date: Sat Nov 22 21:41:00 2014 +0000 Fix error with `mark-defun' and "protected:" in C++ Mode. Fixes: debbugs:19134. progmodes/cc-cmds.el (c-where-wrt-brace-construct): Handle a return code of (label) from c-beginning-of-decl-1. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c7b583..4223363 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-11-22 Alan Mackenzie + + Fix error with `mark-defun' and "protected:" in C++ Mode. + Fixes: debbugs:19134. + + * progmodes/cc-cmds.el (c-where-wrt-brace-construct): Handle a + return code of (label) from c-beginning-of-decl-1. + 2014-11-22 Ulf Jasper * net/newst-backend.el (newsticker--sentinel-work): Tell diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 5fa3b25..50cdd78 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -1417,12 +1417,15 @@ No indentation or other \"electric\" behavior is performed." (car (c-beginning-of-decl-1 ;; NOTE: If we're in a K&R region, this might be the start ;; of a parameter declaration, not the actual function. + ;; It might also leave us at a label or "label" like + ;; "private:". (and least-enclosing ; LIMIT for c-b-of-decl-1 (c-safe-position least-enclosing paren-state))))) ;; Has the declaration we've gone back to got braces? - (setq brace-decl-p - (save-excursion + (or (eq decl-result 'label) + (setq brace-decl-p + (save-excursion (and (c-syntactic-re-search-forward "[;{]" nil t t) (or (eq (char-before) ?\{) (and c-recognize-knr-p @@ -1430,10 +1433,11 @@ No indentation or other \"electric\" behavior is performed." ;; ';' in a K&R argdecl. In ;; that case the declaration ;; should contain a block. - (c-in-knr-argdecl)))))) + (c-in-knr-argdecl))))))) (cond - ((= (point) kluge-start) ; might be BOB or unbalanced parens. + ((or (eq decl-result 'label) ; e.g. "private:" or invalid syntax. + (= (point) kluge-start)) ; might be BOB or unbalanced parens. 'outwith-function) ((eq decl-result 'same) (if brace-decl-p commit d00c866167d95612ddc0debdeeb18601b063bcdc Author: Glenn Morris Date: Sat Nov 22 13:40:25 2014 -0800 * src/Makefile.in (emacs.res): Add dependency on icons/hand.cur. Use $<. diff --git a/src/ChangeLog b/src/ChangeLog index 0f1d047..a474398 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-11-22 Glenn Morris + + * Makefile.in (emacs.res): Add dependency on icons/hand.cur. Use $<. + 2014-11-22 Martin Rudalics Don't shrink frame when using desktop-save-mode (Bug#19048). diff --git a/src/Makefile.in b/src/Makefile.in index 270119e..7defb4d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -548,11 +548,12 @@ $(top_srcdir)/aclocal.m4 $(top_srcdir)/configure config.in ../config.status \ doc.o: buildobj.h +## This rule (and file) is duplicated in nt/: why? emacs.res: $(ntsource)/emacs.rc \ $(ntsource)/icons/emacs.ico \ + $(ntsource)/icons/hand.cur \ $(ntsource)/$(EMACS_MANIFEST) - $(WINDRES) -O COFF --include-dir=$(top_srcdir)/nt \ - -o $@ $(ntsource)/emacs.rc + $(WINDRES) -O COFF --include-dir=$(top_srcdir)/nt -o $@ $< .PHONY: ns-app ns-app: emacs$(EXEEXT) commit cc252fc141482e64f8824967449f1076a6feb540 Author: Glenn Morris Date: Sat Nov 22 13:32:34 2014 -0800 Add some .ico dependencies to Makefile .res rules * lib-src/Makefile.in (emacsclient.res): Add dependency on icons/emacs.ico. * nt/Makefile.in (emacs.res): Add dependency on icons/hand.cur. diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 0093abe..a8281a5 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2014-11-22 Glenn Morris + + * Makefile.in (emacsclient.res): Add dependency on icons/emacs.ico. + 2014-10-20 Glenn Morris * Merge in all changes up to 24.4 release. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index fe10104..eb16c33 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -388,7 +388,7 @@ update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h) -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ $< $(LOADLIBES) $(NTLIB) -o $@ -emacsclient.res: $(NTINC)/../emacsclient.rc +emacsclient.res: $(NTINC)/../emacsclient.rc ${srcdir}/icons/emacs.ico $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $< ## Makefile ends here. diff --git a/nt/ChangeLog b/nt/ChangeLog index 457d97c..49ef65a 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2014-11-22 Glenn Morris + + * Makefile.in (emacs.res): Add dependency on icons/hand.cur. + 2014-11-18 Glenn Morris * Makefile.in (addpm${EXEEXT}, ddeclient${EXEEXT}) diff --git a/nt/Makefile.in b/nt/Makefile.in index 63bef28..c456d55 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -225,5 +225,6 @@ cmdproxy${EXEEXT}: ${srcdir}/cmdproxy.c runemacs${EXEEXT}: ${srcdir}/runemacs.c $(EMACSRES) $(CC) ${ALL_CFLAGS} $^ -mwindows -o $@ -emacs.res: ${srcdir}/emacs.rc ${srcdir}/icons/emacs.ico ${srcdir}/$(EMACS_MANIFEST) +emacs.res: ${srcdir}/emacs.rc ${srcdir}/icons/emacs.ico \ + ${srcdir}/icons/hand.cur ${srcdir}/$(EMACS_MANIFEST) ${WINDRES} -I ${srcdir} -O coff -o $@ $< commit 9a8482589210016999a5fc3d9f18be74190756f9 Author: Glenn Morris Date: Sat Nov 22 13:10:26 2014 -0800 * nextstep/templates/Info-gnustep.plist.in: Let configure set URL. diff --git a/nextstep/ChangeLog b/nextstep/ChangeLog index 4ff3d65..4bb84bc 100644 --- a/nextstep/ChangeLog +++ b/nextstep/ChangeLog @@ -1,3 +1,7 @@ +2014-11-22 Glenn Morris + + * templates/Info-gnustep.plist.in: Let configure set URL. + 2014-11-03 Jan Djärv * INSTALL: Remove univeral binary section. diff --git a/nextstep/templates/Info-gnustep.plist.in b/nextstep/templates/Info-gnustep.plist.in index 42abc23..679eb4f 100644 --- a/nextstep/templates/Info-gnustep.plist.in +++ b/nextstep/templates/Info-gnustep.plist.in @@ -132,5 +132,5 @@ }; }, ); - URL = "http://www.gnu.org/software/emacs"; + URL = "@PACKAGE_URL@"; } commit db67afbd8cbebcb16d9fdc0d4316c32f6cee5feb Author: “Martin <“rudalics@gmx.at”> Date: Sat Nov 22 17:59:59 2014 +0100 Don't shrink frame when using desktop-save-mode (Bug#19048). * w32fns.c (x_set_tool_bar_lines): Always call x_change_tool_bar_height (Bug#19048). (x_change_tool_bar_height): Mark frame as garbaged since adjust_frame_size might not have done that. * xfns.c (x_set_tool_bar_lines): Always call x_change_tool_bar_height (Bug#19048). (x_change_tool_bar_height): Mark frame as garbaged since adjust_frame_size might not have done that. diff --git a/src/ChangeLog b/src/ChangeLog index f8c9c5a..0f1d047 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2014-11-22 Martin Rudalics + + Don't shrink frame when using desktop-save-mode (Bug#19048). + * w32fns.c (x_set_tool_bar_lines): Always call + x_change_tool_bar_height (Bug#19048). + (x_change_tool_bar_height): Mark frame as garbaged since + adjust_frame_size might not have done that. + * xfns.c (x_set_tool_bar_lines): Always call + x_change_tool_bar_height (Bug#19048). + (x_change_tool_bar_height): Mark frame as garbaged since + adjust_frame_size might not have done that. + 2014-11-21 Ulf Jasper * xml.c (parse_region): Take care of new optional parameter diff --git a/src/w32fns.c b/src/w32fns.c index 1b290b7..e514970 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1721,15 +1721,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) else nlines = 0; - if (nlines == 0) - x_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); - else - { - f->n_tool_bar_rows = 0; - FRAME_TOOL_BAR_LINES (f) = nlines; - adjust_frame_glyphs (f); - SET_FRAME_GARBAGED (f); - } + x_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); } @@ -1749,11 +1741,7 @@ x_change_tool_bar_height (struct frame *f, int height) /* Recalculate tool bar and frame text sizes. */ FRAME_TOOL_BAR_HEIGHT (f) = height; FRAME_TOOL_BAR_LINES (f) = lines; -/** FRAME_TEXT_HEIGHT (f) **/ -/** = FRAME_PIXEL_TO_TEXT_HEIGHT (f, FRAME_PIXEL_HEIGHT (f)); **/ -/** FRAME_LINES (f) **/ -/** = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, FRAME_PIXEL_HEIGHT (f)); **/ - /* Store the `tool-bar-lines' and `height' frame parameters. */ + /* Store `tool-bar-lines' and `height' frame parameters. */ store_frame_param (f, Qtool_bar_lines, make_number (lines)); store_frame_param (f, Qheight, make_number (FRAME_LINES (f))); @@ -1772,6 +1760,10 @@ x_change_tool_bar_height (struct frame *f, int height) adjust_frame_size (f, -1, -1, (old_height == 0 || height == 0) ? 2 : 4, 0, Qtool_bar_lines); + /* adjust_frame_size might not have done anything, garbage frame + here. */ + adjust_frame_glyphs (f); + SET_FRAME_GARBAGED (f); if (FRAME_X_WINDOW (f)) x_clear_under_internal_border (f); } diff --git a/src/xfns.c b/src/xfns.c index aaa75f2..59715d0 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1075,19 +1075,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) else nlines = 0; -#ifdef USE_GTK x_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); -#else /* !USE_GTK */ - if (nlines == 0) - x_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); - else - { - f->n_tool_bar_rows = 0; - FRAME_TOOL_BAR_LINES (f) = nlines; - adjust_frame_glyphs (f); - SET_FRAME_GARBAGED (f); - } -#endif /* USE_GTK */ } @@ -1124,10 +1112,6 @@ x_change_tool_bar_height (struct frame *f, int height) /* Recalculate tool bar and frame text sizes. */ FRAME_TOOL_BAR_HEIGHT (f) = height; FRAME_TOOL_BAR_LINES (f) = lines; -/** FRAME_TEXT_HEIGHT (f) **/ -/** = FRAME_PIXEL_TO_TEXT_HEIGHT (f, FRAME_PIXEL_HEIGHT (f)); **/ -/** FRAME_LINES (f) **/ -/** = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, FRAME_PIXEL_HEIGHT (f)); **/ /* Store the `tool-bar-lines' and `height' frame parameters. */ store_frame_param (f, Qtool_bar_lines, make_number (lines)); store_frame_param (f, Qheight, make_number (FRAME_LINES (f))); @@ -1153,6 +1137,10 @@ x_change_tool_bar_height (struct frame *f, int height) adjust_frame_size (f, -1, -1, (old_height == 0 || height == 0) ? 2 : 4, 0, Qtool_bar_lines); + /* adjust_frame_size might not have done anything, garbage frame + here. */ + adjust_frame_glyphs (f); + SET_FRAME_GARBAGED (f); if (FRAME_X_WINDOW (f)) x_clear_under_internal_border (f); commit 46035c64e6f3036c37ef2bd1636afc41a8d0e809 Author: Ulf Jasper Date: Sat Nov 22 15:51:12 2014 +0100 newsticker: Fix bug#18787: Tell libxml-parse-xml-region to discard comments. * lisp/net/newst-backend.el (newsticker--sentinel-work): Tell `libxml-parse-xml-region' to discard comments. Fixes bug#18787. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d3a9b64..4c7b583 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-22 Ulf Jasper + + * net/newst-backend.el (newsticker--sentinel-work): Tell + `libxml-parse-xml-region' to discard comments. Fixes bug#18787. + 2014-11-22 Michael Albinus * net/tramp-sh.el (tramp-sh-handle-start-file-process) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index ba10053..7be07c7 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -879,10 +879,11 @@ Argument BUFFER is the buffer of the retrieval process." (decode-coding-region (point-min) (point-max) coding-system)) (condition-case errordata - ;; The xml parser might fail - ;; or the xml might be bugged + ;; The xml parser might fail or the xml might be + ;; bugged (if (fboundp 'libxml-parse-xml-region) - (list (libxml-parse-xml-region (point-min) (point-max))) + (list (libxml-parse-xml-region (point-min) (point-max) + nil t)) (xml-parse-region (point-min) (point-max))) (error (message "Could not parse %s: %s" (buffer-name) (cadr errordata)) commit b559a60382a3e192250e533c4a9daecacabd4026 Merge: cd22fd7 cec2396 Author: Michael Albinus Date: Sat Nov 22 12:38:21 2014 +0100 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit cd22fd754b71ff64bbabd05bb6df2df8fa5a8915 Author: Michael Albinus Date: Sat Nov 22 12:37:04 2014 +0100 Propagate remote process environment. * net/tramp-sh.el (tramp-sh-handle-start-file-process) (tramp-sh-handle-process-file): Propagate `process-environment'. * vc/vc-hg.el (vc-hg-state): No special handling for remote files; Tramp propagates environment variables now. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 426543c..d3a9b64 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,10 +1,18 @@ +2014-11-22 Michael Albinus + + * net/tramp-sh.el (tramp-sh-handle-start-file-process) + (tramp-sh-handle-process-file): Propagate `process-environment'. + + * vc/vc-hg.el (vc-hg-state): No special handling for remote files; + Tramp propagates environment variables now. + 2014-11-22 Eric S. Raymond - * vc-filewise.el: New file to isolate code used only by the + * vc/vc-filewise.el: New file to isolate code used only by the file-oriented back ends (SCCS/RCS/CVS/SRC) which should not live in vc.el and certainly not in vc-hooks.el. - * vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name. + * vc/vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name. This is preaparatory to isolating all the 'master' functions used only by the file-oriented back ends. With this done first, the substantive diffs will be easier to read. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6e46df2..8d7e046 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2835,16 +2835,27 @@ the result will be a local, non-Tramp, file name." (list (replace-match " \\\\\n" nil nil (cadr args)))) (setq i (+ i 250)))) (cdr args))) + ;; Use a human-friendly prompt, for example for `shell'. + (prompt (format "PS1=%s" + (format "%s %s" + (file-remote-p default-directory) + tramp-initial-end-of-output))) + ;; We use as environment the difference to toplevel + ;; `process-environment'. + env + (env + (dolist + (elt + (cons prompt (nreverse (copy-sequence process-environment))) + env) + (or (member elt (default-toplevel-value 'process-environment)) + (setq env (cons elt env))))) (command (when (stringp program) - (format "cd %s && exec %s env PS1=%s %s" + (format "cd %s && exec %s env %s %s" (tramp-shell-quote-argument localname) (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "") - ;; Use a human-friendly prompt, for example for `shell'. - (tramp-shell-quote-argument - (format "%s %s" - (file-remote-p default-directory) - tramp-initial-end-of-output)) + (mapconcat 'tramp-shell-quote-argument env " ") (if heredoc (format "%s\n(\n%s\n) Date: Sat Nov 22 06:32:48 2014 -0500 Unbreak the build. I don't really understand why this reversion works, but it will do until I can actually comprehend the bizarre hairball that is Emacs bootstrapping. diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el index 9bdde5e..bc8a8de 100644 --- a/lisp/vc/vc-filewise.el +++ b/lisp/vc/vc-filewise.el @@ -81,18 +81,6 @@ If the file is not registered, or the master name is not known, return nil." (vc-file-setprop file 'vc-name result) nil)))) ; Not registered -(defun vc-possible-master (s dirname basename) - (cond - ((stringp s) (format s dirname basename)) - ((functionp s) - ;; The template is a function to invoke. If the - ;; function returns non-nil, that means it has found a - ;; master. For backward compatibility, we also handle - ;; the case that the function throws a 'found atom - ;; and a pair (cons MASTER-FILE BACKEND). - (let ((result (catch 'found (funcall s dirname basename)))) - (if (consp result) (car result) result))))) - (defun vc-check-master-templates (file templates) "Return non-nil if there is a master corresponding to FILE. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 8ce7ec8..a084f9d 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -637,6 +637,19 @@ If FILE is not registered, this function always returns nil." (vc-file-setprop file 'vc-master-name result) nil)))) ; Not registered +;;;###autoload +(defun vc-possible-master (s dirname basename) + (cond + ((stringp s) (format s dirname basename)) + ((functionp s) + ;; The template is a function to invoke. If the + ;; function returns non-nil, that means it has found a + ;; master. For backward compatibility, we also handle + ;; the case that the function throws a 'found atom + ;; and a pair (cons MASTER-FILE BACKEND). + (let ((result (catch 'found (funcall s dirname basename)))) + (if (consp result) (car result) result))))) + (defun vc-check-master-templates (file templates) "Return non-nil if there is a master corresponding to FILE. commit e9b190263439a1b3c9c41b70cc91d48a215e4be8 Author: Eric S. Raymond Date: Sat Nov 22 06:03:57 2014 -0500 Revert "More movement of master-related code to vc-filewise.el." Must unbreak the build. Which is way too complicated... diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 6f55a14..8ce7ec8 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -627,8 +627,7 @@ If FILE is not registered, this function always returns nil." "`working-revision' not found: using the old `workfile-version' instead") (vc-call-backend backend 'workfile-version file)) -;;;autoload -(defun vc-master-registered (backend file) +(defun vc-default-registered (backend file) "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." (let ((sym (vc-make-backend-sym backend 'master-templates))) (unless (get backend 'vc-templates-grabbed) @@ -638,6 +637,41 @@ If FILE is not registered, this function always returns nil." (vc-file-setprop file 'vc-master-name result) nil)))) ; Not registered +(defun vc-check-master-templates (file templates) + "Return non-nil if there is a master corresponding to FILE. + +TEMPLATES is a list of strings or functions. If an element is a +string, it must be a control string as required by `format', with two +string placeholders, such as \"%sRCS/%s,v\". The directory part of +FILE is substituted for the first placeholder, the basename of FILE +for the second. If a file with the resulting name exists, it is taken +as the master of FILE, and returned. + +If an element of TEMPLATES is a function, it is called with the +directory part and the basename of FILE as arguments. It should +return non-nil if it finds a master; that value is then returned by +this function." + (let ((dirname (or (file-name-directory file) "")) + (basename (file-name-nondirectory file))) + (catch 'found + (mapcar + (lambda (s) + (let ((trial (vc-possible-master s dirname basename))) + (when (and trial (file-exists-p trial) + ;; Make sure the file we found with name + ;; TRIAL is not the source file itself. + ;; That can happen with RCS-style names if + ;; the file name is truncated (e.g. to 14 + ;; chars). See if either directory or + ;; attributes differ. + (or (not (string= dirname + (file-name-directory trial))) + (not (equal (file-attributes file) + (file-attributes trial))))) + (throw 'found trial)))) + templates)))) + + ;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made ;; obsolete earlier, it is ok for the latter to be an alias to the former, ;; since the latter will be removed first. We can't just make it diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 9901991..0b839a6 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -90,7 +90,7 @@ to use --brief and sets this variable to remember whether it worked." :group 'vc-rcs) ;; This needs to be autoloaded because vc-rcs-registered uses it (via -;; vc-master-registered), and vc-hooks needs to be able to check +;; vc-default-registered), and vc-hooks needs to be able to check ;; for a registered backend without loading every backend. ;;;###autoload (defcustom vc-rcs-master-templates @@ -131,7 +131,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; every file that is visited. ;;;###autoload (progn -(defun vc-rcs-registered (f) (vc-master-registered 'RCS f))) +(defun vc-rcs-registered (f) (vc-default-registered 'RCS f))) (defun vc-rcs-state (file) "Implementation of `vc-state' for RCS." diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index fc9c072..780efc4 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -75,7 +75,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :group 'vc-sccs) ;; This needs to be autoloaded because vc-sccs-registered uses it (via -;; vc-master-registered), and vc-hooks needs to be able to check +;; vc-default-registered), and vc-hooks needs to be able to check ;; for a registered backend without loading every backend. ;;;###autoload (defcustom vc-sccs-master-templates @@ -112,7 +112,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; every file that is visited. ;;;###autoload (progn -(defun vc-sccs-registered (f) (vc-master-registered 'SCCS f))) +(defun vc-sccs-registered (f) (vc-default-registered 'SCCS f))) (defun vc-sccs-state (file) "SCCS-specific function to compute the version control state." diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index 56af2a5..520708c 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -123,7 +123,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :group 'vc-src) ;; This needs to be autoloaded because vc-src-registered uses it (via -;; vc-master-registered), and vc-hooks needs to be able to check +;; vc-default-registered), and vc-hooks needs to be able to check ;; for a registered backend without loading every backend. ;;;###autoload (defcustom vc-src-master-templates @@ -153,7 +153,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; every file that is visited. ;;;###autoload (progn -(defun vc-src-registered (f) (vc-master-registered 'src f))) +(defun vc-src-registered (f) (vc-default-registered 'src f))) (defun vc-src-state (file) "SRC-specific version of `vc-state'." commit 4fe5b7c0bbb77286ce2866c9237796d0587ce2a3 Author: Eric S. Raymond Date: Sat Nov 22 05:21:09 2014 -0500 More movement of master-related code to vc-filewise.el. Goes with my 2014-11-22 lisp/ChangeLog entry. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 8ce7ec8..6f55a14 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -627,7 +627,8 @@ If FILE is not registered, this function always returns nil." "`working-revision' not found: using the old `workfile-version' instead") (vc-call-backend backend 'workfile-version file)) -(defun vc-default-registered (backend file) +;;;autoload +(defun vc-master-registered (backend file) "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." (let ((sym (vc-make-backend-sym backend 'master-templates))) (unless (get backend 'vc-templates-grabbed) @@ -637,41 +638,6 @@ If FILE is not registered, this function always returns nil." (vc-file-setprop file 'vc-master-name result) nil)))) ; Not registered -(defun vc-check-master-templates (file templates) - "Return non-nil if there is a master corresponding to FILE. - -TEMPLATES is a list of strings or functions. If an element is a -string, it must be a control string as required by `format', with two -string placeholders, such as \"%sRCS/%s,v\". The directory part of -FILE is substituted for the first placeholder, the basename of FILE -for the second. If a file with the resulting name exists, it is taken -as the master of FILE, and returned. - -If an element of TEMPLATES is a function, it is called with the -directory part and the basename of FILE as arguments. It should -return non-nil if it finds a master; that value is then returned by -this function." - (let ((dirname (or (file-name-directory file) "")) - (basename (file-name-nondirectory file))) - (catch 'found - (mapcar - (lambda (s) - (let ((trial (vc-possible-master s dirname basename))) - (when (and trial (file-exists-p trial) - ;; Make sure the file we found with name - ;; TRIAL is not the source file itself. - ;; That can happen with RCS-style names if - ;; the file name is truncated (e.g. to 14 - ;; chars). See if either directory or - ;; attributes differ. - (or (not (string= dirname - (file-name-directory trial))) - (not (equal (file-attributes file) - (file-attributes trial))))) - (throw 'found trial)))) - templates)))) - - ;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made ;; obsolete earlier, it is ok for the latter to be an alias to the former, ;; since the latter will be removed first. We can't just make it diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 0b839a6..9901991 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -90,7 +90,7 @@ to use --brief and sets this variable to remember whether it worked." :group 'vc-rcs) ;; This needs to be autoloaded because vc-rcs-registered uses it (via -;; vc-default-registered), and vc-hooks needs to be able to check +;; vc-master-registered), and vc-hooks needs to be able to check ;; for a registered backend without loading every backend. ;;;###autoload (defcustom vc-rcs-master-templates @@ -131,7 +131,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; every file that is visited. ;;;###autoload (progn -(defun vc-rcs-registered (f) (vc-default-registered 'RCS f))) +(defun vc-rcs-registered (f) (vc-master-registered 'RCS f))) (defun vc-rcs-state (file) "Implementation of `vc-state' for RCS." diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index 780efc4..fc9c072 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -75,7 +75,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :group 'vc-sccs) ;; This needs to be autoloaded because vc-sccs-registered uses it (via -;; vc-default-registered), and vc-hooks needs to be able to check +;; vc-master-registered), and vc-hooks needs to be able to check ;; for a registered backend without loading every backend. ;;;###autoload (defcustom vc-sccs-master-templates @@ -112,7 +112,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; every file that is visited. ;;;###autoload (progn -(defun vc-sccs-registered (f) (vc-default-registered 'SCCS f))) +(defun vc-sccs-registered (f) (vc-master-registered 'SCCS f))) (defun vc-sccs-state (file) "SCCS-specific function to compute the version control state." diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index 520708c..56af2a5 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -123,7 +123,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :group 'vc-src) ;; This needs to be autoloaded because vc-src-registered uses it (via -;; vc-default-registered), and vc-hooks needs to be able to check +;; vc-master-registered), and vc-hooks needs to be able to check ;; for a registered backend without loading every backend. ;;;###autoload (defcustom vc-src-master-templates @@ -153,7 +153,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; every file that is visited. ;;;###autoload (progn -(defun vc-src-registered (f) (vc-default-registered 'src f))) +(defun vc-src-registered (f) (vc-master-registered 'src f))) (defun vc-src-state (file) "SRC-specific version of `vc-state'." commit 354a07b57092b9231734a9d983d074bd4d542f62 Author: Eric S. Raymond Date: Sat Nov 22 00:31:20 2014 -0500 Isolating support code for the file-granularity back ends: the easy part. * vc-filewise.el: New file to isolate code used only by the file-oriented back ends (SCCS/RCS/CVS/SRC) which should not live in vc.el and certainly not in vc-hooks.el. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4ff1665..426543c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2014-11-22 Eric S. Raymond + * vc-filewise.el: New file to isolate code used only by the + file-oriented back ends (SCCS/RCS/CVS/SRC) which should not + live in vc.el and certainly not in vc-hooks.el. + * vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name. This is preaparatory to isolating all the 'master' functions used only by the file-oriented back ends. With this done first, diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el new file mode 100644 index 0000000..9bdde5e --- /dev/null +++ b/lisp/vc/vc-filewise.el @@ -0,0 +1,130 @@ +;;; vc-filewise.el --- common functions for file-oriented back ends. + +;; Copyright (C) 1992-1996, 1998-2014 Free Software Foundation, Inc. + +;; Author: FSF (see vc.el for full credits) +;; Maintainer: Andre Spiegel +;; Package: 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: + +;; Common functions for file-oriented back ends - SCCS, RCS, SRC, CVS +;; +;; The main purpose of this file is so none od this code jas to like +;; in the always-resident vc-hooks. A secondary purpose is to remove +;; code specific to this class of back ends from vc.el. + +;;; Code: + +(eval-when-compile (require 'vc)) + +(defun vc-master-name (file) + "Return the master name of FILE. +If the file is not registered, or the master name is not known, return nil." + (or (vc-file-getprop file 'vc-name) + ;; force computation of the property by calling + ;; vc-BACKEND-registered explicitly + (let ((backend (vc-backend file))) + (if (and backend + (vc-call-backend backend 'registered file)) + (vc-file-getprop file 'vc-name))))) + +(defun vc-rename-master (oldmaster newfile templates) + "Rename OLDMASTER to be the master file for NEWFILE based on TEMPLATES." + (let* ((dir (file-name-directory (expand-file-name oldmaster))) + (newdir (or (file-name-directory newfile) "")) + (newbase (file-name-nondirectory newfile)) + (masters + ;; List of potential master files for `newfile' + (mapcar + (lambda (s) (vc-possible-master s newdir newbase)) + templates))) + (when (or (file-symlink-p oldmaster) + (file-symlink-p (file-name-directory oldmaster))) + (error "This is unsafe in the presence of symbolic links")) + (rename-file + oldmaster + (catch 'found + ;; If possible, keep the master file in the same directory. + (dolist (f masters) + (when (and f (string= (file-name-directory (expand-file-name f)) dir)) + (throw 'found f))) + ;; If not, just use the first possible place. + (dolist (f masters) + (and f (or (not (setq dir (file-name-directory f))) + (file-directory-p dir)) + (throw 'found f))) + (error "New file lacks a version control directory"))))) + +(defun vc-filewise-registered (backend file) + "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." + (let ((sym (vc-make-backend-sym backend 'master-templates))) + (unless (get backend 'vc-templates-grabbed) + (put backend 'vc-templates-grabbed t)) + (let ((result (vc-check-master-templates file (symbol-value sym)))) + (if (stringp result) + (vc-file-setprop file 'vc-name result) + nil)))) ; Not registered + +(defun vc-possible-master (s dirname basename) + (cond + ((stringp s) (format s dirname basename)) + ((functionp s) + ;; The template is a function to invoke. If the + ;; function returns non-nil, that means it has found a + ;; master. For backward compatibility, we also handle + ;; the case that the function throws a 'found atom + ;; and a pair (cons MASTER-FILE BACKEND). + (let ((result (catch 'found (funcall s dirname basename)))) + (if (consp result) (car result) result))))) + +(defun vc-check-master-templates (file templates) + "Return non-nil if there is a master corresponding to FILE. + +TEMPLATES is a list of strings or functions. If an element is a +string, it must be a control string as required by `format', with two +string placeholders, such as \"%sRCS/%s,v\". The directory part of +FILE is substituted for the first placeholder, the basename of FILE +for the second. If a file with the resulting name exists, it is taken +as the master of FILE, and returned. + +If an element of TEMPLATES is a function, it is called with the +directory part and the basename of FILE as arguments. It should +return non-nil if it finds a master; that value is then returned by +this function." + (let ((dirname (or (file-name-directory file) "")) + (basename (file-name-nondirectory file))) + (catch 'found + (mapcar + (lambda (s) + (let ((trial (vc-possible-master s dirname basename))) + (when (and trial (file-exists-p trial) + ;; Make sure the file we found with name + ;; TRIAL is not the source file itself. + ;; That can happen with RCS-style names if + ;; the file name is truncated (e.g. to 14 + ;; chars). See if either directory or + ;; attributes differ. + (or (not (string= dirname + (file-name-directory trial))) + (not (equal (file-attributes file) + (file-attributes trial))))) + (throw 'found trial)))) + templates)))) + +(provide 'vc-filewise) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index b62a640..8ce7ec8 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -454,19 +454,6 @@ If the argument is a list, the files must all have the same back end." "Return where the repository for the current directory is kept." (symbol-name (vc-backend file))) -(defun vc-master-name (file) - "Return the master name of FILE. -If the file is not registered, or the master name is not known, return nil." - ;; TODO: This should ultimately become obsolete, at least up here - ;; in vc-hooks. - (or (vc-file-getprop file 'vc-master-name) - ;; force computation of the property by calling - ;; vc-BACKEND-registered explicitly - (let ((backend (vc-backend file))) - (if (and backend - (vc-call-backend backend 'registered file)) - (vc-file-getprop file 'vc-master-name))))) - (defun vc-checkout-model (backend files) "Indicate how FILES are checked out. @@ -650,18 +637,6 @@ If FILE is not registered, this function always returns nil." (vc-file-setprop file 'vc-master-name result) nil)))) ; Not registered -(defun vc-possible-master (s dirname basename) - (cond - ((stringp s) (format s dirname basename)) - ((functionp s) - ;; The template is a function to invoke. If the - ;; function returns non-nil, that means it has found a - ;; master. For backward compatibility, we also handle - ;; the case that the function throws a 'found atom - ;; and a pair (cons MASTER-FILE BACKEND). - (let ((result (catch 'found (funcall s dirname basename)))) - (if (consp result) (car result) result))))) - (defun vc-check-master-templates (file templates) "Return non-nil if there is a master corresponding to FILE. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 90bf1f7..aa9337c 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2691,33 +2691,6 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (vc-mode-line file new-backend) (vc-checkin file new-backend comment (stringp comment))))) -(defun vc-rename-master (oldmaster newfile templates) - "Rename OLDMASTER to be the master file for NEWFILE based on TEMPLATES." - (let* ((dir (file-name-directory (expand-file-name oldmaster))) - (newdir (or (file-name-directory newfile) "")) - (newbase (file-name-nondirectory newfile)) - (masters - ;; List of potential master files for `newfile' - (mapcar - (lambda (s) (vc-possible-master s newdir newbase)) - templates))) - (when (or (file-symlink-p oldmaster) - (file-symlink-p (file-name-directory oldmaster))) - (error "This is unsafe in the presence of symbolic links")) - (rename-file - oldmaster - (catch 'found - ;; If possible, keep the master file in the same directory. - (dolist (f masters) - (when (and f (string= (file-name-directory (expand-file-name f)) dir)) - (throw 'found f))) - ;; If not, just use the first possible place. - (dolist (f masters) - (and f (or (not (setq dir (file-name-directory f))) - (file-directory-p dir)) - (throw 'found f))) - (error "New file lacks a version control directory"))))) - ;;;###autoload (defun vc-delete-file (file) "Delete file and mark it as such in the version control system. commit af46a2a43fab936a43d918fe0572eae51798a332 Author: Eric S. Raymond Date: Sat Nov 22 00:10:31 2014 -0500 Rename vc-name to vc-master-rename. * vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name. This is preaparatory to isolating all the 'master' functions used only by the file-oriented back ends. With this done first, the substantive diffs will be easier to read. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3e9dbfe..4ff1665 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-11-22 Eric S. Raymond + + * vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name. + This is preaparatory to isolating all the 'master' functions + used only by the file-oriented back ends. With this done first, + the substantive diffs will be easier to read. + 2014-11-21 Rüdiger Sonderfeld * play/morse.el (nato-alphabet): Mark URL in docstring in a way diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 28fbaae..b62a640 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -454,18 +454,18 @@ If the argument is a list, the files must all have the same back end." "Return where the repository for the current directory is kept." (symbol-name (vc-backend file))) -(defun vc-name (file) +(defun vc-master-name (file) "Return the master name of FILE. If the file is not registered, or the master name is not known, return nil." ;; TODO: This should ultimately become obsolete, at least up here ;; in vc-hooks. - (or (vc-file-getprop file 'vc-name) + (or (vc-file-getprop file 'vc-master-name) ;; force computation of the property by calling ;; vc-BACKEND-registered explicitly (let ((backend (vc-backend file))) (if (and backend (vc-call-backend backend 'registered file)) - (vc-file-getprop file 'vc-name))))) + (vc-file-getprop file 'vc-master-name))))) (defun vc-checkout-model (backend files) "Indicate how FILES are checked out. @@ -647,7 +647,7 @@ If FILE is not registered, this function always returns nil." (put backend 'vc-templates-grabbed t)) (let ((result (vc-check-master-templates file (symbol-value sym)))) (if (stringp result) - (vc-file-setprop file 'vc-name result) + (vc-file-setprop file 'vc-master-name result) nil)))) ; Not registered (defun vc-possible-master (s dirname basename) diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 2d713c9..0b839a6 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -238,11 +238,11 @@ When VERSION is given, perform check for that version." (if (vc-rcs-trunk-p version) (progn ;; Compare VERSION to the head version number. - (vc-insert-file (vc-name file) "^[0-9]") + (vc-insert-file (vc-master-name file) "^[0-9]") (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) ;; If we are not on the trunk, we need to examine the ;; whole current branch. - (vc-insert-file (vc-name file) "^desc") + (vc-insert-file (vc-master-name file) "^desc") (vc-rcs-find-most-recent-rev (vc-branch-part version)))))) (defun vc-rcs-workfile-unchanged-p (file) @@ -309,9 +309,9 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." (match-string 1)))) ;; if we couldn't find the master name, ;; run vc-rcs-registered to get it - ;; (will be stored into the vc-name property) + ;; (will be stored into the vc-master-name property) (vc-rcs-registered file) - (vc-file-setprop file 'vc-name + (vc-file-setprop file 'vc-master-name (if (file-name-absolute-p name) name (expand-file-name @@ -343,7 +343,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." "Unregister FILE from RCS. If this leaves the RCS subdirectory empty, ask the user whether to remove it." - (let* ((master (vc-name file)) + (let* ((master (vc-master-name file)) (dir (file-name-directory master)) (backup-info (find-backup-file-name master))) (if (not backup-info) @@ -379,7 +379,7 @@ whether to remove it." (if old-version (setq rev (vc-branch-part old-version)) (error "can't find current branch")) - (apply #'vc-do-command "*vc*" 0 "ci" (vc-name file) + (apply #'vc-do-command "*vc*" 0 "ci" (vc-master-name file) ;; if available, use the secure check-in option (and (vc-rcs-release-p "5.6.4") "-j") (concat (if vc-keep-workfiles "-u" "-r") rev) @@ -411,12 +411,12 @@ whether to remove it." (if (not (vc-rcs-release-p "5.6.2")) ;; exit status of 1 is also accepted. ;; It means that the lock was removed before. - (vc-do-command "*vc*" 1 "rcs" (vc-name file) + (vc-do-command "*vc*" 1 "rcs" (vc-master-name file) (concat "-u" old-version))))))))) (defun vc-rcs-find-revision (file rev buffer) (apply #'vc-do-command - (or buffer "*vc*") 0 "co" (vc-name file) + (or buffer "*vc*") 0 "co" (vc-master-name file) "-q" ;; suppress diagnostic output (concat "-p" rev) (vc-switches 'RCS 'checkout))) @@ -448,7 +448,7 @@ attempt the checkout for all registered files beneath it." (vc-rcs-set-default-branch file nil)) ;; now do the checkout (apply #'vc-do-command - "*vc*" 0 "co" (vc-name file) + "*vc*" 0 "co" (vc-master-name file) ;; If locking is not strict, force to overwrite ;; the writable workfile. (if (eq (vc-rcs-checkout-model (list file)) 'implicit) "-f") @@ -501,7 +501,7 @@ expanded to all registered subfiles in them." discard file))) (error "Aborted")) (message "Removing revision %s from %s." discard file) - (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-o" discard)) + (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) (concat "-o" discard)) ;; Check out the most recent remaining version. If it ;; fails, because the whole branch got deleted, do a ;; double-take and check out the version where the branch @@ -509,7 +509,7 @@ expanded to all registered subfiles in them." (while (not done) (condition-case err (progn - (vc-do-command "*vc*" 0 "co" (vc-name file) "-f" + (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" (concat "-u" previous)) (setq done t)) (error (set-buffer "*vc*") @@ -529,14 +529,14 @@ expanded to all registered subfiles in them." revert all registered files beneath it." (if (file-directory-p file) (mapc 'vc-rcs-revert (vc-expand-dirs (list file))) - (vc-do-command "*vc*" 0 "co" (vc-name file) "-f" + (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" (concat (if (eq (vc-state file) 'edited) "-u" "-r") (vc-working-revision file))))) (defun vc-rcs-merge (file first-version &optional second-version) "Merge changes into current working copy of FILE. The changes are between FIRST-VERSION and SECOND-VERSION." - (vc-do-command "*vc*" 1 "rcsmerge" (vc-name file) + (vc-do-command "*vc*" 1 "rcsmerge" (vc-master-name file) "-kk" ; ignore keyword conflicts (concat "-r" first-version) (if second-version (concat "-r" second-version)))) @@ -547,16 +547,16 @@ If FILE is a directory, steal the lock on all registered files beneath it. Needs RCS 5.6.2 or later for -M." (if (file-directory-p file) (mapc 'vc-rcs-steal-lock (vc-expand-dirs (list file))) - (vc-do-command "*vc*" 0 "rcs" (vc-name file) "-M" (concat "-u" rev)) + (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) "-M" (concat "-u" rev)) ;; Do a real checkout after stealing the lock, so that we see ;; expanded headers. - (vc-do-command "*vc*" 0 "co" (vc-name file) "-f" (concat "-l" rev)))) + (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" (concat "-l" rev)))) (defun vc-rcs-modify-change-comment (files rev comment) "Modify the change comments change on FILES on a specified REV. If FILE is a directory the operation is applied to all registered files beneath it." (dolist (file (vc-expand-dirs files)) - (vc-do-command "*vc*" 0 "rcs" (vc-name file) + (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) (concat "-m" rev ":" comment)))) @@ -582,7 +582,7 @@ Remaining arguments are ignored. If FILE is a directory the operation is applied to all registered files beneath it." (vc-do-command (or buffer "*vc*") 0 "rlog" - (mapcar 'vc-name (vc-expand-dirs files))) + (mapcar 'vc-master-name (vc-expand-dirs files))) (with-current-buffer (or buffer "*vc*") (vc-rcs-print-log-cleanup)) (when limit 'limit-unsupported)) @@ -845,7 +845,7 @@ systime, or nil if there is none. Also, reposition point." (vc-file-tree-walk dir (lambda (f) - (vc-do-command "*vc*" 0 "rcs" (vc-name f) (concat "-n" name ":"))))))) + (vc-do-command "*vc*" 0 "rcs" (vc-master-name f) (concat "-n" name ":"))))))) ;;; @@ -978,7 +978,7 @@ Uses `rcs2log' which only works for RCS and CVS." (defun vc-rcs-rename-file (old new) ;; Just move the master file (using vc-rcs-master-templates). - (vc-rename-master (vc-name old) new vc-rcs-master-templates)) + (vc-rename-master (vc-master-name old) new vc-rcs-master-templates)) (defun vc-rcs-find-file-hook () ;; If the file is locked by some other user, make @@ -997,7 +997,7 @@ Uses `rcs2log' which only works for RCS and CVS." This likely means that FILE has been changed with respect to its master version." (let ((file-time (nth 5 (file-attributes file))) - (master-time (nth 5 (file-attributes (vc-name file))))) + (master-time (nth 5 (file-attributes (vc-master-name file))))) (or (> (nth 0 file-time) (nth 0 master-time)) (and (= (nth 0 file-time) (nth 0 master-time)) (> (nth 1 file-time) (nth 1 master-time)))))) @@ -1024,10 +1024,10 @@ This function sets the properties `vc-working-revision' and `vc-checkout-model' to their correct values, based on the master file." (with-temp-buffer - (if (or (not (vc-insert-file (vc-name file) "^[0-9]")) + (if (or (not (vc-insert-file (vc-master-name file) "^[0-9]")) (progn (goto-char (point-min)) (not (looking-at "^head[ \t\n]+[^;]+;$")))) - (error "File %s is not an RCS master file" (vc-name file))) + (error "File %s is not an RCS master file" (vc-master-name file))) (let ((workfile-is-latest nil) (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1))) (vc-file-setprop file 'vc-rcs-default-branch default-branch) @@ -1047,7 +1047,7 @@ file." default-branch) (setq working-revision default-branch)) ;; else, search for the head of the default branch - (t (vc-insert-file (vc-name file) "^desc") + (t (vc-insert-file (vc-master-name file) "^desc") (setq working-revision (vc-rcs-find-most-recent-rev default-branch)) (setq workfile-is-latest t))) @@ -1238,7 +1238,7 @@ variable `vc-rcs-release' is set to the returned value." (set-file-modes file (logior (file-modes file) 128))) (defun vc-rcs-set-default-branch (file branch) - (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-b" branch)) + (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) (concat "-b" branch)) (vc-file-setprop file 'vc-rcs-default-branch branch)) (defun vc-rcs-parse (&optional buffer) diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index f1e437b..780efc4 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -181,7 +181,7 @@ For a description of possible values, see `vc-check-master-templates'." ;; To find this number, search the entire delta table, ;; rather than just the first entry, because the ;; first entry might be a deleted ("R") revision. - (vc-insert-file (vc-name file) "^\001e\n\001[^s]") + (vc-insert-file (vc-master-name file) "^\001e\n\001[^s]") (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1))) ;; Cf vc-sccs-find-revision. @@ -189,7 +189,7 @@ For a description of possible values, see `vc-check-master-templates'." "Write the SCCS version of input file FILE to output file OUTFILE. Optional string REV is a revision." (with-temp-buffer - (apply 'vc-sccs-do-command t 0 "get" (vc-name file) + (apply 'vc-sccs-do-command t 0 "get" (vc-master-name file) (append '("-s" "-p" "-k") ; -k: no keyword expansion (if rev (list (concat "-r" rev))))) (write-region nil nil outfile nil 'silent))) @@ -233,10 +233,10 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." (let* ((dirname (or (file-name-directory file) "")) (basename (file-name-nondirectory file)) (project-file (vc-sccs-search-project-dir dirname basename))) - (let ((vc-name + (let ((vc-master-name (or project-file (format (car vc-sccs-master-templates) dirname basename)))) - (apply 'vc-sccs-do-command nil 0 "admin" vc-name + (apply 'vc-sccs-do-command nil 0 "admin" vc-master-name (and rev (not (string= rev "")) (concat "-r" rev)) "-fb" (concat "-i" (file-relative-name file)) @@ -244,7 +244,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." (vc-switches 'SCCS 'register))) (delete-file file) (if vc-keep-workfiles - (vc-sccs-do-command nil 0 "get" (vc-name file)))))) + (vc-sccs-do-command nil 0 "get" (vc-master-name file)))))) (defun vc-sccs-responsible-p (file) "Return non-nil if SCCS thinks it would be responsible for registering FILE." @@ -256,15 +256,15 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." (defun vc-sccs-checkin (files comment) "SCCS-specific version of `vc-backend-checkin'." (dolist (file (vc-expand-dirs files)) - (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) + (apply 'vc-sccs-do-command nil 0 "delta" (vc-master-name file) (concat "-y" comment) (vc-switches 'SCCS 'checkin)) (if vc-keep-workfiles - (vc-sccs-do-command nil 0 "get" (vc-name file))))) + (vc-sccs-do-command nil 0 "get" (vc-master-name file))))) (defun vc-sccs-find-revision (file rev buffer) (apply 'vc-sccs-do-command - buffer 0 "get" (vc-name file) + buffer 0 "get" (vc-master-name file) "-s" ;; suppress diagnostic output "-p" (and rev @@ -298,7 +298,7 @@ locked. REV is the revision to check out." (and rev (or (string= rev "") (not (stringp rev))) (setq rev nil)) - (apply 'vc-sccs-do-command nil 0 "get" (vc-name file) + (apply 'vc-sccs-do-command nil 0 "get" (vc-master-name file) "-e" (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) switches)))) @@ -317,16 +317,16 @@ are expanded to all version-controlled subfiles." (error "Aborted")) (message "Removing revision %s from %s..." discard file) (vc-sccs-do-command nil 0 "rmdel" - (vc-name file) (concat "-r" discard)) - (vc-sccs-do-command nil 0 "get" (vc-name file) nil)))) + (vc-master-name file) (concat "-r" discard)) + (vc-sccs-do-command nil 0 "get" (vc-master-name file) nil)))) (defun vc-sccs-revert (file &optional _contents-done) "Revert FILE to the version it was based on. If FILE is a directory, revert all subfiles." (if (file-directory-p file) (mapc 'vc-sccs-revert (vc-expand-dirs (list file))) - (vc-sccs-do-command nil 0 "unget" (vc-name file)) - (vc-sccs-do-command nil 0 "get" (vc-name file)) + (vc-sccs-do-command nil 0 "unget" (vc-master-name file)) + (vc-sccs-do-command nil 0 "get" (vc-master-name file)) ;; Checking out explicit revisions is not supported under SCCS, yet. ;; We always "revert" to the latest revision; therefore ;; vc-working-revision is cleared here so that it gets recomputed. @@ -337,14 +337,14 @@ revert all subfiles." (if (file-directory-p file) (mapc 'vc-sccs-steal-lock (vc-expand-dirs (list file))) (vc-sccs-do-command nil 0 "unget" - (vc-name file) "-n" (if rev (concat "-r" rev))) + (vc-master-name file) "-n" (if rev (concat "-r" rev))) (vc-sccs-do-command nil 0 "get" - (vc-name file) "-g" (if rev (concat "-r" rev))))) + (vc-master-name file) "-g" (if rev (concat "-r" rev))))) (defun vc-sccs-modify-change-comment (files rev comment) "Modify (actually, append to) the change comments for FILES on a specified REV." (dolist (file (vc-expand-dirs files)) - (vc-sccs-do-command nil 0 "cdc" (vc-name file) + (vc-sccs-do-command nil 0 "cdc" (vc-master-name file) (concat "-y" comment) (concat "-r" rev)))) @@ -356,7 +356,7 @@ revert all subfiles." "Print commit log associated with FILES into specified BUFFER. Remaining arguments are ignored." (setq files (vc-expand-dirs files)) - (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files)) + (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-master-name files)) (when limit 'limit-unsupported)) (autoload 'vc-setup-buffer "vc-dispatcher") @@ -475,12 +475,12 @@ Remaining arguments are ignored." (defun vc-sccs-rename-file (old new) ;; Move the master file (using vc-rcs-master-templates). - (vc-rename-master (vc-name old) new vc-sccs-master-templates) + (vc-rename-master (vc-master-name old) new vc-sccs-master-templates) ;; Update the tag file. (with-current-buffer (find-file-noselect (expand-file-name vc-sccs-name-assoc-file - (file-name-directory (vc-name old)))) + (file-name-directory (vc-master-name old)))) (goto-char (point-min)) ;; (replace-regexp (concat ":" (regexp-quote old) "$") (concat ":" new)) (while (re-search-forward (concat ":" (regexp-quote old) "$") nil t) @@ -524,7 +524,7 @@ find any project directory." (defun vc-sccs-lock-file (file) "Generate lock file name corresponding to FILE." - (let ((master (vc-name file))) + (let ((master (vc-master-name file))) (and master (string-match "\\(.*/\\)\\(s\\.\\)\\(.*\\)" master) @@ -546,7 +546,7 @@ The result is a list of the form ((REVISION . USER) (REVISION . USER) ...)." (with-current-buffer (find-file-noselect (expand-file-name vc-sccs-name-assoc-file - (file-name-directory (vc-name file)))) + (file-name-directory (vc-master-name file)))) (goto-char (point-max)) (insert name "\t:\t" file "\t" rev "\n") (basic-save-buffer) @@ -562,7 +562,7 @@ If NAME is nil or a revision number string it's just passed through." (with-temp-buffer (vc-insert-file (expand-file-name vc-sccs-name-assoc-file - (file-name-directory (vc-name file)))) + (file-name-directory (vc-master-name file)))) (vc-parse-buffer (concat name "\t:\t" file "\t\\(.+\\)") 1)))) (provide 'vc-sccs) commit 280eb43f6521d7803ecf581982f18be51bd350c5 Author: Rüdiger Sonderfeld Date: Fri Nov 21 20:16:34 2014 +0100 lisp/ChangeLog: Use double space to end sentence. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 99c9407..3e9dbfe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -30,23 +30,23 @@ 2014-11-20 Eric S. Raymond - * vc/vc-src.el, vc/vc.el: Added support for SRC. Needs more + * vc/vc-src.el, vc/vc.el: Added support for SRC. Needs more testing and a real log-view mode. * vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el: Remove editable argument from the backend checkout methods; where it matters (which is only in SCCS and RCS) - files are always checked out editable. This may actually have + files are always checked out editable. This may actually have been dynamically true already - it looks like the vc-next-action - code evolved past visiting the other case. Tested with RCS. + code evolved past visiting the other case. Tested with RCS. * vc/vc-arch.el, vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el: Remove never-used rev - argument from the backend checkin methods. Only the RCS, SCCS, and - CVS back ends tried to do anything with it, and that code was - never exercised. Chiseling away the cruft of decades... + argument from the backend checkin methods. Only the RCS, SCCS, + and CVS back ends tried to do anything with it, and that code was + never exercised. Chiseling away the cruft of decades... 2014-11-19 Lars Magne Ingebrigtsen commit 65ed0f3ba9c4b6626ce8608c212fa5c0a4addd6c Author: Rüdiger Sonderfeld Date: Fri Nov 21 20:08:19 2014 +0100 Fix `nato-alphabet' docstring. * play/morse.el (nato-alphabet): Mark URL in docstring in a way that is recognized by `help-mode'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e174d59..99c9407 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-21 Rüdiger Sonderfeld + + * play/morse.el (nato-alphabet): Mark URL in docstring in a way + that is recognized by `help-mode'. + 2014-11-21 Stefan Monnier * desktop.el (desktop-create-buffer): Use activate-mark to set diff --git a/lisp/play/morse.el b/lisp/play/morse.el index 5394d3f..da593d7 100644 --- a/lisp/play/morse.el +++ b/lisp/play/morse.el @@ -146,7 +146,7 @@ "NATO phonetic alphabet. See ''International Code of Signals'' (INTERCO), United States Edition, 1969 Edition (Revised 2003) available from National -Geospatial-Intelligence Agency at http://www.nga.mil/") +Geospatial-Intelligence Agency at URL `http://www.nga.mil/'") ;;;###autoload (defun morse-region (beg end) commit bf642130c1694c4c4cb0b981d3fa3044db6ed5fe Author: Stefan Monnier Date: Fri Nov 21 13:01:40 2014 -0500 * lisp/desktop.el (desktop-create-buffer): Use activate-mark to set `mark-active' (bug#19058). diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6bf57b6..e174d59 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,12 @@ +2014-11-21 Stefan Monnier + + * desktop.el (desktop-create-buffer): Use activate-mark to set + `mark-active' (bug#19058). + 2014-11-21 Eric S. Raymond - * vc/vc-src.el (vc-src-state): Fix bug that produced spurious nil state. + * vc/vc-src.el (vc-src-state): Fix bug that produced spurious + nil state. 2014-11-21 Eli Zaretskii @@ -108,8 +114,8 @@ 2014-11-18 Leo Liu * emacs-lisp/nadvice.el (define-advice): New macro. - * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add - define-advice. + * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): + Add define-advice. (lisp-font-lock-keywords-1): Add define-advice. 2014-11-18 Daiki Ueno @@ -188,26 +194,26 @@ immediately marked as obsolete, used to handle deprecated `tildify-ignored-environments-alist'. - * textmodes/tex-mode.el (tex-common-initialization): Set - `tildify-space-string' and `tildify-foreach-region-function' + * textmodes/tex-mode.el (tex-common-initialization): + Set `tildify-space-string' and `tildify-foreach-region-function' variables in all variants of TeX mode since `tildify-string-alist' and `tildify-ignored-environments-alist' are now empty by default. - * nxml/nxml-mode.el (nxml-mode): Ditto in `nxml-mode'. If - encoding supports it use no-break space instead of character + * nxml/nxml-mode.el (nxml-mode): Ditto in `nxml-mode'. + If encoding supports it use no-break space instead of character entity; this changes previous default which used a numeric reference. - * textmodes/sgml-mode.el (sgml-mode): ditto in `sgml-mode'. If - encoding does not support no-break space, use numeric reference; + * textmodes/sgml-mode.el (sgml-mode): ditto in `sgml-mode'. + If encoding does not support no-break space, use numeric reference; this changes previous default which used named entity (“ ”) in HTML mode. 2014-11-17 Ulf Jasper Fix bug#5433. - * calendar/icalendar.el (icalendar-export-alarms): New - customizable variable. + * calendar/icalendar.el (icalendar-export-alarms): + New customizable variable. (icalendar-export-region): Export alarms as specified in `icalendar-export-alarms'. (icalendar--create-ical-alarm, icalendar--do-create-ical-alarm): @@ -2838,8 +2844,8 @@ (c-typeless-decl-kwds): Append "auto" onto the C++ value. (c-not-decl-init-keywords): Also exclude c-typeof-kwds from value. - Make ">>" act as double template ender in C++ Mode. Fix - bug#11386. + Make ">>" act as double template ender in C++ Mode. + Fix bug#11386. * progmodes/cc-langs.el (c->-op-cont-tokens): New lang-const split off from c->-op-cont-re. (c->-op-cont-tokens): Change to use the above. diff --git a/lisp/desktop.el b/lisp/desktop.el index 360ff48..bad0073 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1413,8 +1413,8 @@ after that many seconds of idle time." (if (consp desktop-buffer-mark) (progn (move-marker (mark-marker) (car desktop-buffer-mark)) - ;; FIXME: Should we call (de)activate-mark instead? - (setq mark-active (car (cdr desktop-buffer-mark)))) + (if (car (cdr desktop-buffer-mark)) + (activate-mark 'dont-touch-tmm))) (move-marker (mark-marker) desktop-buffer-mark))) ;; Never override file system if the file really is read-only marked. (when desktop-buffer-read-only (setq buffer-read-only desktop-buffer-read-only)) commit c39443c1d651bab2eb023f4c38db418c3dc04160 Author: Ulf Jasper Date: Fri Nov 21 16:31:30 2014 +0100 'libxml-parse(html|xml)-region': new optional param 'discard-comments'. * doc/lispref/text.texi (Parsing HTML/XML): Document new optional parameter 'discard-comments' of 'libxml-parse(html|xml)-region'. * src/xml.c (parse_region): Take care of new optional parameter 'discard-comments' of 'libxml-parse(html|xml)-region'. (Flibxml_parse_html_region, Flibxml_parse_xml_region): New optional parameter 'discard-comments'. * test/automated/libxml-tests.el (libxml-tests--data-comments-preserved): Renamed from 'libxml-tests--data'. (libxml-tests--data-comments-discarded): New. (libxml-tests): Check whether 'libxml-parse-xml-region' is discarding comments correctly. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 6706f93..0c8792a 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2014-11-21 Ulf Jasper + + * text.texi (Parsing HTML/XML): Document new optional parameter + 'discard-comments' of 'libxml-parse(html|xml)-region'. + 2014-11-18 Leo Liu * functions.texi (Advising Named Functions): Document diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index d1a1e6f..7c88a5b 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -4324,7 +4324,7 @@ coding instead. When Emacs is compiled with libxml2 support, the following functions are available to parse HTML or XML text into Lisp object trees. -@defun libxml-parse-html-region start end &optional base-url +@defun libxml-parse-html-region start end &optional base-url discard-comments This function parses the text between @var{start} and @var{end} as HTML, and returns a list representing the HTML @dfn{parse tree}. It attempts to handle ``real world'' HTML by robustly coping with syntax @@ -4333,6 +4333,9 @@ mistakes. The optional argument @var{base-url}, if non-@code{nil}, should be a string specifying the base URL for relative URLs occurring in links. +If the optional argument @var{discard-comments} is non-@code{nil}, +then the parse tree is created without any comments. + In the parse tree, each HTML node is represented by a list in which the first element is a symbol representing the node name, the second element is an alist of node attributes, and the remaining elements are @@ -4368,7 +4371,7 @@ buffer. The argument @var{dom} should be a list as generated by @end defun @cindex parsing xml -@defun libxml-parse-xml-region start end &optional base-url +@defun libxml-parse-xml-region start end &optional base-url discard-comments This function is the same as @code{libxml-parse-html-region}, except that it parses the text as XML rather than HTML (so it is stricter about syntax). diff --git a/src/ChangeLog b/src/ChangeLog index b169479..f8c9c5a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-11-21 Ulf Jasper + + * xml.c (parse_region): Take care of new optional parameter + 'discard-comments' of 'libxml-parse(html|xml)-region'. + (Flibxml_parse_html_region, Flibxml_parse_xml_region): New + optional parameter 'discard-comments'. + 2014-11-17 Paul Eggert Improve time stamp handling, and be more consistent about it. diff --git a/src/xml.c b/src/xml.c index 7e99beb..d418202 100644 --- a/src/xml.c +++ b/src/xml.c @@ -175,7 +175,7 @@ make_dom (xmlNode *node) } static Lisp_Object -parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int htmlp) +parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments, int htmlp) { xmlDoc *doc; Lisp_Object result = Qnil; @@ -214,21 +214,24 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html if (doc != NULL) { - /* If the document is just comments, then this should get us the - nodes anyway. */ - xmlNode *n = doc->children; Lisp_Object r = Qnil; - - while (n) { - if (!NILP (r)) - result = Fcons (r, result); - r = make_dom (n); - n = n->next; - } + if (NILP(discard_comments)) + { + /* If the document has toplevel comments, then this should + get us the nodes and the comments. */ + xmlNode *n = doc->children; + + while (n) { + if (!NILP (r)) + result = Fcons (r, result); + r = make_dom (n); + n = n->next; + } + } if (NILP (result)) { - /* The document isn't just comments, so get the tree the - proper way. */ + /* The document doesn't have toplevel comments or we discarded + them. Get the tree the proper way. */ xmlNode *node = fn_xmlDocGetRootElement (doc); if (node != NULL) result = make_dom (node); @@ -251,25 +254,27 @@ xml_cleanup_parser (void) DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, Slibxml_parse_html_region, - 2, 3, 0, + 2, 4, 0, doc: /* Parse the region as an HTML document and return the parse tree. -If BASE-URL is non-nil, it is used to expand relative URLs. */) - (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) +If BASE-URL is non-nil, it is used to expand relative URLs. +If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */) + (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) { if (init_libxml2_functions ()) - return parse_region (start, end, base_url, 1); + return parse_region (start, end, base_url, discard_comments, 1); return Qnil; } DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region, Slibxml_parse_xml_region, - 2, 3, 0, + 2, 4, 0, doc: /* Parse the region as an XML document and return the parse tree. -If BASE-URL is non-nil, it is used to expand relative URLs. */) - (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) +If BASE-URL is non-nil, it is used to expand relative URLs. +If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */) + (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) { if (init_libxml2_functions ()) - return parse_region (start, end, base_url, 0); + return parse_region (start, end, base_url, discard_comments, 0); return Qnil; } diff --git a/test/ChangeLog b/test/ChangeLog index 475b6a3..d0988e4 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,12 @@ +2014-11-21 Ulf Jasper + + * automated/libxml-tests.el + (libxml-tests--data-comments-preserved): Renamed from + 'libxml-tests--data'. + (libxml-tests--data-comments-discarded): New. + (libxml-tests): Check whether 'libxml-parse-xml-region' is + discarding comments correctly. + 2014-11-17 Michal Nazarewicz * automated/tildify-tests.el (tildify-test-html, tildify-test-xml): diff --git a/test/automated/libxml-tests.el b/test/automated/libxml-tests.el index ced0df7..6b6d017 100644 --- a/test/automated/libxml-tests.el +++ b/test/automated/libxml-tests.el @@ -27,7 +27,7 @@ (require 'ert) -(defvar libxml-tests--data +(defvar libxml-tests--data-comments-preserved `(;; simple case ("bar" . (foo ((baz . "true")) "bar")) @@ -40,17 +40,35 @@ "blub") . (top nil (comment nil "comment-a") (foo ((a . "b")) (bar nil "blub")) (comment nil "comment-b") (comment nil "comment-c")))) - "Alist of XML strings and their expected parse trees.") + "Alist of XML strings and their expected parse trees for preserved comments.") + +(defvar libxml-tests--data-comments-discarded + `(;; simple case + ("bar" + . (foo ((baz . "true")) "bar")) + ;; toplevel comments -- first document child must not get lost + (,(concat "bar" + "") + . (foo nil "bar")) + (,(concat "" + "blub") + . (foo ((a . "b")) (bar nil "blub")))) + "Alist of XML strings and their expected parse trees for discarded comments.") (ert-deftest libxml-tests () "Test libxml." (when (fboundp 'libxml-parse-xml-region) (with-temp-buffer - (dolist (test libxml-tests--data) + (dolist (test libxml-tests--data-comments-preserved) + (erase-buffer) + (insert (car test)) + (should (equal (cdr test) + (libxml-parse-xml-region (point-min) (point-max))))) + (dolist (test libxml-tests--data-comments-discarded) (erase-buffer) (insert (car test)) (should (equal (cdr test) - (libxml-parse-xml-region (point-min) (point-max)))))))) + (libxml-parse-xml-region (point-min) (point-max) nil t))))))) ;;; libxml-tests.el ends here commit e14c4354cf29fab12fb414c7ebc94bf1a9920dd0 Author: Eric S. Raymond Date: Fri Nov 21 07:29:51 2014 -0500 Fix bug that produced spurious nil state. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ffa3823..6bf57b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-21 Eric S. Raymond + + * vc/vc-src.el (vc-src-state): Fix bug that produced spurious nil state. + 2014-11-21 Eli Zaretskii * vc/vc.el (vc-deduce-fileset): Support invocation from diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index d0787b0..520708c 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -159,6 +159,7 @@ For a description of possible values, see `vc-check-master-templates'." "SRC-specific version of `vc-state'." (let* ((status nil) + (default-directory (file-name-directory file)) (out (with-output-to-string (with-current-buffer @@ -168,7 +169,7 @@ For a description of possible values, see `vc-check-master-templates'." (condition-case nil (process-file vc-src-program nil t nil - "status" "-a" file) + "status" "-a" (file-relative-name file)) (error nil))))))) (when (eq 0 status) (when (null (string-match "does not exist or is unreadable" out)) commit a131037e97fa2576c3d46763486b0bc7e213ad3b Author: Eli Zaretskii Date: Fri Nov 21 12:14:32 2014 +0200 Fix bug #19084 with 'C-x v +' in *vc-change-log* buffers. lisp/vc/vc.el (vc-deduce-fileset): Support invocation from *vc-change-log* buffer. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4169e83..ffa3823 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-21 Eli Zaretskii + + * vc/vc.el (vc-deduce-fileset): Support invocation from + *vc-change-log* buffer. (Bug#19084) + 2014-11-13 Matthew Leach * arc-mode.el (archive-visit-single-files): New. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c7e19a6..90bf1f7 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -999,6 +999,9 @@ current buffer." (if observer (vc-dired-deduce-fileset) (error "State changing VC operations not supported in `dired-mode'"))) + ((and (derived-mode-p 'log-view-mode) + (setq backend (vc-responsible-backend default-directory))) + (list backend default-directory)) ((setq backend (vc-backend buffer-file-name)) (if state-model-only-files (list backend (list buffer-file-name) commit 48039f4b4c8f7651a56e5b61612aac64585a790a Author: Matthew Leach Date: Fri Nov 21 12:08:00 2014 +0200 Fix bug #1702 with missing feature in arc-mode.el. lisp/arc-mode.el (archive-visit-single-files): New. (archive-mode): Visit file if archive contains a single file. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9d5d727..4169e83 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-11-13 Matthew Leach + + * arc-mode.el (archive-visit-single-files): New. + (archive-mode): Visit file if archive contains a single file. + (Bug#1702) + 2014-11-21 Ulrich Müller * vc/vc.el: Fix a typo in the commentary. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index a9f0ec7..df04521 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -147,6 +147,15 @@ A local copy of the archive will be used when updating." "Hook run when an archive member has been extracted." :type 'hook :group 'archive) + +(defcustom archive-visit-single-files nil + "If non-nil, opening an archive with a single file visits that file. + + If this option's value is nil, visiting such archives will + display the archive summary." + :type '(choice (const :tag "Visit the single file" t) + (const :tag "Show the archive summary" nil)) + :group 'archive) ;; ------------------------------ ;; Arc archive configuration @@ -742,7 +751,12 @@ archive. (if (default-value 'enable-multibyte-characters) (set-buffer-multibyte 'to)) (archive-summarize nil) - (setq buffer-read-only t)))) + (setq buffer-read-only t) + (when (and archive-visit-single-files + auto-compression-mode + (= (length archive-files) 1)) + (rename-buffer (concat " " (buffer-name))) + (archive-extract))))) ;; Archive mode is suitable only for specially formatted data. (put 'archive-mode 'mode-class 'special) commit 1b351d4673842c41183e3573a110e74025b785ce Author: Eli Zaretskii Date: Fri Nov 21 11:32:53 2014 +0200 Fix the build of the Emacs User manual. doc/emacs/maintaining.texi (Version Control Systems): Move "@end itemize" past the last @item. Fix a typo (reported by H. Dieter Wilhelm ). diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index f5109e0..aa9804f 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,12 @@ +2014-11-21 Eli Zaretskii + + * maintaining.texi (Version Control Systems): Move "@end itemize" + past the last @item. + +2014-11-21 H. Dieter Wilhelm + + * maintaining.texi (Version Control Systems): Fix a typo. + 2014-11-20 Eric S. Raymond * maintaining.texi: Document SRC support. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 761e67d..ea6d60d 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -191,7 +191,6 @@ exception of repository sync operations. Bazaar (bzr) is a decentralized version control system that supports both repository-based and decentralized versioning. VC supports most basic editing operations under Bazaar. -@end itemize @cindex SRC @cindex src @@ -199,11 +198,12 @@ basic editing operations under Bazaar. SRC (src) is RCS, reloaded - a specialized version-control system designed for single-file projects worked on by only one person. It allows multiple files with independent version-control histories to -exisr in one directory, and is thus particularly well suited for +exist in one directory, and is thus particularly well suited for maintaining small documents, scripts, and dotfiles. While it uses RCS for revision storage, it presents a modern user interface featuring lockless operation and integer sequential version numbers. VC supports almost all SRC operations. +@end itemize @node VCS Concepts @subsubsection Concepts of Version Control commit a2c0a14c323401e6f113f999acf5729b29b136e9 Author: Ulrich Mueller Date: Fri Nov 21 11:21:50 2014 +0200 Fix bug #19136 with a typo in a vc.el comment. lisp/vc/vc.el: Fix a typo in the commentary. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca8d678..9d5d727 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-21 Ulrich Müller + + * vc/vc.el: Fix a typo in the commentary. + 2014-11-20 Eric S. Raymond * vc/vc-src.el, vc/vc.el: Added support for SRC. Needs more diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 5d63b57..c7e19a6 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -52,7 +52,7 @@ ;; This mode is fully documented in the Emacs user's manual. ;; -;; Supported version-control systems presently include CVS, RCS, SCR, GNU +;; Supported version-control systems presently include CVS, RCS, SRC, GNU ;; Arch, Subversion, Bzr, Git, Mercurial, Monotone and SCCS ;; (or its free replacement, CSSC). ;; commit f9c0081e985f80d25619d2d826c6983dc0172b1b Author: Eric S. Raymond Date: Thu Nov 20 22:44:07 2014 -0500 Clean up after SRC support merge (typo fixes). diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 31ae9bf..28fbaae 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -118,7 +118,7 @@ Removing an entry from the list prevents VC from being activated when visiting a file managed by that backend. An empty list disables VC altogether." :type '(repeat symbol) - :version "23.1" + :version "25.1" :group 'vc) ;; Note: we don't actually have a darcs back end yet. diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index 18fac0e..d0787b0 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -142,7 +142,7 @@ For a description of possible values, see `vc-check-master-templates'." ;;; Properties of the backend (defun vc-src-revision-granularity () 'file) -(defun vc-hg-checkout-model (_files) 'implicit) +(defun vc-src-checkout-model (_files) 'implicit) ;;; ;;; State-querying functions @@ -302,7 +302,7 @@ If LIMIT is non-nil, show no more than this many entries." (apply 'vc-src-command buffer files (if shortlog "list" "log") (nconc ;;(when start-revision (list (format "%s-1" start-revision))) - ;;(when limit (list "-l" (format "%s" limit))) + (when limit (list "-l" (format "%s" limit))) vc-src-log-switches))))) (defun vc-src-diff (files &optional oldvers newvers buffer) commit 1e81f6769013e1a0df9e10d7c5d0a3e3ca131143 Author: Eric S. Raymond Date: Thu Nov 20 17:57:22 2014 -0500 Support for SRC in VC mode. diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 68ac9f5..f5109e0 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2014-11-20 Eric S. Raymond + + * maintaining.texi: Document SRC support. + 2014-11-10 Glenn Morris * Makefile.in (top_srcdir, version): New, set by configure. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index e066c49..761e67d 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -193,6 +193,18 @@ both repository-based and decentralized versioning. VC supports most basic editing operations under Bazaar. @end itemize +@cindex SRC +@cindex src +@item +SRC (src) is RCS, reloaded - a specialized version-control system +designed for single-file projects worked on by only one person. It +allows multiple files with independent version-control histories to +exisr in one directory, and is thus particularly well suited for +maintaining small documents, scripts, and dotfiles. While it uses RCS +for revision storage, it presents a modern user interface featuring +lockless operation and integer sequential version numbers. VC +supports almost all SRC operations. + @node VCS Concepts @subsubsection Concepts of Version Control diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 473a1f8..ca8d678 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,7 @@ -2014-11-20 Eric S. Raymond +2014-11-20 Eric S. Raymond + + * vc/vc-src.el, vc/vc.el: Added support for SRC. Needs more + testing and a real log-view mode. * vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 6359e19..31ae9bf 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -107,8 +107,8 @@ interpreted as hostnames." :type 'regexp :group 'vc) -(defcustom vc-handled-backends '(RCS CVS SVN SCCS Bzr Git Hg Mtn Arch) - ;; RCS, CVS, SVN and SCCS come first because they are per-dir +(defcustom vc-handled-backends '(RCS CVS SVN SCCS SRC Bzr Git Hg Mtn Arch) + ;; RCS, CVS, SVN, SCCS, and SRC come first because they are per-dir ;; rather than per-tree. RCS comes first because of the multibackend ;; support intended to use RCS for local commits (with a remote CVS server). "List of version control backends for which VC will be used. @@ -124,7 +124,7 @@ An empty list disables VC altogether." ;; Note: we don't actually have a darcs back end yet. ;; Also, Meta-CVS (corresponding to MCVS) is unsupported. (defcustom vc-directory-exclusion-list (purecopy '("SCCS" "RCS" "CVS" "MCVS" - ".svn" ".git" ".hg" ".bzr" + ".src", ".svn" ".git" ".hg" ".bzr" "_MTN" "_darcs" "{arch}")) "List of directory names to be ignored when walking directory trees." :type '(repeat string) diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el new file mode 100644 index 0000000..18fac0e --- /dev/null +++ b/lisp/vc/vc-src.el @@ -0,0 +1,330 @@ +;;; vc-src.el --- support for SRC version-control -*- lexical-binding:t -*- + +;; Copyright (C) 1992-2014 Free Software Foundation, Inc. + +;; Author: FSF (see vc.el for full credits) +;; Maintainer: Eric S. Raymond +;; Package: 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: + +;; See vc.el. SRC requires an underlying RCS version of 4.0 or greater. + +;; FUNCTION NAME STATUS +;; BACKEND PROPERTIES +;; * revision-granularity OK +;; STATE-QUERYING FUNCTIONS +;; * registered (file) OK +;; * state (file) OK +;; - state-heuristic (file) NOT NEEDED +;; * dir-status (dir update-function) OK +;; - dir-status-files (dir files ds uf) ?? +;; - dir-extra-headers (dir) NOT NEEDED +;; - dir-printer (fileinfo) ?? +;; * working-revision (file) OK +;; - latest-on-branch-p (file) ?? +;; * checkout-model (files) OK +;; * workfile-unchanged-p (file) OK +;; - mode-line-string (file) NOT NEEDED +;; STATE-CHANGING FUNCTIONS +;; * register (files &optional rev comment) OK +;; * create-repo () OK +;; - init-revision () NOT NEEDED +;; * responsible-p (file) OK +;; * could-register (file) OK +;; - receive-file (file rev) NOT NEEDED +;; - unregister (file) NOT NEEDED +;; * checkin (files comment) OK +;; * find-revision (file rev buffer) OK +;; * checkout (file &optional rev) OK +;; * revert (file &optional contents-done) OK +;; - rollback (files) NOT NEEDED +;; - merge (file rev1 rev2) NOT NEEDED +;; - merge-news (file) NOT NEEDED +;; - steal-lock (file &optional revision) NOT NEEDED +;; HISTORY FUNCTIONS +;; * print-log (files buffer &optional shortlog start-revision limit) OK +;; - log-view-mode () ?? +;; - show-log-entry (revision) NOT NEEDED +;; - comment-history (file) NOT NEEDED +;; - update-changelog (files) NOT NEEDED +;; * diff (files &optional rev1 rev2 buffer) OK +;; - revision-completion-table (files) ?? +;; - annotate-command (file buf &optional rev) ?? +;; - annotate-time () ?? +;; - annotate-current-time () NOT NEEDED +;; - annotate-extract-revision-at-line () ?? +;; TAG SYSTEM +;; - create-tag (dir name branchp) ?? +;; - retrieve-tag (dir name update) ?? +;; MISCELLANEOUS +;; - make-version-backups-p (file) ?? +;; - repository-hostname (dirname) NOT NEEDED +;; - previous-revision (file rev) ?? +;; - next-revision (file rev) ?? +;; - check-headers () ?? +;; - clear-headers () ?? +;; - delete-file (file) ?? +;; * rename-file (old new) OK +;; - find-file-hook () NOT NEEDED + + +;;; Code: + +;;; +;;; Customization options +;;; + +(eval-when-compile + (require 'cl-lib) + (require 'vc)) + +(defgroup vc-src nil + "VC SRC backend." + :version "24.1" + :group 'vc) + +(defcustom vc-src-release nil + "The release number of your SRC installation, as a string. +If nil, VC itself computes this value when it is first needed." + :type '(choice (const :tag "Auto" nil) + (string :tag "Specified") + (const :tag "Unknown" unknown)) + :group 'vc-src) + +(defcustom vc-src-program "src" + "Name of the SRC executable (excluding any arguments)." + :type 'string + :group 'vc-src) + +(defcustom vc-src-diff-switches nil + "String or list of strings specifying switches for SRC diff under VC. +If nil, use the value of `vc-diff-switches'. If t, use no switches." + :type '(choice (const :tag "Unspecified" nil) + (const :tag "None" t) + (string :tag "Argument String") + (repeat :tag "Argument List" :value ("") string)) + :version "21.1" + :group 'vc-src) + +;; This needs to be autoloaded because vc-src-registered uses it (via +;; vc-default-registered), and vc-hooks needs to be able to check +;; for a registered backend without loading every backend. +;;;###autoload +(defcustom vc-src-master-templates + (purecopy '("%s.src/%s,v")) + "Where to look for SRC master files. +For a description of possible values, see `vc-check-master-templates'." + :type '(choice (const :tag "Use standard SRC file names" + '("%s.src/%s,v")) + (repeat :tag "User-specified" + (choice string + function))) + :version "21.1" + :group 'vc-src) + + +;;; Properties of the backend + +(defun vc-src-revision-granularity () 'file) +(defun vc-hg-checkout-model (_files) 'implicit) + +;;; +;;; State-querying functions +;;; + +;; The autoload cookie below places vc-src-registered directly into +;; loaddefs.el, so that vc-src.el does not need to be loaded for +;; every file that is visited. +;;;###autoload +(progn +(defun vc-src-registered (f) (vc-default-registered 'src f))) + +(defun vc-src-state (file) + "SRC-specific version of `vc-state'." + (let* + ((status nil) + (out + (with-output-to-string + (with-current-buffer + standard-output + (setq status + ;; Ignore all errors. + (condition-case nil + (process-file + vc-src-program nil t nil + "status" "-a" file) + (error nil))))))) + (when (eq 0 status) + (when (null (string-match "does not exist or is unreadable" out)) + (let ((state (aref out 0))) + (cond + ;; FIXME: What to do about A and L codes? + ((eq state ?.) 'up-to-date) + ((eq state ?A) 'added) + ((eq state ?M) 'edited) + ((eq state ?I) 'ignored) + ((eq state ?R) 'removed) + ((eq state ?!) 'missing) + ((eq state ??) 'unregistered) + (t 'up-to-date))))))) + +(autoload 'vc-expand-dirs "vc") + +(defun vc-src-dir-status (dir update-function) + ;; FIXME: this function should be rewritten or `vc-expand-dirs' + ;; should be changed to take a backend parameter. Using + ;; `vc-expand-dirs' is not TRTD because it returns files from + ;; multiple backends. It should also return 'unregistered files. + + ;; FIXME: Use one src status -a call for this + (let ((flist (vc-expand-dirs (list dir))) + (result nil)) + (dolist (file flist) + (let ((state (vc-state file)) + (frel (file-relative-name file))) + (when (and (eq (vc-backend file) 'SRC) + (not (eq state 'up-to-date))) + (push (list frel state) result)))) + (funcall update-function result))) + +(defun vc-src-command (buffer file-or-list &rest flags) + "A wrapper around `vc-do-command' for use in vc-src.el. +This function differs from vc-do-command in that it invokes `vc-src-program'." + (apply 'vc-do-command (or buffer "*vc*") 0 vc-src-program file-or-list flags)) + +(defun vc-src-working-revision (file) + "SRC-specific version of `vc-working-revision'." + (or (ignore-errors + (with-output-to-string + (vc-src-command standard-output file "list" "-f{1}" "@"))) + "0")) + +(defun vc-src-workfile-unchanged-p (file) + (eq 'up-to-date (vc-src-state file))) + +;;; +;;; State-changing functions +;;; + +(defun vc-src-create-repo () + "Create a new SRC repository." + ;; SRC is totally file-oriented, so all we have to do is make the directory. + (make-directory ".src")) + +(autoload 'vc-switches "vc") + +(defun vc-src-register (files &optional _rev _comment) + "Register FILES under src. +REV is ignored. +COMMENT is ignored." + (vc-src-command nil files "add")) + +(defun vc-rcs-responsible-p (file) + "Return non-nil if SRC thinks it would be responsible for registering FILE." + (file-directory-p (expand-file-name ".src" + (if (file-directory-p file) + file + (file-name-directory file))))) + +(defalias 'vc-could-register 'vc-src-responsible-p) + +(defun vc-src-checkin (files comment) + "SRC-specific version of `vc-backend-checkin'. +REV is ignored." + (vc-src-command nil files "commit" "-m" comment)) + +(defun vc-src-find-revision (file rev buffer) + (let ((coding-system-for-read 'binary) + (coding-system-for-write 'binary)) + (if rev + (vc-src-command buffer file "cat" rev) + (vc-src-command buffer file "cat")))) + +(defun vc-src-checkout (file &optional rev) + "Retrieve a revision of FILE. +REV is the revision to check out into WORKFILE." + (if rev + (vc-src-command nil file "co" rev) + (vc-src-command nil file "co"))) + +(defun vc-src-revert (file &optional _contents-done) + "Revert FILE to the version it was based on. If FILE is a directory, +revert all registered files beneath it." + (if (file-directory-p file) + (mapc 'vc-src-revert (vc-expand-dirs (list file))) + (vc-src-command nil file "co"))) + +(defun vc-src-modify-change-comment (files rev comment) + "Modify the change comments change on FILES on a specified REV. If FILE is a +directory the operation is applied to all registered files beneath it." + (dolist (file (vc-expand-dirs files)) + (vc-src-command nil file "amend" "-m" comment rev))) + +;; History functions + +(defcustom vc-src-log-switches nil + "String or list of strings specifying switches for src log under VC." + :type '(choice (const :tag "None" nil) + (string :tag "Argument String") + (repeat :tag "Argument List" :value ("") string)) + :group 'vc-src) + +(defun vc-src-print-log (files buffer &optional shortlog start-revision limit) + "Print commit log associated with FILES into specified BUFFER. +If SHORTLOG is non-nil, use the list method. +If START-REVISION is non-nil, it is the newest revision to show. +If LIMIT is non-nil, show no more than this many entries." + ;; FIXME: Implement the range restrictions. + ;; `vc-do-command' creates the buffer, but we need it before running + ;; the command. + (vc-setup-buffer buffer) + ;; If the buffer exists from a previous invocation it might be + ;; read-only. + (let ((inhibit-read-only t)) + (with-current-buffer + buffer + (apply 'vc-src-command buffer files (if shortlog "list" "log") + (nconc + ;;(when start-revision (list (format "%s-1" start-revision))) + ;;(when limit (list "-l" (format "%s" limit))) + vc-src-log-switches))))) + +(defun vc-src-diff (files &optional oldvers newvers buffer) + "Get a difference report using src between two revisions of FILES." + (let* ((firstfile (car files)) + (working (and firstfile (vc-working-revision firstfile)))) + (when (and (equal oldvers working) (not newvers)) + (setq oldvers nil)) + (when (and (not oldvers) newvers) + (setq oldvers working)) + (apply #'vc-src-command (or buffer "*vc-diff*") files "diff" + (when oldvers + (if newvers + (list (concat oldvers "-" newvers)) + (list oldvers)))))) + +;; Miscellaneous + +(defun vc-src-rename-file (old new) + "Rename file from OLD to NEW using `src mv'." + (vc-src-command nil 0 new "mv" old)) + +(provide 'vc-src) + +;;; vc-src.el ends here diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index f0fe51b..5d63b57 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -52,7 +52,7 @@ ;; This mode is fully documented in the Emacs user's manual. ;; -;; Supported version-control systems presently include CVS, RCS, GNU +;; Supported version-control systems presently include CVS, RCS, SCR, GNU ;; Arch, Subversion, Bzr, Git, Mercurial, Monotone and SCCS ;; (or its free replacement, CSSC). ;; @@ -74,6 +74,9 @@ ;; operations. Under these VC does little state caching, because local ;; operations are assumed to be fast. ;; +;; The 'assumed to be fast' category includes SRC, even though it's +;; a wrapper around RCS. +;; ;; ADDING SUPPORT FOR OTHER BACKENDS ;; ;; VC can use arbitrary version control systems as a backend. To add commit e7e9dbccb05175a512c40a3f433887c40abaa469 Author: Eric S. Raymond Date: Thu Nov 20 03:52:24 2014 -0500 Remove editable argument from VC's backend checkout methods. Alters vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el. where this matters (which is only in SCCS and RCS) files are now always checked out editable. This may actually have been dynamically true already - it looks like the vc-next-action code evolved past visiting the other case. Tested with RCS. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2020fd3..473a1f8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 2014-11-20 Eric S. Raymond + * vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, + vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, + vc/vc-svn.el, vc/vc.el: Remove editable argument from the backend + checkout methods; where it matters (which is only in SCCS and RCS) + files are always checked out editable. This may actually have + been dynamically true already - it looks like the vc-next-action + code evolved past visiting the other case. Tested with RCS. + * vc/vc-arch.el, vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el: Remove never-used rev diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 2c1941b..073c355 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -655,7 +655,7 @@ or a superior directory.") (expand-file-name ".bzrignore" (vc-bzr-root file))) -(defun vc-bzr-checkout (_file &optional _editable rev) +(defun vc-bzr-checkout (_file &optional rev) (if rev (error "Operation not supported") ;; Else, there's nothing to do. nil)) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 6fbfa72..4bce79c 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -395,9 +395,8 @@ its parents." "-p" (vc-switches 'CVS 'checkout))) -(defun vc-cvs-checkout (file &optional editable rev) +(defun vc-cvs-checkout (file &optional rev) "Checkout a revision of FILE into the working area. -EDITABLE non-nil means that the file should be writable. REV is the revision to check out." (message "Checking out %s..." file) ;; Change buffers to get local value of vc-checkout-switches. @@ -405,7 +404,7 @@ REV is the revision to check out." (if (and (file-exists-p file) (not rev)) ;; If no revision was specified, just make the file writable ;; if necessary (using `cvs-edit' if requested). - (and editable (not (eq (vc-cvs-checkout-model (list file)) 'implicit)) + (and (not (eq (vc-cvs-checkout-model (list file)) 'implicit)) (if vc-cvs-use-edit (vc-cvs-command nil 0 file "edit") (set-file-modes file (logior (file-modes file) 128)) @@ -413,7 +412,7 @@ REV is the revision to check out." ;; Check out a particular revision (or recreate the file). (vc-file-setprop file 'vc-working-revision nil) (apply 'vc-cvs-command nil 0 file - (and editable "-w") + "-w" "update" (when rev (unless (eq rev t) diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el index 77979d6..df7801f 100644 --- a/lisp/vc/vc-dav.el +++ b/lisp/vc/vc-dav.el @@ -87,7 +87,7 @@ See `vc-checkout-model' for a list of possible values." ;; This should PUT the resource and release any locks that we hold. ) -(defun vc-dav-checkout (url &optional editable rev destfile) +(defun vc-dav-checkout (url &optional rev destfile) "Check out revision REV of URL into the working area. If EDITABLE is non-nil URL should be writable by the user and if diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3e45eab..7509890 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -66,7 +66,7 @@ ;; - unregister (file) OK ;; * checkin (files rev comment) OK ;; * find-revision (file rev buffer) OK -;; * checkout (file &optional editable rev) OK +;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK ;; - rollback (files) COULD BE SUPPORTED ;; - merge (file rev1 rev2) It would be possible to merge @@ -709,7 +709,7 @@ It is based on `log-edit-mode', and has Git-specific extensions.") (expand-file-name ".gitignore" (vc-git-root file))) -(defun vc-git-checkout (file &optional _editable rev) +(defun vc-git-checkout (file &optional rev) (vc-git-command nil 0 file "checkout" (or rev "HEAD"))) (defun vc-git-revert (file &optional contents-done) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 583fa6c..dab2c72 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -63,7 +63,7 @@ ;; - unregister (file) OK ;; * checkin (files rev comment) OK ;; * find-revision (file rev buffer) OK -;; * checkout (file &optional editable rev) OK +;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK ;; - rollback (files) ?? PROBABLY NOT NEEDED ;; - merge (file rev1 rev2) NEEDED @@ -499,7 +499,7 @@ REV is ignored." (vc-hg-root file))) ;; Modeled after the similar function in vc-bzr.el -(defun vc-hg-checkout (file &optional _editable rev) +(defun vc-hg-checkout (file &optional rev) "Retrieve a revision of FILE. EDITABLE is ignored. REV is the revision to check out into WORKFILE." diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index fdaca54..145fdeb 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -197,7 +197,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (defun vc-mtn-find-revision (file rev buffer) (vc-mtn-command buffer 0 file "cat" "-r" rev)) -;; (defun vc-mtn-checkout (file &optional editable rev) +;; (defun vc-mtn-checkout (file &optional rev) ;; ) (defun vc-mtn-revert (file &optional contents-done) diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 4b06b09..2d713c9 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -421,7 +421,7 @@ whether to remove it." (concat "-p" rev) (vc-switches 'RCS 'checkout))) -(defun vc-rcs-checkout (file &optional editable rev) +(defun vc-rcs-checkout (file &optional rev) "Retrieve a copy of a saved version of FILE. If FILE is a directory, attempt the checkout for all registered files beneath it." (if (file-directory-p file) @@ -452,7 +452,7 @@ attempt the checkout for all registered files beneath it." ;; If locking is not strict, force to overwrite ;; the writable workfile. (if (eq (vc-rcs-checkout-model (list file)) 'implicit) "-f") - (if editable "-l") + "-l" (if (stringp rev) ;; a literal revision was specified (concat "-r" rev) diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index db777ab..f1e437b 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -272,7 +272,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." (vc-sccs-lookup-triple file rev))) (vc-switches 'SCCS 'checkout))) -(defun vc-sccs-checkout (file &optional editable rev) +(defun vc-sccs-checkout (file &optional rev) "Retrieve a copy of a saved revision of SCCS controlled FILE. If FILE is a directory, all version-controlled files beneath are checked out. EDITABLE non-nil means that the file should be writable and @@ -299,7 +299,7 @@ locked. REV is the revision to check out." (not (stringp rev))) (setq rev nil)) (apply 'vc-sccs-do-command nil 0 "get" (vc-name file) - (if editable "-e") + "-e" (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) switches)))) (message "Checking out %s...done" file)))) diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index bd22fbf..30d66e4 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -375,14 +375,14 @@ FILE is a file wildcard, relative to the root directory of DIRECTORY." "Return the administrative directory of FILE." (expand-file-name vc-svn-admin-directory (vc-svn-root file))) -(defun vc-svn-checkout (file &optional editable rev) +(defun vc-svn-checkout (file &optional rev) (message "Checking out %s..." file) (with-current-buffer (or (get-file-buffer file) (current-buffer)) - (vc-svn-update file editable rev (vc-switches 'SVN 'checkout))) + (vc-svn-update file rev (vc-switches 'SVN 'checkout))) (vc-mode-line file 'SVN) (message "Checking out %s...done" file)) -(defun vc-svn-update (file _editable rev switches) +(defun vc-svn-update (file rev switches) (if (and (file-exists-p file) (not rev)) ;; If no revision was specified, there's nothing to do. nil diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 2efa450..f0fe51b 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -281,16 +281,17 @@ ;; The implementation should pass the value of vc-checkout-switches ;; to the backend command. ;; -;; * checkout (file &optional editable rev) -;; -;; Check out revision REV of FILE into the working area. If EDITABLE -;; is non-nil, FILE should be writable by the user and if locking is -;; used for FILE, a lock should also be set. If REV is non-nil, that -;; is the revision to check out (default is the working revision). -;; If REV is t, that means to check out the head of the current branch; -;; if it is the empty string, check out the head of the trunk. -;; The implementation should pass the value of vc-checkout-switches -;; to the backend command. +;; * checkout (file &optional rev) +;; +;; Check out revision REV of FILE into the working area. FILE +;; should be writable by the user and if locking is used for FILE, a +;; lock should also be set. If REV is non-nil, that is the revision +;; to check out (default is the working revision). If REV is t, +;; that means to check out the head of the current branch; if it is +;; the empty string, check out the head of the trunk. The +;; implementation should pass the value of vc-checkout-switches to +;; the backend command. The 'editable' argument of older VC versions +;; is gone; all files are checked out editable. ;; ;; * revert (file &optional contents-done) ;; @@ -1138,10 +1139,10 @@ For old-style locking-based version control systems, like RCS: (let ((vsym (intern-soft revision-downcase))) (dolist (file files) (vc-transfer-file file vsym))) (dolist (file files) - (vc-checkout file (eq model 'implicit) revision))))) + (vc-checkout file revision))))) ((not (eq model 'implicit)) ;; check the files out - (dolist (file files) (vc-checkout file t))) + (dolist (file files) (vc-checkout file))) (t ;; do nothing (message "Fileset is up-to-date")))) @@ -1227,10 +1228,10 @@ For old-style locking-based version control systems, like RCS: (if (yes-or-no-p (format "%s is not up-to-date. Get latest revision? " (file-name-nondirectory file))) - (vc-checkout file (eq model 'implicit) t) + (vc-checkout file t) (when (and (not (eq model 'implicit)) (yes-or-no-p "Lock this revision? ")) - (vc-checkout file t))))) + (vc-checkout file))))) ;; needs-merge ((eq state 'needs-merge) (dolist (file files) @@ -1267,7 +1268,7 @@ For old-style locking-based version control systems, like RCS: "Revert to checked-in revision, instead? ")) (error "Checkout aborted") (vc-revert-buffer-internal t t) - (vc-checkout file t))))) + (vc-checkout file))))) ;; Unknown fileset state (t (error "Fileset is in an unknown state %s" state))))) @@ -1426,29 +1427,27 @@ Argument BACKEND is the backend you are using." (replace-match "")) (write-region (point-min) (point-max) file))) -(defun vc-checkout (file &optional writable rev) +(defun vc-checkout (file &optional rev) "Retrieve a copy of the revision REV of FILE. -If WRITABLE is non-nil, make sure the retrieved file is writable. REV defaults to the latest revision. After check-out, runs the normal hook `vc-checkout-hook'." - (and writable - (not rev) + (and (not rev) (vc-call make-version-backups-p file) (vc-up-to-date-p file) (vc-make-version-backup file)) (let ((backend (vc-backend file))) (with-vc-properties (list file) (condition-case err - (vc-call-backend backend 'checkout file writable rev) + (vc-call-backend backend 'checkout file rev) (file-error ;; Maybe the backend is not installed ;-( - (when writable + (when t (let ((buf (get-file-buffer file))) (when buf (with-current-buffer buf (read-only-mode -1))))) (signal (car err) (cdr err)))) `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 'implicit) - (not writable)) + nil) (if (vc-call-backend backend 'latest-on-branch-p file) 'up-to-date 'needs-update) @@ -2544,14 +2543,14 @@ tip revision are merged into the working file." (and file (member file files)))))) (dolist (file files) (if (vc-up-to-date-p file) - (vc-checkout file nil t) + (vc-checkout file t) (vc-maybe-resolve-conflicts file (vc-call-backend backend 'merge-news file))))) ;; For a locking VCS, check out each file. ((eq (vc-checkout-model backend files) 'locking) (dolist (file files) (if (vc-up-to-date-p file) - (vc-checkout file nil t)))) + (vc-checkout file t)))) (t (error "VC update is unsupported for `%s'" backend))))) @@ -2673,7 +2672,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (when modified-file (vc-switch-backend file new-backend) (unless (eq (vc-checkout-model new-backend (list file)) 'implicit) - (vc-checkout file t nil)) + (vc-checkout file)) (rename-file modified-file file 'ok-if-already-exists) (vc-file-setprop file 'vc-checkout-time nil))))) (when move commit f83109f0fabe13c0175ca6fe23b475bd8a9d9d99 Author: Eric S. Raymond Date: Thu Nov 20 02:37:06 2014 -0500 Remove never-used rev argument from VC's backend checkin methods. Alters vc/vc-arch.el, vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el. Only the RCS, SCCS, and CVS back ends tried to do anything with it, and that code was never exercised. Chiseling away the cruft of decades... diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6fa23de..2020fd3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-11-20 Eric S. Raymond + + * vc/vc-arch.el, vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, + vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el, + vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el: Remove never-used rev + argument from the backend checkin methods. Only the RCS, SCCS, and + CVS back ends tried to do anything with it, and that code was + never exercised. Chiseling away the cruft of decades... + 2014-11-19 Lars Magne Ingebrigtsen * net/eww.el (eww-render): Remove a no-op :title setting. diff --git a/lisp/vc/vc-arch.el b/lisp/vc/vc-arch.el index 2bc8b7b..53b8e35 100644 --- a/lisp/vc/vc-arch.el +++ b/lisp/vc/vc-arch.el @@ -441,8 +441,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see (autoload 'vc-switches "vc") -(defun vc-arch-checkin (files rev comment) - (if rev (error "Committing to a specific revision is unsupported")) +(defun vc-arch-checkin (files comment) ;; FIXME: This implementation probably only works for singleton filesets (let ((summary (file-relative-name (car files) (vc-arch-root (car files))))) ;; Extract a summary from the comment. diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index a093bcb..2c1941b 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -634,10 +634,8 @@ or a superior directory.") "" (replace-regexp-in-string "\n[ \t]?" " " str))))) -(defun vc-bzr-checkin (files rev comment) - "Check FILES in to bzr with log message COMMENT. -REV non-nil gets an error." - (if rev (error "Can't check in a specific revision with bzr")) +(defun vc-bzr-checkin (files comment) + "Check FILES in to bzr with log message COMMENT." (apply 'vc-bzr-command "commit" nil 0 files (cons "-m" (log-edit-extract-headers `(("Author" . ,(vc-bzr--sanitize-header "--author")) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index ad5559b..6fbfa72 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -321,20 +321,38 @@ its parents." (directory-file-name dir)))) (eq dir t))) -(defun vc-cvs-checkin (files rev comment) +;; vc-cvs-checkin used to take a 'rev' second argument that allowed +;; checking in onto a specified branch tip rather than the current +;; default branch, but nothing in the entire rest of VC exercised +;; this code. Removing it simplifies the backend interface for all +;; modes. +;; +;; Here's the setup code preserved in amber, in case the logic needs +;; to be broken out into a method someday; (if rev (concat "-r" rev)) +;; used to be part of the switches passed to vc-cvs-command. +;; +;; (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) +;; (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) +;; (error "%s is not a valid symbolic tag name" rev) +;; ;; If the input revision is a valid symbolic tag name, we create it +;; ;; as a branch, commit and switch to it. +;; (apply 'vc-cvs-command nil 0 files "tag" "-b" (list rev)) +;; (apply 'vc-cvs-command nil 0 files "update" "-r" (list rev)) +;; (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev)) +;; files))) +;; +;; The following postamble cleaned up after the branch change: +;; +;; ;; if this was an explicit check-in (does not include creation of +;; ;; a branch), remove the sticky tag. +;; (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) +;; (vc-cvs-command nil 0 files "update" "-A")))) +;; files))) +;; +(defun vc-cvs-checkin (files comment) "CVS-specific version of `vc-backend-checkin'." - (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) - (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) - (error "%s is not a valid symbolic tag name" rev) - ;; If the input revision is a valid symbolic tag name, we create it - ;; as a branch, commit and switch to it. - (apply 'vc-cvs-command nil 0 files "tag" "-b" (list rev)) - (apply 'vc-cvs-command nil 0 files "update" "-r" (list rev)) - (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev)) - files))) (let ((status (apply 'vc-cvs-command nil 1 files - "ci" (if rev (concat "-r" rev)) - (concat "-m" comment) + "ci" (concat "-m" comment) (vc-switches 'CVS 'checkin)))) (set-buffer "*vc*") (goto-char (point-min)) @@ -365,12 +383,7 @@ its parents." ;; tell it from the permissions of the file (see ;; vc-cvs-checkout-model). (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil)) - files) - - ;; if this was an explicit check-in (does not include creation of - ;; a branch), remove the sticky tag. - (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) - (vc-cvs-command nil 0 files "update" "-A")))) + files))) (defun vc-cvs-find-revision (file rev buffer) (apply 'vc-cvs-command diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el index 9b67d74..77979d6 100644 --- a/lisp/vc/vc-dav.el +++ b/lisp/vc/vc-dav.el @@ -82,10 +82,8 @@ See `vc-checkout-model' for a list of possible values." ;; Do we need to do anything here? FIXME? ) -(defun vc-dav-checkin (url rev comment) - "Commit changes in URL to WebDAV. -If REV is non-nil, that should become the new revision number. -COMMENT is used as a check-in comment." +(defun vc-dav-checkin (url comment) + "Commit changes in URL to WebDAV. COMMENT is used as a check-in comment." ;; This should PUT the resource and release any locks that we hold. ) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3b11a3c..3e45eab 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -665,7 +665,7 @@ If toggling on, also insert its message into the buffer." "Major mode for editing Git log messages. It is based on `log-edit-mode', and has Git-specific extensions.") -(defun vc-git-checkin (files _rev comment) +(defun vc-git-checkin (files comment) (let* ((file1 (or (car files) default-directory)) (root (vc-git-root file1)) (default-directory (expand-file-name root)) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 4f13914..583fa6c 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -407,7 +407,7 @@ Optional arg REVISION is a revision to annotate from." (and (vc-hg-command nil 0 nil "status") (vc-hg-command nil 0 nil (if branchp "bookmark" "tag") name)))) -(defun vc-hg-retrieve-tag (dir name update) +(defun vc-hg-retrieve-tag (dir name _update) "Retrieve the version tagged by NAME of all registered files at or below DIR." (let ((default-directory dir)) (vc-hg-command nil 0 nil "update" name) @@ -477,7 +477,7 @@ COMMENT is ignored." (declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-hg-checkin (files _rev comment) +(defun vc-hg-checkin (files comment) "Hg-specific version of `vc-backend-checkin'. REV is ignored." (apply 'vc-hg-command nil 0 files diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index ea071c8..fdaca54 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -187,7 +187,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-mtn-checkin (files _rev comment) +(defun vc-mtn-checkin (files comment) (apply 'vc-mtn-command nil 0 files (nconc (list "commit" "-m") (log-edit-extract-headers '(("Author" . "--author") diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 57515d0..4b06b09 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -358,23 +358,27 @@ whether to remove it." (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) (delete-directory dir)))) -(defun vc-rcs-checkin (files rev comment) +;; It used to be possible to pass in a value for the variable rev, but +;; nothing in the rest of VC used this capability. Removing it makes the +;; backend interface simpler for all modes. +;; +(defun vc-rcs-checkin (files comment) "RCS-specific version of `vc-backend-checkin'." - (let ((switches (vc-switches 'RCS 'checkin))) + (let (rev (switches (vc-switches 'RCS 'checkin))) ;; Now operate on the files (dolist (file (vc-expand-dirs files)) (let ((old-version (vc-working-revision file)) new-version (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) ;; Force branch creation if an appropriate ;; default branch has been set. - (and (not rev) - default-branch + (and default-branch (string-match (concat "^" (regexp-quote old-version) "\\.") default-branch) (setq rev default-branch) (setq switches (cons "-f" switches))) - (if (and (not rev) old-version) - (setq rev (vc-branch-part old-version))) + (if old-version + (setq rev (vc-branch-part old-version)) + (error "can't find current branch")) (apply #'vc-do-command "*vc*" 0 "ci" (vc-name file) ;; if available, use the secure check-in option (and (vc-rcs-release-p "5.6.4") "-j") diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index fb7d959..db777ab 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -253,11 +253,10 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") (file-name-nondirectory file))))) -(defun vc-sccs-checkin (files rev comment) +(defun vc-sccs-checkin (files comment) "SCCS-specific version of `vc-backend-checkin'." (dolist (file (vc-expand-dirs files)) (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) - (if rev (concat "-r" rev)) (concat "-y" comment) (vc-switches 'SCCS 'checkin)) (if vc-keep-workfiles diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index c7568e4..bd22fbf 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -316,9 +316,8 @@ to the SVN command." "Return non-nil if FILE could be registered in SVN. This is only possible if SVN is responsible for FILE's directory.") -(defun vc-svn-checkin (files rev comment &optional _extra-args-ignored) +(defun vc-svn-checkin (files comment &optional _extra-args-ignored) "SVN-specific version of `vc-backend-checkin'." - (if rev (error "Committing to a specific revision is unsupported in SVN")) (let ((status (apply 'vc-svn-command nil 1 files "ci" (nconc (list "-m" comment) (vc-switches 'SVN 'checkin))))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0838491..2efa450 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -72,7 +72,7 @@ ;; When using Subversion or a later system, anything you do outside VC ;; *through the VCS tools* should safely interlock with VC ;; operations. Under these VC does little state caching, because local -;; operations are assumed to be fast. The dividing line is +;; operations are assumed to be fast. ;; ;; ADDING SUPPORT FOR OTHER BACKENDS ;; @@ -267,12 +267,12 @@ ;; Unregister FILE from this backend. This is only needed if this ;; backend may be used as a "more local" backend for temporary editing. ;; -;; * checkin (files rev comment) +;; * checkin (files comment) ;; -;; Commit changes in FILES to this backend. REV is a historical artifact -;; and should be ignored. COMMENT is used as a check-in comment. -;; The implementation should pass the value of vc-checkin-switches to -;; the backend command. +;; Commit changes in FILES to this backend. COMMENT is used as a +;; check-in comment. The implementation should pass the value of +;; vc-checkin-switches to the backend command. The revision argument +;; of some older VC versions is no longer supported. ;; ;; * find-revision (file rev buffer) ;; @@ -1498,13 +1498,11 @@ Type \\[vc-next-action] to check in changes.") ".\n") (message "Please explain why you stole the lock. Type C-c C-c when done."))) -(defun vc-checkin (files backend &optional rev comment initial-contents) - "Check in FILES. -The optional argument REV may be a string specifying the new revision -level (strongly deprecated). COMMENT is a comment -string; if omitted, a buffer is popped up to accept a comment. If -INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents -of the log entry buffer. +(defun vc-checkin (files backend &optional comment initial-contents) + "Check in FILES. COMMENT is a comment string; if omitted, a +buffer is popped up to accept a comment. If INITIAL-CONTENTS is +non-nil, then COMMENT is used as the initial contents of the log +entry buffer. If `vc-keep-workfiles' is nil, FILE is deleted afterwards, provided that the version control system supports this mode of operation. @@ -1530,7 +1528,7 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." ;; vc-checkin-switches, but 'the' local buffer is ;; not a well-defined concept for filesets. (progn - (vc-call-backend backend 'checkin files rev comment) + (vc-call-backend backend 'checkin files comment) (mapc 'vc-delete-automatic-version-backups files)) `((vc-state . up-to-date) (vc-checkout-time . ,(nth 5 (file-attributes file))) @@ -2686,7 +2684,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (when (or move edited) (vc-file-setprop file 'vc-state 'edited) (vc-mode-line file new-backend) - (vc-checkin file new-backend nil comment (stringp comment))))) + (vc-checkin file new-backend comment (stringp comment))))) (defun vc-rename-master (oldmaster newfile templates) "Rename OLDMASTER to be the master file for NEWFILE based on TEMPLATES." commit f5d77aafa9d59c4afb13d744e67a0e4daf3be31a Author: Dani Moncayo Date: Wed Nov 19 21:15:32 2014 +0100 build-aux/msys-to-w32: Simplify implementation and docstring. * build-aux/msys-to-w32: Simplify implementation and docstring; Paths starting with '%emacs_dir%' are just considered relative. diff --git a/ChangeLog b/ChangeLog index ed97875..749c020 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-11-19 Dani Moncayo + + * build-aux/msys-to-w32: Simplify implementation and docstring; + Paths starting with '%emacs_dir%' are just considered relative. + 2014-11-16 Christoph Scholtes * .gitignore: Ignore generated file lib/stdalign.h. diff --git a/build-aux/msys-to-w32 b/build-aux/msys-to-w32 index f8c3722..f0fd61d 100755 --- a/build-aux/msys-to-w32 +++ b/build-aux/msys-to-w32 @@ -32,14 +32,7 @@ written to the standard output after performing these transformations: 1. Discard empty paths. 2. Replace: '\' with '/', '//' with '/' and ':' with ';'. -3. Translate each path to Windows-native format. - -Relative paths or paths starting with '%emacs_dir%' will be passed -verbatim to the standard output. - -Each non existing absolute path will be translated by looking for its -deepest existing directory, which will be translated and the remainder -appended. +3. Translate absolute paths to Windows-native format. Options: --help display this help and exit @@ -78,10 +71,7 @@ for p do [ -z "$p" ] && continue - if [ "${p:0:11}" = "%emacs_dir%" ] - then - w32p=$p - elif [ "${p:0:1}" != "/" ] + if [ "${p:0:1}" != "/" ] then w32p=$p elif [ -d "$p" ] commit f437176169cf1722f99938845c35eb40bf139b2d Author: Lars Magne Ingebrigtsen Date: Wed Nov 19 20:14:19 2014 +0100 Add missing bug numbers to last few eww changes diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d410e23..6fa23de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -5,7 +5,7 @@ 2014-11-19 Ivan Shmakov * net/eww.el (eww-history-limit): New variable. - (eww-save-history): Use it. + (eww-save-history): Use it (bug#19105). (eww-reload): Reload the page in the right buffer. 2014-11-19 Lars Magne Ingebrigtsen @@ -16,7 +16,7 @@ * net/eww.el (eww-desktop-remove-duplicates) (eww-restore-desktop, eww-restore-reload-prompt): New variables. - (eww-mode): Set up desktop mode. + (eww-mode): Set up desktop mode (bug#18010). (eww-desktop-data-save, eww-desktop-data-1) (eww-desktop-history-duplicate, eww-desktop-misc-data) (eww-restore-desktop): New functions. commit c2678a68dc74aa1ee3dbe370511a7c4a0a839809 Author: Ivan Shmakov Date: Wed Nov 19 20:09:30 2014 +0100 * eww.texi (Basics): Document `eww-history-limit'. diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8b7aa1c..0e9300a 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-19 Ivan Shmakov + + * eww.texi (Basics): Document `eww-history-limit'. + 2014-11-14 Paul Eggert * org.texi (The date/time prompt, Matching tags and properties): diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 2208c2d..3529883 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -126,6 +126,15 @@ history press @kbd{H} (@code{eww-list-histories}) to open the history buffer @file{*eww history*}. The history is lost when EWW is quit. If you want to remember websites you can use bookmarks. +@vindex eww-history-limit + Along with the URLs visited, EWW also remembers both the rendered +page (as it appears in the buffer) and its source. This can take a +considerable amount of memory, so EWW discards the history entries to +keep their number within a set limit, as specified by +@code{eww-history-limit}; the default being 50. This variable could +also be set to @code{nil} to allow for the history list to grow +indefinitely. + @findex eww-add-bookmark @findex eww-list-bookmarks @kindex b commit 9c2c15edb5ed90342695a1392b992c75ff9bc4b0 Author: Leo Liu Date: Thu Nov 20 02:18:01 2014 +0800 Add NEWS entry for define-advice * NEWS: Mention new macro define-advice. diff --git a/etc/ChangeLog b/etc/ChangeLog index ed8c345..d57190f 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-19 Leo Liu + + * NEWS: Mention new macro define-advice. + 2014-11-17 Paul Eggert Improve time stamp handling, and be more consistent about it. diff --git a/etc/NEWS b/etc/NEWS index c319a09..769d2c6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -65,6 +65,9 @@ have the equivalent of a primary selection. +++ ** terpri gets an optional arg ENSURE to conditionally output a newline. ++++ +** New macro `define-advice'. + ** `insert-register' now leaves point after the inserted text when called interactively. A prefix argument toggles this behavior. commit e25e7693cd6d203a4e6e7cdb86db0f09d6426e24 Author: Lars Magne Ingebrigtsen Date: Wed Nov 19 18:41:17 2014 +0100 * net/eww.el (eww-render): Remove a no-op :title setting. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aacc526..d410e23 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-19 Lars Magne Ingebrigtsen + + * net/eww.el (eww-render): Remove a no-op :title setting. + 2014-11-19 Ivan Shmakov * net/eww.el (eww-history-limit): New variable. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index e7fab1e..6746668 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -259,7 +259,6 @@ See the `eww-search-prefix' variable for the search engine used." (data-buffer (current-buffer))) (unwind-protect (progn - (plist-put eww-data :title "") (cond ((and eww-use-external-browser-for-content-type (string-match-p eww-use-external-browser-for-content-type commit 9fd6f5963b5a448f40c8e79bda60fd0b5721566b Author: Ivan Shmakov Date: Wed Nov 19 18:37:18 2014 +0100 (eww-reload): Reload the page in the right buffer. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1194ba7..aacc526 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,7 @@ * net/eww.el (eww-history-limit): New variable. (eww-save-history): Use it. + (eww-reload): Reload the page in the right buffer. 2014-11-19 Lars Magne Ingebrigtsen diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 83d96f5..e7fab1e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -705,7 +705,8 @@ appears in a or tag." "Reload the current page." (interactive) (let ((url (plist-get eww-data :url))) - (url-retrieve url 'eww-render (list url (point))))) + (url-retrieve url 'eww-render + (list url (point) (current-buffer))))) ;; Form support. commit 8d5bfc4900dbda0425c2db780bc1bed607167d2a Author: Ivan Shmakov Date: Wed Nov 19 18:28:19 2014 +0100 (eww-history-limit): New variable. * net/eww.el (eww-history-limit): New variable. (eww-save-history): Use it. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c8a48b..1194ba7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-19 Ivan Shmakov + + * net/eww.el (eww-history-limit): New variable. + (eww-save-history): Use it. + 2014-11-19 Lars Magne Ingebrigtsen * net/eww.el (eww-desktop-misc-data): Use `cl-remove-duplicates'. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 76e14be..83d96f5 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -95,6 +95,12 @@ The string will be passed through `substitute-command-keys'." :group 'eww :type 'string) +(defcustom eww-history-limit 50 + "Maximum number of entries to retain in the history." + :version "25.1" + :group 'eww + :type '(choice (const :tag "Unlimited" nil) + integer)) (defcustom eww-use-external-browser-for-content-type "\\`\\(video/\\|audio/\\|application/ogg\\)" "Always use external browser for specified content-type." @@ -1487,7 +1493,8 @@ Differences in #targets are ignored." (setq eww-data (list :title "")) ;; Don't let the history grow infinitely. We store quite a lot of ;; data per page. - (when-let (tail (nthcdr 50 eww-history)) + (when-let (tail (and eww-history-limit + (nthcdr eww-history-limit eww-history))) (setcdr tail nil))) (defun eww-list-histories () commit a8995cae4c5daecee3fb2ee8dc2348eedc340af1 Author: Lars Magne Ingebrigtsen Date: Wed Nov 19 18:22:45 2014 +0100 * net/eww.el (eww-desktop-misc-data): Use `cl-remove-duplicates'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b18dc41..4c8a48b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-19 Lars Magne Ingebrigtsen + + * net/eww.el (eww-desktop-misc-data): Use `cl-remove-duplicates'. + 2014-11-19 Ivan Shmakov * net/eww.el (eww-desktop-remove-duplicates) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index dd449ff..76e14be 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1597,7 +1597,7 @@ Generally, the list should not include the (usually overly large) (let ((history (mapcar 'eww-desktop-data-1 (cons eww-data eww-history)))) (list :history (if eww-desktop-remove-duplicates - (remove-duplicates + (cl-remove-duplicates history :test 'eww-desktop-history-duplicate) history)))) commit 7d77dc18c7a3040fc565680bc1e2785f6db2c09f Author: Ivan Shmakov Date: Wed Nov 19 18:21:58 2014 +0100 Add desktop support to eww * net/eww.el (eww-desktop-remove-duplicates) (eww-restore-desktop, eww-restore-reload-prompt): New variables. (eww-mode): Set up desktop mode. (eww-desktop-data-save, eww-desktop-data-1) (eww-desktop-history-duplicate, eww-desktop-misc-data) (eww-restore-desktop): New functions. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0d1e986..b18dc41 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-11-19 Ivan Shmakov + + * net/eww.el (eww-desktop-remove-duplicates) + (eww-restore-desktop, eww-restore-reload-prompt): New variables. + (eww-mode): Set up desktop mode. + (eww-desktop-data-save, eww-desktop-data-1) + (eww-desktop-history-duplicate, eww-desktop-misc-data) + (eww-restore-desktop): New functions. + 2014-11-19 Eli Zaretskii * vc/vc.el (vc-log-internal-common): Turn on log-view-mode in the diff --git a/lisp/net/eww.el b/lisp/net/eww.el index fbac428..dd449ff 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -65,6 +65,36 @@ :group 'eww :type 'string) +(defcustom eww-desktop-remove-duplicates t + "Whether to remove duplicates from the history when saving desktop data. +If non-nil, repetitive EWW history entries (comprising of the URI, the +title, and the point position) will not be saved as part of the Emacs +desktop. Otherwise, such entries will be retained." + :version "25.1" + :group 'eww + :type 'boolean) + +(defcustom eww-restore-desktop nil + "How to restore EWW buffers on `desktop-restore'. +If t or 'auto, the buffers will be reloaded automatically. +If nil, buffers will require manual reload, and will contain the text +specified in `eww-restore-reload-prompt' instead of the actual Web +page contents." + :version "25.1" + :group 'eww + :type '(choice (const :tag "Restore all automatically" t) + (const :tag "Require manual reload" nil))) + +(defcustom eww-restore-reload-prompt + "\n\n *** Use \\[eww-reload] to reload this buffer. ***\n" + "The string to put in the buffers not reloaded on `desktop-restore'. +This prompt will be used if `eww-restore-desktop' is nil. + +The string will be passed through `substitute-command-keys'." + :version "25.1" + :group 'eww + :type 'string) + (defcustom eww-use-external-browser-for-content-type "\\`\\(video/\\|audio/\\|application/ogg\\)" "Always use external browser for specified content-type." @@ -583,6 +613,8 @@ the like." (setq-local eww-history-position 0) (when (boundp 'tool-bar-map) (setq-local tool-bar-map eww-tool-bar-map)) + ;; desktop support + (setq-local desktop-save-buffer 'eww-desktop-misc-data) (buffer-disable-undo) (setq buffer-read-only t)) @@ -611,12 +643,15 @@ the like." (eww-restore-history (elt eww-history (1- eww-history-position)))) (defun eww-restore-history (elem) - (let ((inhibit-read-only t)) - (erase-buffer) - (insert (plist-get elem :text)) - (goto-char (plist-get elem :point)) + (let ((inhibit-read-only t) + (text (plist-get elem :text))) (setq eww-data elem) - (eww-update-header-line-format))) + (if (null text) + (eww-reload) ; FIXME: restore :point? + (erase-buffer) + (insert text) + (goto-char (plist-get elem :point)) + (eww-update-header-line-format)))) (defun eww-next-url () "Go to the page marked `next'. @@ -1518,6 +1553,82 @@ Differences in #targets are ignored." (setq buffer-read-only t truncate-lines t)) +;;; Desktop support + +(defvar eww-desktop-data-save + '(:url :title :point) + "List of `eww-data' properties to preserve in the desktop file. +Also used when saving `eww-history'.") + +(defun eww-desktop-data-1 (alist) + (let ((acc nil) + (tail alist)) + (while tail + (let ((k (car tail)) + (v (cadr tail))) + (when (memq k eww-desktop-data-save) + (setq acc (cons k (cons v acc))))) + (setq tail (cddr tail))) + acc)) + +(defun eww-desktop-history-duplicate (a b) + (let ((tail a) (r t)) + (while tail + (if (or (memq (car tail) '(:point)) ; ignore :point + (equal (cadr tail) + (plist-get b (car tail)))) + (setq tail (cddr tail)) + (setq tail nil + r nil))) + ;; . + r)) + +(defun eww-desktop-misc-data (directory) + "Return a property list with data used to restore eww buffers. +This list will contain, as :history, the list, whose first element is +the value of `eww-data', and the tail is `eww-history'. + +If `eww-desktop-remove-duplicates' is non-nil, duplicate +entries (if any) will be removed from the list. + +Only the properties listed in `eww-desktop-data-save' are included. +Generally, the list should not include the (usually overly large) +:dom, :source and :text properties." + (let ((history (mapcar 'eww-desktop-data-1 + (cons eww-data eww-history)))) + (list :history (if eww-desktop-remove-duplicates + (remove-duplicates + history :test 'eww-desktop-history-duplicate) + history)))) + +(defun eww-restore-desktop (file-name buffer-name misc-data) + "Restore an eww buffer from its desktop file record. +If `eww-restore-desktop' is t or 'auto, this function will also +initiate the retrieval of the respective URI in the background. +Otherwise, the restored buffer will contain a prompt to do so by using +\\[eww-reload]." + (with-current-buffer (get-buffer-create buffer-name) + (eww-mode) + ;; NB: eww-history, eww-data are buffer-local per (eww-mode) + (setq eww-history (cdr (plist-get misc-data :history)) + eww-data (or (car (plist-get misc-data :history)) + ;; backwards compatibility + (list :url (plist-get misc-data :uri)))) + (unless file-name + (when (plist-get eww-data :url) + (case eww-restore-desktop + ((t auto) (eww (plist-get eww-data :url))) + ((zerop (buffer-size)) + (insert (substitute-command-keys + eww-restore-reload-prompt)))))) + ;; . + (current-buffer))) + +(add-to-list 'desktop-locals-to-save + 'eww-history-position) +(add-to-list 'desktop-buffer-mode-handlers + '(eww-mode . eww-restore-desktop)) + (provide 'eww) ;;; eww.el ends here commit e9917c08dce94e0ff92b0b202c9f5a4dd3231d22 Author: Eli Zaretskii Date: Wed Nov 19 18:11:05 2014 +0200 Fix bug #19101 with log-view-mode set in the wrong buffer. lisp/vc/vc.el (vc-log-internal-common): Turn on log-view-mode in the correct buffer. (Bug#19101) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 25ef3b3..0d1e986 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-19 Eli Zaretskii + + * vc/vc.el (vc-log-internal-common): Turn on log-view-mode in the + correct buffer. (Bug#19101) + 2014-11-19 Rüdiger Sonderfeld Fix bug#19099. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b2cb447..0838491 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2273,17 +2273,18 @@ earlier revisions. Show up to LIMIT entries (non-nil means unlimited)." (with-current-buffer (get-buffer-create buffer-name) (set (make-local-variable 'vc-log-view-type) type)) (setq retval (funcall backend-func backend buffer-name type files)) - (let ((inhibit-read-only t)) - ;; log-view-mode used to be called with inhibit-read-only bound - ;; to t, so let's keep doing it, just in case. - (vc-call-backend backend 'log-view-mode) - (set (make-local-variable 'log-view-vc-backend) backend) - (set (make-local-variable 'log-view-vc-fileset) files) - (set (make-local-variable 'revert-buffer-function) - rev-buff-func)) + (with-current-buffer (get-buffer buffer-name) + (let ((inhibit-read-only t)) + ;; log-view-mode used to be called with inhibit-read-only bound + ;; to t, so let's keep doing it, just in case. + (vc-call-backend backend 'log-view-mode) + (set (make-local-variable 'log-view-vc-backend) backend) + (set (make-local-variable 'log-view-vc-fileset) files) + (set (make-local-variable 'revert-buffer-function) + rev-buff-func))) ;; Display after setting up major-mode, so display-buffer-alist can know ;; the major-mode. - (pop-to-buffer buffer-name) + (pop-to-buffer buffer-name) (vc-run-delayed (let ((inhibit-read-only t)) (funcall setup-buttons-func backend files retval) commit 6ffab21f41d5fd0f31b8dbaacea98be409e4fe51 Author: Rüdiger Sonderfeld Date: Wed Nov 19 03:55:00 2014 +0100 vc-git: Support `diff-switches'. Fix bug#19099. * lisp/vc/vc-git.el (vc-git-diff): Use "difftool -x diff" with `diff-switches' if `vc-git-diff-switches' is nil. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b7f62a..25ef3b3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-11-19 Rüdiger Sonderfeld + + Fix bug#19099. + * vc/vc-git.el (vc-git-diff): Use "difftool -x diff" with + `diff-switches' if `vc-git-diff-switches' is nil. + 2014-11-18 Juri Linkov * simple.el (next-line-or-history-element): Wrap next-line diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index be0211c..3b11a3c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -994,11 +994,18 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-diff (files &optional rev1 rev2 buffer) "Get a difference report using Git between two revisions of FILES." (let (process-file-side-effects) - (apply #'vc-git-command (or buffer "*vc-diff*") 1 files - (if (and rev1 rev2) "diff-tree" "diff-index") - "--exit-code" - (append (vc-switches 'git 'diff) - (list "-p" (or rev1 "HEAD") rev2 "--"))))) + (if vc-git-diff-switches + (apply #'vc-git-command (or buffer "*vc-diff*") 1 files + (if (and rev1 rev2) "diff-tree" "diff-index") + "--exit-code" + (append (vc-switches 'git 'diff) + (list "-p" (or rev1 "HEAD") rev2 "--"))) + (vc-git-command (or buffer "*vc-diff*") 1 files + "difftool" "--exit-code" "--no-prompt" "-x" + (concat "diff " + (mapconcat 'identity + (vc-switches nil 'diff) " ")) + (or rev1 "HEAD") rev2 "--")))) (defun vc-git-revision-table (_files) ;; What about `files'?!? --Stef