惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
博客园 - 司徒正美
罗磊的独立博客
D
Docker
Last Week in AI
Last Week in AI
爱范儿
爱范儿
M
MIT News - Artificial intelligence
V
V2EX
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
V
Visual Studio Blog
博客园 - 叶小钗
B
Blog RSS Feed
A
About on SuperTechFans
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
P
Proofpoint News Feed

elpa/gnu.git, branch externals/auctex

Release GNU AUCTeX 14.2.0 - elpa/gnu.git * latex.el (LaTeX-what-macro): Fix chars to skip backwards. - elpa/gnu.git * tex-ispell.el: Consolidate regexp for tabular environments. - elpa/gnu.git ; * latex.el (LaTeX-what-macro): Fix last change. - elpa/gnu.git * latex.el (LaTeX-what-macro): Improve macro recognition. - elpa/gnu.git Preserve `crm--choose-completion-string' - elpa/gnu.git - GNU ELPA Accept '-' as macro modifier - elpa/gnu.git Add new styles - elpa/gnu.git ; * tex-info.el (outline-heading-alist): Silence the compiler. - elpa/gnu.git Update style/simpleicons.el to package v16.29.0 - elpa/gnu.git Update NEWS.org for new preview feature - elpa/gnu.git Robustify check for escaped math switches/togglers - elpa/gnu.git Fix custom prompt with a default-value - elpa/gnu.git Fix prompt with a default-value - elpa/gnu.git Make `TeX-listify' an obsolete alias - elpa/gnu.git Fix 'syntax-propertize because of narrowing!' error - elpa/gnu.git Update style/ltx-talk.el to class v0.6.0 - elpa/gnu.git elpa/gnu.git - GNU ELPA elpa/gnu.git - GNU ELPA elpa/gnu.git - GNU ELPA elpa/gnu.git - GNU ELPA elpa/gnu.git - GNU ELPA Return context for RefTeX also for macros - elpa/gnu.git ; Fix last change - elpa/gnu.git Add in-buffer completion for citation keys - elpa/gnu.git ; Adjust Copyright years - elpa/gnu.git Improve query of the optional float placement - elpa/gnu.git Sort predefined environment hooks - elpa/gnu.git Sort predefined hooks - elpa/gnu.git Use ConTeXt Mark XL instead of LMTX - elpa/gnu.git
Allow additional properties for in-buffer completion - el...
Arash Esbati · 2026-08-06 · via elpa/gnu.git, branch externals/auctex

* latex.el (LaTeX-completion-candidates-key-val) (LaTeX-completion-candidates-completing-read-multiple) (LaTeX-completion-candidates-completing-read): Add an optional argument for additional completion properties. (LaTeX-completion-function-map-alist-crm) (LaTeX-completion-extra-props-alist): New variables. (LaTeX-completion-parse-arg): Extract additional properties and pass them to the corresponding completion candidates function. * style/cleveref.el ("cleveref"): Enable in-buffer completion for `TeX-arg-cleveref-multiple-labels'.

diff --git a/latex.el b/latex.el
index a8dd6adad44..bccc0d1ef3d 100644
--- a/latex.el
+++ b/latex.el

@@ -7775,9 +7775,11 @@ this point. If nil, limit to the previous 15 lines."

(when result

(append result (list cnt-distance)))))

-(defun LaTeX-completion-candidates-key-val (key-vals)

+(defun LaTeX-completion-candidates-key-val (key-vals &optional props)

"Return completion candidates from KEY-VALS based on buffer position.

-KEY-VALS is an alist of key-value pairs."

+KEY-VALS is an alist of key-value pairs. PROPS is a property list for

+additional information as recognized by `completion-extra-properties'

+and is appended to the return value."

