summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-print.el4
-rw-r--r--lisp/emacs-lisp/lisp-mode.el16
-rw-r--r--lisp/emacs-lisp/rx.el32
3 files changed, 35 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 1eae8faf236..bf5b1e878d5 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -109,7 +109,7 @@ call other entry points instead, such as `cl-prin1'."
(princ (hash-table-count object) stream)
(princ "/" stream)
(princ (hash-table-size object) stream)
- (princ (format " 0x%x" (sxhash object)) stream)
+ (princ (format " %#x" (sxhash object)) stream)
(princ ">" stream))
(define-button-type 'help-byte-code
@@ -166,7 +166,7 @@ into a button whose action shows the function's disassembly.")
(let ((button-start (and cl-print-compiled-button
(bufferp stream)
(with-current-buffer stream (point)))))
- (princ (format "#<bytecode 0x%x>" (sxhash object)) stream)
+ (princ (format "#<bytecode %#x>" (sxhash object)) stream)
(when (eq cl-print-compiled 'static)
(princ " " stream)
(cl-print-object (aref object 2) stream))
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4e5b1a7e4ff..6313c63ecfe 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1196,7 +1196,21 @@ ENDPOS is encountered."
(if endpos endpos
;; Get error now if we don't have a complete sexp
;; after point.
- (save-excursion (forward-sexp 1) (point)))))
+ (save-excursion
+ (let ((eol (line-end-position)))
+ (forward-sexp 1)
+ ;; We actually look for a sexp which ends
+ ;; after the current line so that we properly
+ ;; indent things like #s(...). This might not
+ ;; be needed if Bug#15998 is fixed.
+ (condition-case ()
+ (while (and (< (point) eol) (not (eobp)))
+ (forward-sexp 1))
+ ;; But don't signal an error for incomplete
+ ;; sexps following the first complete sexp
+ ;; after point.
+ (scan-error nil)))
+ (point)))))
(save-excursion
(while (let ((indent (lisp-indent-calc-next parse-state))
(ppss (lisp-indent-state-ppss parse-state)))
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 85e74f28ef0..bb759011513 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1183,24 +1183,28 @@ enclosed in `(and ...)'.
(pcase-defmacro rx (&rest regexps)
- "Build a `pcase' pattern matching `rx' regexps.
-The REGEXPS are interpreted as by `rx'. The pattern matches if
-the regular expression so constructed matches EXPVAL, as if
-by `string-match'.
+ "Build a `pcase' pattern matching `rx' REGEXPS in sexp form.
+The REGEXPS are interpreted as in `rx'. The pattern matches any
+string that is a match for the regular expression so constructed,
+as if by `string-match'.
In addition to the usual `rx' constructs, REGEXPS can contain the
following constructs:
- (let VAR FORM...) creates a new explicitly numbered submatch
- that matches FORM and binds the match to
- VAR.
- (backref VAR) creates a backreference to the submatch
- introduced by a previous (let VAR ...)
- construct.
-
-The VARs are associated with explicitly numbered submatches
-starting from 1. Multiple occurrences of the same VAR refer to
-the same submatch.
+ (let REF SEXP...) creates a new explicitly named reference to
+ a submatch that matches regular expressions
+ SEXP, and binds the match to REF.
+ (backref REF) creates a backreference to the submatch
+ introduced by a previous (let REF ...)
+ construct. REF can be the same symbol
+ in the first argument of the corresponding
+ (let REF ...) construct, or it can be a
+ submatch number. It matches the referenced
+ submatch.
+
+The REFs are associated with explicitly named submatches starting
+from 1. Multiple occurrences of the same REF refer to the same
+submatch.
If a case matches, the match data is modified as usual so you can
use it in the case body, but you still have to pass the correct