[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d9a2673ee9 5/6: Merge from origin/emacs-29
From: |
Stefan Monnier |
Subject: |
master d9a2673ee9 5/6: Merge from origin/emacs-29 |
Date: |
Sat, 14 Jan 2023 09:17:46 -0500 (EST) |
branch: master
commit d9a2673ee95cf7172a622dc0229ddf72aec8e8c1
Merge: b6207e87fa 96601cd90b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Merge from origin/emacs-29
96601cd90ba apropos.el: Fix bug#60628
10032f424cc Fix indentation of some declarations and statements
e2e937300f5 Fix indentation of object_expressions in csharp-ts-mode
0116e27b26c ; Fix NEWS markup
435ba92ccc4 ; Fix last change in htmlfontify.el
7100ecd7a47 Replace 'hfy-find-cmd' with 'directory-files-recursively'.
f102145d381 ; * etc/PROBLEMS: Describe problems with MuPDF 1.21. (Bu...
---
etc/NEWS | 9 +++
etc/NEWS.29 | 15 ++++
etc/PROBLEMS | 12 +++
lisp/apropos.el | 177 +++++++++++++++++++++++------------------
lisp/htmlfontify.el | 24 ++++--
lisp/progmodes/csharp-mode.el | 5 ++
lisp/progmodes/java-ts-mode.el | 4 +
7 files changed, 161 insertions(+), 85 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 90a6c6a052..cb83ec24a6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -147,6 +147,15 @@ point is not in a comment or a string. It is by default
bound to
*** New connection method "toolbox".
This allow accessing system containers provided by Toolbox.
+** EWW
+
++++
+*** 'eww-open-file' can now display the file in a new buffer.
+By default, the command reuses the '*eww*' buffer, but if called with
+the new argument non-nil, it will use a new buffer instead.
+Interactively, invoke 'eww-open-file' with a prefix argument to
+activate this behavior.
+
* New Modes and Packages in Emacs 30.1
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index 08c7f8a4dd..a9392ba627 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -1636,6 +1636,21 @@ randomness as before, or to use a bag).
*** New user option 'battery-update-functions'.
This can be used to trigger actions based on the battery status.
+** DocView
+
+---
+*** doc-view can now generate SVG images when viewing PDF files.
+If Emacs is built with SVG support, doc-view can generate SVG files
+when using MuPDF as the converter for PDF files, which generally leads
+to sharper images (especially when zooming), and allows customization
+of background and foreground color of the page via the new user
+options 'doc-view-svg-background' and 'doc-view-svg-foreground'. To
+activate this behaviour, set 'doc-view-mupdf-use-svg' to non-nil if
+your Emacs has SVG support. Note that, with some versions of MuPDF,
+SVG generation is known to sometimes produce SVG files that are buggy
+or can take a long time to render.
+
+
** Enriched Mode
+++
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index d4354e5f7a..9ef231d4b1 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -628,6 +628,18 @@ To work around the problem, customize the option
'window-adjust-process-window-size-function' to "Do not adjust process
window sizes" (Lisp value 'ignore').
+*** Displaying PDF files in DocView produces an empty buffer.
+
+This can happen if your Emacs is configured to convert PDF to SVG for
+display, and the version of the MuPDF package you have installed has a
+a known bug, whereby it sometimes produces invalid SVG images.
+Version 1.21 of MuPDF is known to be affected.
+
+The solution is either to upgrade or downgrade to a version of MuPDF
+that doesn't have this bug, or to disable conversion of PDF files to
+SVG images by customizing the user option 'doc-view-mupdf-use-svg'.
+Emacs will then convert PDF to PNG images instead.
+
*** In Inferior Python mode, input is echoed and native completion doesn't
work.
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25753>
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 9b9615221c..459dc72b47 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -886,6 +886,26 @@ Optional arg BUFFER (default: current buffer) is the
buffer to check."
(if (consp pattern) "keywords " "")
pattern))))
+(defun apropos--map-preloaded-atoms (f)
+ "Like `mapatoms' but only enumerates functions&vars that are predefined."
+ (let ((preloaded-regexp
+ (concat "\\`"
+ (regexp-quote lisp-directory)
+ (regexp-opt preloaded-file-list)
+ "\\.elc?\\'")))
+ ;; FIXME: I find this regexp approach brittle. Maybe a better
+ ;; option would be find/record the nthcdr of `load-history' which
+ ;; corresponds to the `load-history' state when we dumped.
+ ;; (Then again, maybe an even better approach would be to record the
+ ;; state of the `obarray' when we dumped, which we may also be able to
+ ;; use in `bytecomp' to provide a clean initial environment?)
+ (dolist (x load-history)
+ (when (string-match preloaded-regexp (car x))
+ (dolist (def (cdr x))
+ (cond
+ ((symbolp def) (funcall f def))
+ ((eq 'defun (car-safe def)) (funcall f (cdr def)))))))))
+
;;;###autoload
(defun apropos-documentation (pattern &optional do-all)
"Show symbols whose documentation contains matches for PATTERN.
@@ -894,10 +914,11 @@ or a regexp (using some regexp special characters). If
it is a word,
search for matches for that word as a substring. If it is a list of words,
search for matches for any two (or more) of those words.
-Note that by default this command only searches in the file specified by
-`internal-doc-file-name'; i.e., the etc/DOC file. With \\[universal-argument]
prefix,
-or if `apropos-do-all' is non-nil, it searches all currently defined
-documentation strings.
+Note that by default this command only searches in the functions predefined
+at Emacs startup, i.e., the primitives implemented in C or preloaded in the
+Emacs dump image.
+With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, it
searches
+all currently defined documentation strings.
Returns list of symbols and documentation found."
;; The doc used to say that DO-ALL includes key-bindings info in the
@@ -913,33 +934,33 @@ Returns list of symbols and documentation found."
(apropos-sort-by-scores apropos-documentation-sort-by-scores)
f v sf sv)
(apropos-documentation-check-doc-file)
- (if do-all
- (mapatoms
- (lambda (symbol)
- (setq f (apropos-safe-documentation symbol)
- v (get symbol 'variable-documentation))
- (if (integerp v) (setq v nil))
- (setq f (apropos-documentation-internal f)
- v (apropos-documentation-internal v))
- (setq sf (apropos-score-doc f)
- sv (apropos-score-doc v))
- (if (or f v)
- (if (setq apropos-item
- (cdr (assq symbol apropos-accumulator)))
- (progn
- (if f
- (progn
- (setcar (nthcdr 1 apropos-item) f)
- (setcar apropos-item (+ (car apropos-item) sf))))
- (if v
- (progn
- (setcar (nthcdr 2 apropos-item) v)
- (setcar apropos-item (+ (car apropos-item) sv)))))
- (setq apropos-accumulator
- (cons (list symbol
- (+ (apropos-score-symbol symbol 2) sf sv)
- f v)
- apropos-accumulator)))))))
+ (funcall
+ (if do-all #'mapatoms #'apropos--map-preloaded-atoms)
+ (lambda (symbol)
+ (setq f (apropos-safe-documentation symbol)
+ v (get symbol 'variable-documentation))
+ (if (integerp v) (setq v nil))
+ (setq f (apropos-documentation-internal f)
+ v (apropos-documentation-internal v))
+ (setq sf (apropos-score-doc f)
+ sv (apropos-score-doc v))
+ (if (or f v)
+ (if (setq apropos-item
+ (cdr (assq symbol apropos-accumulator)))
+ (progn
+ (if f
+ (progn
+ (setcar (nthcdr 1 apropos-item) f)
+ (setcar apropos-item (+ (car apropos-item) sf))))
+ (if v
+ (progn
+ (setcar (nthcdr 2 apropos-item) v)
+ (setcar apropos-item (+ (car apropos-item) sv)))))
+ (setq apropos-accumulator
+ (cons (list symbol
+ (+ (apropos-score-symbol symbol 2) sf sv)
+ f v)
+ apropos-accumulator))))))
(apropos-print nil "\n----------------\n" nil t))))
@@ -1064,53 +1085,55 @@ non-nil."
(setq apropos-files-scanned (cons file apropos-files-scanned))
(erase-buffer)
(insert-file-contents file)
- (while (search-forward "\n#@" nil t)
+ (while (search-forward "#@" nil t)
;; Read the comment length, and advance over it.
- (setq end (read)
- beg (1+ (point))
- end (+ (point) end -1))
- (forward-char)
- (if (save-restriction
- ;; match ^ and $ relative to doc string
- (narrow-to-region beg end)
- (re-search-forward apropos-all-words-regexp nil t))
- (progn
- (goto-char (+ end 2))
- (setq doc (buffer-substring beg end)
- end (- (match-end 0) beg)
- beg (- (match-beginning 0) beg))
- (when (apropos-true-hit-doc doc)
- (setq this-is-a-variable (looking-at "(def\\(var\\|const\\) ")
- symbol (progn
- (skip-chars-forward "(a-z")
- (forward-char)
- (read))
- symbol (if (consp symbol)
- (nth 1 symbol)
- symbol))
- (if (if this-is-a-variable
- (get symbol 'variable-documentation)
- (and (fboundp symbol) (apropos-safe-documentation
symbol)))
- (progn
- (or (and (setq apropos-item (assq symbol
apropos-accumulator))
- (setcar (cdr apropos-item)
- (+ (cadr apropos-item)
(apropos-score-doc doc))))
- (setq apropos-item (list symbol
- (+ (apropos-score-symbol
symbol 2)
- (apropos-score-doc doc))
- nil nil)
- apropos-accumulator (cons apropos-item
- apropos-accumulator)))
- (when apropos-match-face
- (setq doc (substitute-command-keys doc))
- (if (or (string-match apropos-pattern-quoted doc)
- (string-match apropos-all-words-regexp doc))
- (put-text-property (match-beginning 0)
- (match-end 0)
- 'face apropos-match-face doc)))
- (setcar (nthcdr (if this-is-a-variable 3 2)
- apropos-item)
- doc))))))))))
+ ;; This #@ may be a false positive, so don't get upset if
+ ;; it's not followed by the expected number of bytes to skip.
+ (when (and (setq end (ignore-errors (read))) (natnump end))
+ (setq beg (1+ (point))
+ end (+ (point) end -1))
+ (forward-char)
+ (if (save-restriction
+ ;; match ^ and $ relative to doc string
+ (narrow-to-region beg end)
+ (re-search-forward apropos-all-words-regexp nil t))
+ (progn
+ (goto-char (+ end 2))
+ (setq doc (buffer-substring beg end)
+ end (- (match-end 0) beg)
+ beg (- (match-beginning 0) beg))
+ (when (apropos-true-hit-doc doc)
+ (setq this-is-a-variable (looking-at "(def\\(var\\|const\\) ")
+ symbol (progn
+ (skip-chars-forward "(a-z")
+ (forward-char)
+ (read))
+ symbol (if (consp symbol)
+ (nth 1 symbol)
+ symbol))
+ (if (if this-is-a-variable
+ (get symbol 'variable-documentation)
+ (and (fboundp symbol) (apropos-safe-documentation
symbol)))
+ (progn
+ (or (and (setq apropos-item (assq symbol
apropos-accumulator))
+ (setcar (cdr apropos-item)
+ (+ (cadr apropos-item)
(apropos-score-doc doc))))
+ (setq apropos-item (list symbol
+ (+ (apropos-score-symbol
symbol 2)
+ (apropos-score-doc doc))
+ nil nil)
+ apropos-accumulator (cons apropos-item
+
apropos-accumulator)))
+ (when apropos-match-face
+ (setq doc (substitute-command-keys doc))
+ (if (or (string-match apropos-pattern-quoted doc)
+ (string-match apropos-all-words-regexp doc))
+ (put-text-property (match-beginning 0)
+ (match-end 0)
+ 'face apropos-match-face doc)))
+ (setcar (nthcdr (if this-is-a-variable 3 2)
+ apropos-item)
+ doc)))))))))))
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index c989a12d20..0e3b48470d 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -78,7 +78,7 @@
;;; Code:
-(eval-when-compile (require 'cl-lib))
+(require 'cl-lib)
(require 'cus-edit)
(defconst hfy-meta-tags
@@ -372,11 +372,15 @@ otherwise."
:tag "istext-command"
:type '(string))
-(defcustom hfy-find-cmd
- "find . -type f \\! -name \\*~ \\! -name \\*.flc \\! -path \\*/CVS/\\*"
- "Find command used to harvest a list of files to attempt to fontify."
- :tag "find-command"
- :type '(string))
+(defcustom hfy-exclude-file-rules
+ '("\\.flc$"
+ "/CVS/.*"
+ ".*~$"
+ "/\\.git\\(?:/.*\\)?$")
+ "Define some regular expressions to exclude files"
+ :tag "exclude-rules"
+ :type '(list string)
+ :version 29.1)
(defcustom hfy-display-class nil
"Display class to use to determine which display class to use when
@@ -1826,8 +1830,12 @@ Strips any leading \"./\" from each filename."
;;(message "hfy-list-files");;DBUG
;; FIXME: this changes the dir of the current buffer. Is that right??
(cd directory)
- (mapcar (lambda (F) (if (string-match "^./\\(.*\\)" F) (match-string 1 F) F))
- (split-string (shell-command-to-string hfy-find-cmd))) )
+ (cl-remove-if (lambda (f)
+ (or (null (file-regular-p f))
+ (seq-some (lambda (r)
+ (string-match r f))
+ hfy-exclude-file-rules)))
+ (directory-files-recursively "." ".*" nil t)))
;; strip the filename off, return a directory name
;; not a particularly thorough implementation, but it will be
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 32ec772169..870e6c84b4 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -640,6 +640,11 @@ compilation and evaluation time conflicts."
((parent-is "namespace_declaration") parent-bol 0)
((parent-is "class_declaration") parent-bol 0)
((parent-is "constructor_declaration") parent-bol 0)
+ ((parent-is "initializer_expression") parent-bol
csharp-ts-mode-indent-offset)
+ ((match "{" "anonymous_object_creation_expression") parent-bol 0)
+ ((parent-is "anonymous_object_creation_expression") parent-bol
csharp-ts-mode-indent-offset)
+ ((match "{" "object_creation_expression") parent-bol 0)
+ ((parent-is "object_creation_expression") parent-bol 0)
((parent-is "method_declaration") parent-bol 0)
((parent-is "enum_declaration") parent-bol 0)
((parent-is "operator_declaration") parent-bol 0)
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index 8d432f1774..f1da330f1e 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -85,6 +85,10 @@
((parent-is "record_declaration_body") parent-bol
java-ts-mode-indent-offset)
((query "(method_declaration (block _ @indent))") parent-bol
java-ts-mode-indent-offset)
((query "(method_declaration (block (_) @indent))") parent-bol
java-ts-mode-indent-offset)
+ ((parent-is "local_variable_declaration") parent-bol
java-ts-mode-indent-offset)
+ ((parent-is "expression_statement") parent-bol java-ts-mode-indent-offset)
+ ((parent-is "field_declaration") parent-bol java-ts-mode-indent-offset)
+ ((parent-is "return_statement") parent-bol java-ts-mode-indent-offset)
((parent-is "variable_declarator") parent-bol java-ts-mode-indent-offset)
((parent-is "method_invocation") parent-bol java-ts-mode-indent-offset)
((parent-is "switch_rule") parent-bol java-ts-mode-indent-offset)
- master updated (9a1dbb7f08 -> ad6d8f7df1), Stefan Monnier, 2023/01/14
- master b6207e87fa 4/6: ; Merge from origin/emacs-29, Stefan Monnier, 2023/01/14
- master 3eb495851e 2/6: ; Merge from origin/emacs-29, Stefan Monnier, 2023/01/14
- master 4f0459aaf7 1/6: Merge from origin/emacs-29, Stefan Monnier, 2023/01/14
- master a192ce03a0 3/6: Merge from origin/emacs-29, Stefan Monnier, 2023/01/14
- master ad6d8f7df1 6/6: Merge remote-tracking branch 'refs/remotes/origin/master', Stefan Monnier, 2023/01/14
- master d9a2673ee9 5/6: Merge from origin/emacs-29,
Stefan Monnier <=