(let ((end (point))

(func (lambda (kv &optional k)

(if k

@@ -7827,14 +7829,17 @@ KEY-VALS is an alist of key-value pairs."

(skip-chars-forward "^a-zA-Z0-9" end)

(setq beg (point))

;; This caters also for the case where nothing is typed yet:

- (list beg end (completion-table-dynamic

- (lambda (_)

- (funcall func key-vals)))

- :exclusive 'no)))))

+ (append (list beg end (completion-table-dynamic

+ (lambda (_)

+ (funcall func key-vals)))

+ :exclusive 'no)

+ props)))))

-(defun LaTeX-completion-candidates-completing-read-multiple (collection)

+(defun LaTeX-completion-candidates-completing-read-multiple (collection &optional props)

"Return completion candidates from COLLECTION based on buffer position.

-COLLECTION is a list of strings."

+COLLECTION is a list of strings. PROPS is a property list for

+additional information as recognized by `completion-extra-properties'

+and is appended to the return value."

(let ((end (point))

beg list-beg)

(save-excursion

@@ -7847,11 +7852,13 @@ COLLECTION is a list of strings."

(goto-char list-beg))

(skip-chars-forward "^a-zA-Z0-9\\\\" end)

(setq beg (point)))

- (list beg end collection :exclusive 'no)))

+ (append (list beg end collection :exclusive 'no) props)))

-(defun LaTeX-completion-candidates-completing-read (collection)

+(defun LaTeX-completion-candidates-completing-read (collection &optional props)

"Return completion candidates from COLLECTION based on buffer position.

-COLLECTION is a list of strings."

+COLLECTION is a list of strings. PROPS is a property list for

+additional information as recognized by `completion-extra-properties'

+and is appended to the return value."

(let ((end (point))

beg)

(save-excursion

@@ -7861,7 +7868,7 @@ COLLECTION is a list of strings."

(forward-char)

(skip-chars-forward "^a-zA-Z0-9\\\\" end)

(setq beg (point)))

- (list beg end collection :exclusive 'no)))

+ (append (list beg end collection :exclusive 'no) props)))

(defun LaTeX-completion-documentclass-usepackage (entry)

"Return completion candidates for \\usepackage and \\documentclass arguments.

@@ -8062,11 +8069,21 @@ or `LaTeX-environment-list' and returns it."

(defvar LaTeX-completion-function-map-alist-keyval nil

"Alist mapping style funcs to completion-candidates counterparts.

-Each element is a cons with the name of the function used in an

-AUCTeX style file which queries and inserts something in the

-buffer as car and a function delievering completion candidates as

-cdr. This list contains only mapping for functions which perform

-key=val completions. See also

+Each element is a cons with the name of the function used in an AUCTeX

+style file which queries and inserts something in the buffer as car and

+a function delievering completion candidates as cdr. This list contains

+only mapping for functions which perform key=val completions. See also

+`LaTeX-completion-function-map-alist-cr' or

+`LaTeX-completion-function-map-alist-crm'.")

+

+(defvar LaTeX-completion-function-map-alist-crm

+ '((TeX-arg-ref . LaTeX-completion-label-list))

+ "Alist mapping style funcs to completion-candidates counterparts.

+Each element is a cons with the name of the function used in an AUCTeX

+style file which queries and inserts something in the buffer as car and

+a function delievering completion candidates as cdr. This list contains

+only mapping for functions which perform completing-read. See also

+`LaTeX-completion-function-map-alist-keyval' or

`LaTeX-completion-function-map-alist-cr'.")

(defvar LaTeX-completion-function-map-alist-cr

@@ -8077,12 +8094,20 @@ key=val completions. See also

(concat TeX-esc (car x)))

(LaTeX-length-list)))))

"Alist mapping style funcs to completion-candidates counterparts.

-Each element is a cons with the name of the function used in an

-AUCTeX style file which queries and inserts something in the

-buffer as car and a function delievering completion candidates as

-cdr. This list contains only mapping for functions which perform

-completing-read. See also

-`LaTeX-completion-function-map-alist-keyval'.")

+Each element is a cons with the name of the function used in an AUCTeX

+style file which queries and inserts something in the buffer as car and

+a function delievering completion candidates as cdr. This list contains

+only mapping for functions which perform completing-read. See also

+`LaTeX-completion-function-map-alist-keyval' or

+`LaTeX-completion-function-map-alist-crm'.")

+

+(defvar LaTeX-completion-extra-props-alist

+ '((LaTeX-completion-label-list (:annotation-function

+ LaTeX-completion-label-annotation-function)))

+ "Alist of extra properties for in-buffer completion.

+The car of each element is a function which returns completion

+candidates. The cdr is a list of extra properties passed to

+`LaTeX-completion-candidates-*' functions.")

(defun LaTeX-completion-parse-arg (arg)

"Parse ARG and call the correct candidates completion function.

@@ -8134,11 +8159,21 @@ ARG is the entry for the current argument in buffer stored in

((assq head LaTeX-completion-function-map-alist-keyval)

(LaTeX-completion-candidates-key-val

- (funcall fun1 (cdr (assq head LaTeX-completion-function-map-alist-keyval)))))

+ (funcall fun1 (cdr (assq head LaTeX-completion-function-map-alist-keyval)))

+ (cadr (assq (cdr (assq head LaTeX-completion-function-map-alist-keyval))

+ LaTeX-completion-extra-props-alist))))

((assq head LaTeX-completion-function-map-alist-cr)

(LaTeX-completion-candidates-completing-read

- (funcall fun1 (cdr (assq head LaTeX-completion-function-map-alist-cr)))))

+ (funcall fun1 (cdr (assq head LaTeX-completion-function-map-alist-cr)))

+ (cadr (assq (cdr (assq head LaTeX-completion-function-map-alist-cr))

+ LaTeX-completion-extra-props-alist))))

+

+ ((assq head LaTeX-completion-function-map-alist-crm)

+ (LaTeX-completion-candidates-completing-read-multiple

+ (funcall fun1 (cdr (assq head LaTeX-completion-function-map-alist-crm)))

+ (cadr (assq (cdr (assq head LaTeX-completion-function-map-alist-crm))

+ LaTeX-completion-extra-props-alist))))

(t nil)))))

@@ -1,6 +1,6 @@

;;; cleveref.el --- AUCTeX style for `cleveref.sty' (v0.21.4) -*- lexical-binding: t; -*-

-;; Copyright (C) 2014--2022 Free Software Foundation, Inc.

+;; Copyright (C) 2014--2026 Free Software Foundation, Inc.

;; Author: Matthew Leach <matthew@mattleach.net>

;; Maintainer: auctex-devel@gnu.org

@@ -32,9 +32,7 @@

(require 'latex)

;; Silence the compiler:

-(declare-function font-latex-add-keywords

- "font-latex"

- (keywords class))

+(declare-function font-latex-add-keywords "font-latex" (keywords class))

(defun TeX-arg-cleveref-multiple-labels (optional &optional prompt)

"Prompt for a series of labels completing with known labels.

@@ -159,6 +157,10 @@ string."

;; Add \label[type]{label} to AUCTeX parser

(TeX-auto-add-regexp LaTeX-cleveref-label-regexp)

+ ;; Cater for in-buffer completion for the custom function

+ (add-to-list 'LaTeX-completion-function-map-alist-crm

+ '(TeX-arg-cleveref-multiple-labels . LaTeX-completion-label-list))

+

;; Tell RefTeX. Check if `reftex-label-regexps' is bound and use a

;; local version of it. Check if the regexp is already added in

;; order not to run `reftex-compile-variables' every time the style