Fix some stuff
This commit is contained in:
parent
9ae0d7a93f
commit
267f209037
@ -279,10 +279,11 @@ A marker file is a file that signifies that its parent is a texdoc entry."
|
|||||||
(cl-loop for root in latex-help-documentation-roots
|
(cl-loop for root in latex-help-documentation-roots
|
||||||
append (latex-help--search-texdoc-root root)))
|
append (latex-help--search-texdoc-root root)))
|
||||||
|
|
||||||
(defun latex-help--list-texdoc-files-for-entry (entry)
|
(defun latex-help--texdoc-files-for-entry (entry)
|
||||||
"List the texdoc files for ENTRY.
|
"List the texdoc files for ENTRY.
|
||||||
ENTRY is of the form (name . dir). This returns a list of conses of the display
|
ENTRY is of the form (name . dir). This returns a list of conses of the display
|
||||||
name of the entry and the file it belongs to."
|
name of the entry and the file it belongs to. The first item the the returned
|
||||||
|
list is the default value when prompting with `completing-read'."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(when-let ((exit-code (call-process latex-help-texdoc-program nil t
|
(when-let ((exit-code (call-process latex-help-texdoc-program nil t
|
||||||
nil "-Ml" (car entry)))
|
nil "-Ml" (car entry)))
|
||||||
@ -309,10 +310,12 @@ name of the entry and the file it belongs to."
|
|||||||
(group (* any))))
|
(group (* any))))
|
||||||
nil t)
|
nil t)
|
||||||
(let* ((file (match-string 1))
|
(let* ((file (match-string 1))
|
||||||
|
(relname (file-relative-name (match-string 1)
|
||||||
|
(cdr entry)))
|
||||||
(desc (match-string 2))
|
(desc (match-string 2))
|
||||||
(prompt (if (zerop (length desc))
|
(prompt (if (zerop (length desc))
|
||||||
file
|
relname
|
||||||
(format "%s - %s" desc file))))
|
(format "%s (%s)" desc relname))))
|
||||||
;; check if the file is actually belongs to this entry
|
;; check if the file is actually belongs to this entry
|
||||||
(when (string-prefix-p (cdr entry) file)
|
(when (string-prefix-p (cdr entry) file)
|
||||||
(push (cons prompt file) found))))
|
(push (cons prompt file) found))))
|
||||||
@ -321,11 +324,12 @@ name of the entry and the file it belongs to."
|
|||||||
(defun latex-help--texdoc-prompt-for-entry-file (entry)
|
(defun latex-help--texdoc-prompt-for-entry-file (entry)
|
||||||
"Prompt the user to open a texdoc file from ENTRY.
|
"Prompt the user to open a texdoc file from ENTRY.
|
||||||
This will return nil if the user does not want to open the file."
|
This will return nil if the user does not want to open the file."
|
||||||
(let ((entries (latex-help--list-texdoc-files-for-entry entry)))
|
(let ((entries (latex-help--texdoc-files-for-entry entry)))
|
||||||
(if (length= entries 1)
|
(if (length= entries 1)
|
||||||
(and (y-or-n-p (format "Open texdoc \"%s\"?" (caar entry)))
|
(and (y-or-n-p (format "Open texdoc \"%s\"?" (caar entries)))
|
||||||
(cdar entry))
|
(cdar entries))
|
||||||
(let ((ans (completing-read "Texdoc File: " (mapcar 'car entries) nil t)))
|
(let ((ans (completing-read "Texdoc File: " (mapcar 'car entries) nil t
|
||||||
|
nil nil (caar entries))))
|
||||||
(unless (zerop (length ans))
|
(unless (zerop (length ans))
|
||||||
(cdr (assoc ans entries)))))))
|
(cdr (assoc ans entries)))))))
|
||||||
|
|
||||||
@ -525,16 +529,18 @@ in the texdoc cache."
|
|||||||
INFO-ENTRY is an entry from one of the info caches. TEXDOC-ENTRY is an entry
|
INFO-ENTRY is an entry from one of the info caches. TEXDOC-ENTRY is an entry
|
||||||
from the texdoc cache."
|
from the texdoc cache."
|
||||||
(let* ((texdoc-files (and texdoc-entry
|
(let* ((texdoc-files (and texdoc-entry
|
||||||
(latex-help--list-texdoc-files-for-entry
|
(latex-help--texdoc-files-for-entry
|
||||||
texdoc-entry)))
|
texdoc-entry)))
|
||||||
(prompts (nconc (mapcar (lambda (node)
|
(prompts (nconc (mapcar (lambda (file)
|
||||||
(concat "(Info) " (car node)))
|
|
||||||
(cdr info-entry))
|
|
||||||
(mapcar (lambda (file)
|
|
||||||
(concat "(Texdoc) " (car file)))
|
(concat "(Texdoc) " (car file)))
|
||||||
texdoc-files))))
|
texdoc-files)
|
||||||
|
(mapcar (lambda (node)
|
||||||
|
(concat "(Info) " (car node)))
|
||||||
|
(cdr info-entry)))))
|
||||||
(when prompts
|
(when prompts
|
||||||
(let ((selected (completing-read "LaTeX Help: " prompts nil t)))
|
(let ((selected (completing-read "LaTeX Help: " prompts nil t nil
|
||||||
|
nil (when texdoc-files
|
||||||
|
(car prompts)))))
|
||||||
(when (string-match (rx bos "(" (group (+ (any (?a . ?z))
|
(when (string-match (rx bos "(" (group (+ (any (?a . ?z))
|
||||||
(any (?A . ?Z))))
|
(any (?A . ?Z))))
|
||||||
") " (group (* any)))
|
") " (group (* any)))
|
||||||
|
2
init.el
2
init.el
@ -766,6 +766,8 @@ to `posframe-show' if the display is graphical."
|
|||||||
(use-package consult-flycheck
|
(use-package consult-flycheck
|
||||||
:defer nil
|
:defer nil
|
||||||
:bind (:map flycheck-mode-map
|
:bind (:map flycheck-mode-map
|
||||||
|
("C-c C-e" . consult-flycheck)
|
||||||
|
:map emacs-lisp-mode-map
|
||||||
("C-c C-e" . consult-flycheck)))
|
("C-c C-e" . consult-flycheck)))
|
||||||
|
|
||||||
;; eldoc
|
;; eldoc
|
||||||
|
Loading…
Reference in New Issue
Block a user