update packages

This commit is contained in:
2025-06-22 17:08:08 +02:00
parent 54e5633369
commit 16a0a6db93
558 changed files with 68349 additions and 26568 deletions

View File

@@ -6,7 +6,8 @@
;; Author: Jason R. Blevins <jblevins@xbeta.org>
;; Maintainer: Jason R. Blevins <jblevins@xbeta.org>
;; Created: May 24, 2007
;; Version: 2.8-alpha
;; Package-Version: 20250606.314
;; Package-Revision: 7c20685df615
;; Package-Requires: ((emacs "28.1"))
;; Keywords: Markdown, GitHub Flavored Markdown, itex
;; URL: https://jblevins.org/projects/markdown-mode/
@@ -263,11 +264,11 @@ This is the default search behavior of Ikiwiki."
:package-version '(markdown-mode . "2.2"))
(defcustom markdown-wiki-link-search-type nil
"Searching type for markdown wiki link.
"A list of options for searching for markdown wiki links.
sub-directories: search for wiki link targets in sub directories
parent-directories: search for wiki link targets in parent directories
project: search for wiki link targets under project root"
`sub-directories': search for wiki link targets in sub directories
`parent-directories': search for wiki link targets in parent directories
`project': search for wiki link targets under project root"
:group 'markdown
:type '(set
(const :tag "search wiki link from subdirectories" sub-directories)
@@ -278,6 +279,16 @@ project: search for wiki link targets under project root"
(make-obsolete-variable 'markdown-wiki-link-search-subdirectories 'markdown-wiki-link-search-type "2.5")
(make-obsolete-variable 'markdown-wiki-link-search-parent-directories 'markdown-wiki-link-search-type "2.5")
(make-obsolete 'markdown-match-wiki-link nil "2.8")
(make-obsolete 'markdown-highlight-wiki-link nil "2.8")
(make-obsolete 'markdown-unfontify-region-wiki-links nil "2.8")
(make-obsolete 'markdown-fontify-region-wiki-links nil "2.8")
(make-obsolete 'markdown-extend-changed-region nil "2.8")
(make-obsolete 'markdown-check-change-for-wiki-link nil "2.8")
(make-obsolete 'markdown-check-change-for-wiki-link-after-change nil "2.8")
(make-obsolete 'markdown-fontify-buffer-wiki-links nil "2.8")
(make-obsolete 'markdown-setup-wiki-link-hooks nil "2.8")
(defcustom markdown-wiki-link-fontify-missing nil
"When non-nil, change wiki link face according to existence of target files.
This is expensive because it requires checking for the file each time the buffer
@@ -930,7 +941,6 @@ This matches typical bracketed [[WikiLinks]] as well as \\='aliased
wiki links of the form [[PageName|link text]].
The meanings of the first and second components depend
on the value of `markdown-wiki-link-alias-first'.
Group 1 matches the entire link.
Group 2 matches the opening square brackets.
Group 3 matches the first component of the wiki link.
@@ -2007,12 +2017,14 @@ inline code fragments and code blocks."
(defface markdown-link-face
'((t (:inherit link)))
"Face for links."
"Face for link text, ie the alias portion of a link.
If a wiki link does not have an alias portion, use this face
for the entire link."
:group 'markdown-faces)
(defface markdown-missing-link-face
'((t (:inherit font-lock-warning-face)))
"Face for missing links."
"Face for the link text if the link points to a missing file."
:group 'markdown-faces)
(defface markdown-reference-face
@@ -2283,6 +2295,7 @@ Depending on your font, some reasonable choices are:
(7 markdown-markup-properties)))
(markdown-fontify-inline-links)
(markdown-fontify-reference-links)
(markdown-fontify-wiki-links)
(,markdown-regex-reference-definition . ((1 'markdown-markup-face) ; [
(2 'markdown-reference-face) ; label
(3 'markdown-markup-face) ; ]
@@ -2319,8 +2332,7 @@ Depending on your font, some reasonable choices are:
(markdown-fontify-sub-superscripts)
(markdown-match-inline-attributes . ((0 markdown-markup-properties prepend)))
(markdown-match-leanpub-sections . ((0 markdown-markup-properties)))
(markdown-fontify-blockquotes)
(markdown-match-wiki-link . ((0 'markdown-link-face prepend))))
(markdown-fontify-blockquotes))
"Syntax highlighting for Markdown files.")
;; Footnotes
@@ -3422,7 +3434,8 @@ the buffer)."
(markdown-code-block-at-pos begin))
(progn (goto-char (min (1+ begin) last))
(when (< (point) last)
(markdown-match-wiki-link last)))
(with-no-warnings
(markdown-match-wiki-link last))))
(set-match-data (list begin end))
t))))
@@ -3709,6 +3722,18 @@ SEQ may be an atom or a sequence."
(defvar markdown-mode-syntax-table
(let ((tab (make-syntax-table text-mode-syntax-table)))
(modify-syntax-entry ?\" "." tab)
(modify-syntax-entry ?$ "." tab) ; Might appear in inline content
(modify-syntax-entry ?% "." tab) ; Could appear in URLs
(modify-syntax-entry ?* "." tab) ; Emphasis (bold/italic)
(modify-syntax-entry ?+ "." tab) ; Used in lists
(modify-syntax-entry ?/ "." tab) ; Might appear in inline content or URLs
(modify-syntax-entry ?< "." tab) ; For autolinks and embedded HTML
(modify-syntax-entry ?= "." tab) ; Underlining in setext headers
(modify-syntax-entry ?> "." tab) ; Blockquotes and HTML
(modify-syntax-entry ?_ "." tab) ; Used for emphasis/bold
(modify-syntax-entry ?| "." tab) ; Used in tables
(modify-syntax-entry ?& "." tab) ; HTML entities
(modify-syntax-entry ?' "." tab) ; Apostrophe as punctuation
tab)
"Syntax table for `markdown-mode'.")
@@ -5254,8 +5279,7 @@ Otherwise, do normal delete by repeating
(back-to-indentation)
(unless (looking-at-p "[ \t]*$")
(setq mincol (min mincol (current-column))))
(forward-line 1)
))
(forward-line 1)))
mincol))
(defun markdown-indent-region (beg end arg)
@@ -5730,7 +5754,39 @@ Assumes match data is available for `markdown-regex-italic'."
"Keymap for `gfm-mode'.
See also `markdown-mode-map'.")
;;; Text Properties ===========================================================
(defconst markdown--markup-props (list 'invisible 'markdown-markup
'rear-nonsticky t
'font-lock-multiline t))
(defconst markdown--title-props (list 'invisible 'markdown-markup
'font-lock-multiline t))
(defun markdown--url-props ()
(if markdown-mouse-follow-link
(list 'invisible 'markdown-markup
'keymap markdown-mode-mouse-map
'mouse-face 'markdown-highlight-face
'font-lock-multiline t)
(list 'invisible 'markdown-markup
'keymap markdown-mode-mouse-map
'font-lock-multiline t)))
(defun markdown--link-props (url &optional title)
"Return a property list for URL with optional TITLE."
(let ((echo-text (if title (concat title "\n" url) url)))
(if markdown-mouse-follow-link
(list 'keymap markdown-mode-mouse-map
'mouse-face 'markdown-highlight-face
'font-lock-multiline t
'help-echo echo-text)
(list 'keymap markdown-mode-mouse-map
'font-lock-multiline t
'help-echo echo-text))))
;;; Menu ======================================================================
(easy-menu-define markdown-mode-menu markdown-mode-map
@@ -7709,8 +7765,8 @@ Return the name of the output buffer used."
(erase-buffer))
(if (stringp command)
(if (not (null command-args))
(apply #'call-process-region begin-region end-region command nil buf nil command-args)
(call-process-region begin-region end-region command nil buf))
(apply #'call-process-region begin-region end-region command nil (list buf nil) nil command-args)
(call-process-region begin-region end-region command nil (list buf nil)))
(if markdown-command-needs-filename
(if (not buffer-file-name)
(user-error "Must be visiting a file")
@@ -8208,39 +8264,20 @@ Translate filenames using `markdown-filename-translate-function'."
(title-start (match-beginning 7))
(title-end (match-end 7))
(title (match-string-no-properties 7))
;; Markup part
(mp (list 'invisible 'markdown-markup
'rear-nonsticky t
'font-lock-multiline t))
;; Link part (without face)
(lp (list 'keymap markdown-mode-mouse-map
'font-lock-multiline t
'help-echo (if title (concat title "\n" url) url)))
;; URL part
(up (list 'keymap markdown-mode-mouse-map
'invisible 'markdown-markup
'font-lock-multiline t))
;; URL composition character
(url-char (markdown--first-displayable markdown-url-compose-char))
;; Title part
(tp (list 'invisible 'markdown-markup
'font-lock-multiline t)))
(when markdown-mouse-follow-link
(setq lp (append lp '(mouse-face 'markdown-highlight-face)))
(setq up (append up '(mouse-face 'markdown-highlight-face))))
(url-char (markdown--first-displayable markdown-url-compose-char)))
(dolist (g '(1 2 4 5 8))
(when (match-end g)
(add-text-properties (match-beginning g) (match-end g) mp)
(add-text-properties (match-beginning g) (match-end g) markdown--markup-props)
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
;; Preserve existing faces applied to link part (e.g., inline code)
(when link-start
(add-text-properties link-start link-end lp)
(add-text-properties link-start link-end (markdown--link-props url title))
(add-face-text-property link-start link-end 'markdown-link-face))
(when url-start
(add-text-properties url-start url-end up)
(add-text-properties url-start url-end (markdown--url-props))
(add-face-text-property url-start url-end 'markdown-url-face))
(when title-start
(add-text-properties url-end title-end tp)
(add-text-properties url-end title-end markdown--title-props)
(add-face-text-property url-end title-end 'markdown-link-title-face))
(when (and markdown-hide-urls url-start)
(compose-region url-start (or title-end url-end) url-char))
@@ -8253,11 +8290,7 @@ Translate filenames using `markdown-filename-translate-function'."
(link-end (match-end 3))
(ref-start (match-beginning 6))
(ref-end (match-end 6))
;; Markup part
(mp (list 'invisible 'markdown-markup
'rear-nonsticky t
'font-lock-multiline t))
;; Link part
;; Link properties
(lp (list 'keymap markdown-mode-mouse-map
'font-lock-multiline t
'help-echo (lambda (_ __ pos)
@@ -8268,14 +8301,14 @@ Translate filenames using `markdown-filename-translate-function'."
"Undefined reference"))))))
;; URL composition character
(url-char (markdown--first-displayable markdown-url-compose-char))
;; Reference part
;; Reference properties
(rp (list 'invisible 'markdown-markup
'font-lock-multiline t)))
(when markdown-mouse-follow-link
(setq lp (append lp '(mouse-face markdown-highlight-face))))
(dolist (g '(1 2 4 5 8))
(when (match-end g)
(add-text-properties (match-beginning g) (match-end g) mp)
(add-text-properties (match-beginning g) (match-end g) markdown--markup-props)
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
(when link-start
(add-text-properties link-start link-end lp)
@@ -8287,6 +8320,75 @@ Translate filenames using `markdown-filename-translate-function'."
(compose-region ref-start ref-end url-char)))
t)))
(defun markdown-fontify-wiki-links (last)
"Add text properties to next wiki link from point to LAST."
(when (and markdown-enable-wiki-links
(markdown-match-inline-generic markdown-regex-wiki-link last))
(let* ((begin (match-beginning 1))
(end (match-end 1))
(beg2 (match-beginning 2))
(end2 (match-end 2))
(beg3 (match-beginning 3))
(end3 (match-end 3))
(beg4 (match-beginning 4))
(end4 (match-end 4))
(beg5 (match-beginning 5))
(end5 (match-end 5))
(beg6 (match-beginning 6))
(end6 (match-end 6))
(part1 (match-string-no-properties 3))
(part2 (match-string-no-properties 5))
(aliasp (string-equal (match-string-no-properties 4) "|"))
(file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
(file-missing-p (not (file-exists-p file-name))))
(if (or (markdown-in-comment-p begin)
(markdown-in-comment-p end)
(markdown-inline-code-at-pos-p begin)
(markdown-inline-code-at-pos-p end)
(markdown-code-block-at-pos begin))
(progn (goto-char (min (1+ begin) last))
(when (< (point) last)
(markdown-fontify-wiki-links last)))
;; Add text properties for hiding markup
(progn
;; Propertize opening and closing brackets
(add-text-properties beg2 end2 markdown--markup-props)
(add-face-text-property beg2 end2 'markdown-markup-face)
(add-text-properties beg6 end6 markdown--markup-props)
(add-face-text-property beg6 end6 'markdown-markup-face)
(if aliasp
(progn
;; Propertize pipe separating URL from link text
(add-text-properties beg4 end4 markdown--markup-props)
(add-face-text-property beg4 end4 'markdown-markup-face)
(if markdown-wiki-link-alias-first
(progn
;; Properties alias portion of link
(add-text-properties beg3 end3 (markdown--link-props part2))
(add-face-text-property beg3 end3 'markdown-link-face)
(add-text-properties beg5 end5 (markdown--url-props))
(add-text-properties beg5 end5 '(invisible markdown-markup))
(add-face-text-property beg5 end5 'markdown-url-face)
(when (and file-missing-p markdown-wiki-link-fontify-missing)
(put-text-property beg3 end3 'face 'markdown-missing-link-face)))
(progn
;; Properties URL portion of link
(add-text-properties beg3 end3 (markdown--url-props))
(add-text-properties beg3 end3 '(invisible markdown-markup))
(add-face-text-property beg3 end3 'markdown-url-face)
(add-text-properties beg5 end5 (markdown--link-props part1))
(add-face-text-property beg5 end5 'markdown-link-face)
(when (and file-missing-p markdown-wiki-link-fontify-missing)
(put-text-property beg5 end5 'face 'markdown-missing-link-face)))))
(progn
;; Properties link as link text
(add-text-properties beg3 end3 (markdown--link-props part1))
(add-face-text-property beg3 end3 'markdown-link-face)
(when (and file-missing-p markdown-wiki-link-fontify-missing)
(put-text-property beg3 end3 'face 'markdown-missing-link-face)))))
(set-match-data (list begin end))
t))))
(defun markdown-fontify-angle-uris (last)
"Add text properties to angle URIs from point to LAST."
(when (markdown-match-angle-uris last)
@@ -8294,15 +8396,11 @@ Translate filenames using `markdown-filename-translate-function'."
(url-end (match-end 2)))
(unless (or (markdown-in-inline-code-p url-start)
(markdown-in-inline-code-p url-end))
(let* (;; Markup part
(mp (list 'face 'markdown-markup-face
'invisible 'markdown-markup
'rear-nonsticky t
'font-lock-multiline t))
;; URI part
(up (list 'keymap markdown-mode-mouse-map
'face 'markdown-plain-url-face
'font-lock-multiline t)))
(let ((mp (append '(face markdown-markup-face) (cl-copy-list markdown--markup-props)))
;; URI part
(up (list 'keymap markdown-mode-mouse-map
'face 'markdown-plain-url-face
'font-lock-multiline t)))
(when markdown-mouse-follow-link
(setq up (append up '(mouse-face markdown-highlight-face))))
(dolist (g '(1 3))
@@ -8372,6 +8470,11 @@ The location of the alias component depends on the value of
(or (match-string-no-properties 5) (match-string-no-properties 3))))
(defun markdown--wiki-link-search-types ()
"Return a list of the currently selected search types.
Due to deprecated variables, as of markdown-mode version 2.5, the return value
of this function is the same as the value of the variable
`markdown-wiki-link-search-type'."
(let ((ret (and markdown-wiki-link-search-type
(cl-copy-list markdown-wiki-link-search-type))))
(when (and markdown-wiki-link-search-subdirectories
@@ -8383,6 +8486,7 @@ The location of the alias component depends on the value of
ret))
(defun markdown--project-root ()
"Try various approaches to find the project root."
(or (cl-loop for dir in '(".git" ".hg" ".svn")
when (locate-dominating-file default-directory dir)
return it)
@@ -8397,12 +8501,9 @@ The location of the alias component depends on the value of
(defun markdown-convert-wiki-link-to-filename (name)
"Generate a filename from the wiki link NAME.
Spaces in NAME are replaced with `markdown-link-space-sub-char'.
Search depth is determined by `markdown-wiki-link-search-type'.
When in `gfm-mode', follow GitHub's conventions where [[Test Test]]
and [[test test]] both map to Test-test.ext. Look in the current
directory first, then in subdirectories if
`markdown-wiki-link-search-subdirectories' is non-nil, and then
in parent directories if
`markdown-wiki-link-search-parent-directories' is non-nil."
and [[test test]] both map to Test-test.ext."
(save-match-data
;; This function must not overwrite match data(PR #590)
(let* ((basename (replace-regexp-in-string
@@ -8493,11 +8594,12 @@ and highlight accordingly."
(file-name
(markdown-convert-wiki-link-to-filename
(markdown-wiki-link-link))))
(if (condition-case nil (file-exists-p file-name) (error nil))
(with-no-warnings
(if (condition-case nil (file-exists-p file-name) (error nil))
(markdown-highlight-wiki-link
highlight-beginning highlight-end 'markdown-link-face)
(markdown-highlight-wiki-link
highlight-beginning highlight-end 'markdown-link-face)
(markdown-highlight-wiki-link
highlight-beginning highlight-end 'markdown-missing-link-face)))))))
highlight-beginning highlight-end 'markdown-missing-link-face))))))))
(defun markdown-extend-changed-region (from to)
"Extend region given by FROM and TO so that we can fontify all links.
@@ -8533,7 +8635,8 @@ newline after."
;; Extend the region to fontify so that it starts
;; and ends at safe places.
(cl-multiple-value-bind (new-from new-to)
(markdown-extend-changed-region from to)
(with-no-warnings
(markdown-extend-changed-region from to))
(goto-char new-from)
;; Only refontify when the range contains text with a
;; wiki link face or if the wiki link regexp matches.
@@ -8542,10 +8645,11 @@ newline after."
'(markdown-link-face markdown-missing-link-face))
(re-search-forward
markdown-regex-wiki-link new-to t))
;; Unfontify existing fontification (start from scratch)
(markdown-unfontify-region-wiki-links new-from new-to)
;; Now do the fontification.
(markdown-fontify-region-wiki-links new-from new-to))))))
(with-no-warnings
;; Unfontify existing fontification (start from scratch)
(markdown-unfontify-region-wiki-links new-from new-to)
;; Now do the fontification.
(markdown-fontify-region-wiki-links new-from new-to)))))))
(cursor-intangible-mode -1)
(and (not modified)
(buffer-modified-p)
@@ -8554,12 +8658,14 @@ newline after."
(defun markdown-check-change-for-wiki-link-after-change (from to _)
"Check region between FROM and TO for wiki links and re-fontify as needed.
Designed to be used with the `after-change-functions' hook."
(markdown-check-change-for-wiki-link from to))
(with-no-warnings
(markdown-check-change-for-wiki-link from to)))
(defun markdown-fontify-buffer-wiki-links ()
"Refontify all wiki links in the buffer."
(interactive)
(markdown-check-change-for-wiki-link (point-min) (point-max)))
(with-no-warnings
(markdown-check-change-for-wiki-link (point-min) (point-max))))
(defun markdown-toggle-wiki-links (&optional arg)
"Toggle support for wiki links.
@@ -8571,33 +8677,36 @@ and disable it otherwise."
(not markdown-enable-wiki-links)
(> (prefix-numeric-value arg) 0)))
(when (called-interactively-p 'interactive)
(message "markdown-mode wiki link support %s" (if markdown-enable-wiki-links "enabled" "disabled")))
(message "markdown-mode wiki link support %s"
(if markdown-enable-wiki-links "enabled" "disabled")))
(markdown-reload-extensions))
(defun markdown-setup-wiki-link-hooks ()
"Add or remove hooks for fontifying wiki links.
These are only enabled when `markdown-wiki-link-fontify-missing' is non-nil."
;; Anytime text changes make sure it gets fontified correctly
(if (and markdown-enable-wiki-links
markdown-wiki-link-fontify-missing)
(add-hook 'after-change-functions
#'markdown-check-change-for-wiki-link-after-change t t)
(remove-hook 'after-change-functions
#'markdown-check-change-for-wiki-link-after-change t))
;; If we left the buffer there is a really good chance we were
;; creating one of the wiki link documents. Make sure we get
;; refontified when we come back.
(if (and markdown-enable-wiki-links
markdown-wiki-link-fontify-missing)
(progn
(add-hook 'window-configuration-change-hook
#'markdown-fontify-buffer-wiki-links t t)
(markdown-fontify-buffer-wiki-links))
(remove-hook 'window-configuration-change-hook
#'markdown-fontify-buffer-wiki-links t)
(markdown-unfontify-region-wiki-links (point-min) (point-max))))
(with-no-warnings
(if (and markdown-enable-wiki-links
markdown-wiki-link-fontify-missing)
(add-hook 'after-change-functions
#'markdown-check-change-for-wiki-link-after-change t t)
(remove-hook 'after-change-functions
#'markdown-check-change-for-wiki-link-after-change t))
;; If we left the buffer there is a really good chance we were
;; creating one of the wiki link documents. Make sure we get
;; refontified when we come back.
(if (and markdown-enable-wiki-links
markdown-wiki-link-fontify-missing)
(progn
(add-hook 'window-configuration-change-hook
#'markdown-fontify-buffer-wiki-links t t)
(markdown-fontify-buffer-wiki-links))
(remove-hook 'window-configuration-change-hook
#'markdown-fontify-buffer-wiki-links t)
(with-no-warnings
(markdown-unfontify-region-wiki-links (point-min) (point-max))))) )
;;; Following & Doing =========================================================
(defun markdown-follow-thing-at-point (arg)
@@ -8784,9 +8893,7 @@ or span."
(interactive)
(when (derived-mode-p 'markdown-mode)
;; Refontify buffer
(font-lock-flush)
;; Add or remove hooks related to extensions
(markdown-setup-wiki-link-hooks)))
(font-lock-flush)))
(defun markdown-handle-local-variables ()
"Run in `hack-local-variables-hook' to update font lock rules.
@@ -10090,6 +10197,19 @@ rows and columns and the column alignment."
(propertize link 'face 'markdown-reference-face)
(propertize "]" 'face 'markdown-markup-face))
(propertize link 'face 'markdown-url-face)))))
;; Hidden URL for wiki links
((and (and markdown-enable-wiki-links
(thing-at-point-looking-at markdown-regex-wiki-link))
(or markdown-hide-urls markdown-hide-markup))
(let* ((aliasp (string-equal (match-string-no-properties 4) "|"))
(part1 (match-string-no-properties 3))
(part2 (match-string-no-properties 5))
(link (if (and aliasp markdown-wiki-link-alias-first) part2 part1))
(edit-keys (markdown--substitute-command-keys
"\\[markdown-insert-wiki-link]"))
(edit-str (propertize edit-keys 'face 'font-lock-constant-face)))
(format "Hidden URL (%s to edit): %s"
edit-str (propertize link 'face 'markdown-reference-face))))
;; Hidden language name for fenced code blocks
((and (markdown-code-block-at-point-p)
(not (get-text-property (point) 'markdown-pre))
@@ -10224,8 +10344,6 @@ rows and columns and the column alignment."
(if markdown-hide-markup
(add-to-invisibility-spec 'markdown-markup)
(remove-from-invisibility-spec 'markdown-markup))
;; Wiki links
(markdown-setup-wiki-link-hooks)
;; Math mode
(when markdown-enable-math (markdown-toggle-math t))
;; Add a buffer-local hook to reload after file-local variables are read
@@ -10405,7 +10523,7 @@ rows and columns and the column alignment."
(define-key map (kbd "SPC") #'scroll-up-command)
(define-key map (kbd ">") #'end-of-buffer)
(define-key map (kbd "<") #'beginning-of-buffer)
(define-key map (kbd "q") #'kill-this-buffer)
(define-key map (kbd "q") #'kill-current-buffer)
(define-key map (kbd "?") #'describe-mode)
map)
"Keymap for `markdown-view-mode'.")