mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-15 22:46:26 +00:00
Removed 'file:' from link description.
This commit is contained in:
parent
2a5f2004ba
commit
3752a0f01d
|
@ -68,15 +68,18 @@ location in the file")
|
||||||
"non-nil means always expand the full tree when you visit
|
"non-nil means always expand the full tree when you visit
|
||||||
`org-annotate-file-storage-file'.")
|
`org-annotate-file-storage-file'.")
|
||||||
|
|
||||||
(defun org-annotate-file-prettyfy-desc (string)
|
(defun org-annotate-file-elipsify-desc (string &optional after)
|
||||||
"Strip starting and ending whitespace and replace any chars
|
"Strip starting and ending whitespace and replace any chars
|
||||||
after the 60th with '...'"
|
that appear after the value in `after' with '...'"
|
||||||
(let ((replace-map '(("^[ \t]*" . "")
|
(let* ((after (number-to-string (or after 30)))
|
||||||
("[ \t]*$" . "")
|
(replace-map (list (cons "^[ \t]*" "")
|
||||||
("^\\(.\\{60\\}\\).*" . "\\1..."))))
|
(cons "[ \t]*$" "")
|
||||||
(dolist (replace replace-map)
|
(cons (concat "^\\(.\\{" after
|
||||||
(when (string-match (car replace) string)
|
"\\}\\).*") "\\1..."))))
|
||||||
(setq string (replace-match (cdr replace) nil nil string))))
|
(mapc (lambda (x)
|
||||||
|
(when (string-match (car x) string)
|
||||||
|
(setq string (replace-match (cdr x) nil nil string))))
|
||||||
|
replace-map)
|
||||||
string))
|
string))
|
||||||
|
|
||||||
(defun org-annotate-file ()
|
(defun org-annotate-file ()
|
||||||
|
@ -91,10 +94,10 @@ after the 60th with '...'"
|
||||||
show the relevant section"
|
show the relevant section"
|
||||||
(let* ((filename (abbreviate-file-name (or buffer (buffer-file-name))))
|
(let* ((filename (abbreviate-file-name (or buffer (buffer-file-name))))
|
||||||
(line (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
|
(line (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
|
||||||
(link (org-make-link-string (concat "file:" filename)))
|
(link (org-make-link-string (concat "file:" filename) filename))
|
||||||
(search-link (org-make-link-string
|
(search-link (org-make-link-string
|
||||||
(concat "file:" filename "::" line)
|
(concat "file:" filename "::" line)
|
||||||
(org-annotate-file-prettyfy-desc line))))
|
(org-annotate-file-elipsify-desc line))))
|
||||||
(with-current-buffer (find-file org-annotate-file-storage-file)
|
(with-current-buffer (find-file org-annotate-file-storage-file)
|
||||||
(unless (org-mode-p)
|
(unless (org-mode-p)
|
||||||
(org-mode))
|
(org-mode))
|
||||||
|
|
Loading…
Reference in a new issue