diff options
-rw-r--r-- | etc/emacs.appdata.xml | 18 | ||||
-rw-r--r-- | lisp/elec-pair.el | 25 |
2 files changed, 32 insertions, 11 deletions
diff --git a/etc/emacs.appdata.xml b/etc/emacs.appdata.xml index c3b1afb6284..6d9df8bf0b5 100644 --- a/etc/emacs.appdata.xml +++ b/etc/emacs.appdata.xml @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2014-2017 Free Software Foundation, Inc. --> -<application> - <id type="desktop">emacs.desktop</id> - <metadata_license>GFDL-1.3</metadata_license> - <!-- It is GFDL-1.3+, but appdata-validate complains... --> - <project_license>GPL-3.0+ and GFDL-1.3</project_license> +<component type="desktop-application"> + <id>org.gnu.emacs</id> + <metadata_license>GFDL-1.3+</metadata_license> + <project_license>GPL-3.0+ and GFDL-1.3+</project_license> <name>GNU Emacs</name> <summary>An extensible text editor</summary> <description> @@ -25,9 +24,12 @@ </ul> </description> <screenshots> - <screenshot type="default" width="632" height="354">https://www.gnu.org/software/emacs/images/appdata.png</screenshot> + <screenshot type="default"> + <image type="source" width="632" height="354">https://www.gnu.org/software/emacs/images/appdata.png</image> + </screenshot> </screenshots> + <launchable type="desktop-id">emacs</launchable> <url type="homepage">https://www.gnu.org/software/emacs</url> - <updatecontact>emacs-devel_at_gnu.org</updatecontact> + <update_contact>emacs-devel_AT_gnu.org</update_contact> <project_group>GNU</project_group> -</application> +</component> diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 7f523d1df45..a980f51d3c0 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -24,6 +24,7 @@ ;;; Code: (require 'electric) +(eval-when-compile (require 'cl-lib)) ;;; Electric pairing. @@ -222,6 +223,22 @@ inside a comment or string." (electric-pair-mode nil)) (self-insert-command 1))) +(cl-defmacro electric-pair--with-uncached-syntax ((table &optional start) &rest body) + "Like `with-syntax-table', but flush the syntax-ppss cache afterwards. +Use this instead of (with-syntax-table TABLE BODY) when BODY +contains code which may update the syntax-ppss cache. This +includes calling `parse-partial-sexp' and any sexp-based movement +functions when `parse-sexp-lookup-properties' is non-nil. The +cache is flushed from position START, defaulting to point." + (declare (debug ((form &optional form) body)) (indent 1)) + (let ((start-var (make-symbol "start"))) + `(let ((syntax-propertize-function nil) + (,start-var ,(or start '(point)))) + (unwind-protect + (with-syntax-table ,table + ,@body) + (syntax-ppss-flush-cache ,start-var))))) + (defun electric-pair--syntax-ppss (&optional pos where) "Like `syntax-ppss', but sometimes fallback to `parse-partial-sexp'. @@ -240,7 +257,8 @@ when to fallback to `parse-partial-sexp'." (skip-syntax-forward " >!") (point))))) (if s-or-c-start - (with-syntax-table electric-pair-text-syntax-table + (electric-pair--with-uncached-syntax (electric-pair-text-syntax-table + s-or-c-start) (parse-partial-sexp s-or-c-start pos)) ;; HACK! cc-mode apparently has some `syntax-ppss' bugs (if (memq major-mode '(c-mode c++ mode)) @@ -293,7 +311,8 @@ If point is not enclosed by any lists, return ((t) . (t))." (cond ((< direction 0) (condition-case nil (eq (char-after pos) - (with-syntax-table table + (electric-pair--with-uncached-syntax + (table) (matching-paren (char-before (scan-sexps (point) 1))))) @@ -323,7 +342,7 @@ If point is not enclosed by any lists, return ((t) . (t))." (save-excursion (while (not outermost) (condition-case err - (with-syntax-table table + (electric-pair--with-uncached-syntax (table) (scan-sexps (point) (if (> direction 0) (point-max) (- (point-max)))) |