Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latex format and file link. #7

Merged
merged 2 commits into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions create-link.el
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
:type '(choice (const :tag "html" html)
(const :tag "markdown" markdown)
(other :tag "org" org)
(other :tag "media-wiki" media-wiki)))
(other :tag "media-wiki" media-wiki)
(other :tag "latex" latex)))

;; Format keywords:
;; %url% - http://www.google.com/
Expand All @@ -71,6 +72,11 @@
:group 'create-link
:type 'string)

(defcustom create-link-format-latex "\\href{%url%}{%title%}"
"Latex link format."
:group 'create-link
:type 'string)

(defun create-link-raw-format ()
"Choose a format type by the custom variable."
(pcase create-link-default-format
Expand All @@ -81,7 +87,9 @@
(`org
create-link-format-org)
(`media-wiki
create-link-format-media-wiki)))
create-link-format-media-wiki)
(`latex
create-link-format-latex)))

(defun create-link-replace-dictionary ()
"Convert format keyword to corresponding one."
Expand All @@ -107,7 +115,10 @@
((string-match-p "w3m" (buffer-name))
`((title . ,w3m-current-title)
(url . ,w3m-current-url)))
(t (message "Can't create link!"))))
;; otherwise, create-link to the file-buffer
(t
`((title . ,(buffer-name))
(url . ,(buffer-file-name))))))
Comment on lines +118 to +121
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


;;;###autoload
(defun create-link ()
Expand Down