qwan markdown works
This commit is contained in:
@@ -4,7 +4,11 @@
|
|||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
'(safe-local-variable-values
|
'(safe-local-variable-values
|
||||||
'((eval setq-local org-roam-db-location
|
'((qwan-markdown-attachment-dir
|
||||||
|
. "/Users/willem/dev/elixir/firehose/app/priv/static/images/blog/2026")
|
||||||
|
(qwan-markdown-attachment-dir
|
||||||
|
. "/Users/willem/dev/elixir/firehoseapp/priv/static/images/blog/2026")
|
||||||
|
(eval setq-local org-roam-db-location
|
||||||
(expand-file-name "org-roam.db" org-roam-directory))
|
(expand-file-name "org-roam.db" org-roam-directory))
|
||||||
(eval setq-local org-roam-directory
|
(eval setq-local org-roam-directory
|
||||||
(expand-file-name
|
(expand-file-name
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
;;; qwan/qwan-markdown-dnd.el -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
@@ -47,6 +46,7 @@ ACTION is ignored (always copies)."
|
|||||||
;; not sure what ignore action is. the copy does not actually happen
|
;; not sure what ignore action is. the copy does not actually happen
|
||||||
;; is-image is not a function (mime-type is only used for is-image)
|
;; is-image is not a function (mime-type is only used for is-image)
|
||||||
;; not sure how 'unless' works here
|
;; not sure how 'unless' works here
|
||||||
|
(message "starting drop")
|
||||||
(let* ((filename (dnd-get-local-file-name uri 'must-exist))
|
(let* ((filename (dnd-get-local-file-name uri 'must-exist))
|
||||||
(mime-type (when (fboundp 'mailcap-file-name-to-mime-type)
|
(mime-type (when (fboundp 'mailcap-file-name-to-mime-type)
|
||||||
(mailcap-file-name-to-mime-type filename)))
|
(mailcap-file-name-to-mime-type filename)))
|
||||||
@@ -56,21 +56,9 @@ ACTION is ignored (always copies)."
|
|||||||
(let* ((buffer-dir (or (when (buffer-file-name)
|
(let* ((buffer-dir (or (when (buffer-file-name)
|
||||||
(file-name-directory (buffer-file-name)))
|
(file-name-directory (buffer-file-name)))
|
||||||
default-directory))
|
default-directory))
|
||||||
(dest-dir (expand-file-name qwan-markdown-attachment-dir buffer-dir))
|
(dest-dir qwan-markdown-attachment-dir )
|
||||||
(dest-name (file-name-nondirectory filename))
|
(dest-name (file-name-nondirectory filename))
|
||||||
(dest-file (expand-file-name dest-name dest-dir)))
|
(dest-file (expand-file-name dest-name dest-dir)))
|
||||||
;; Create destination directory if needed
|
|
||||||
(unless (file-directory-p dest-dir)
|
|
||||||
(make-directory dest-dir t))
|
|
||||||
;; Handle name conflicts by appending a timestamp
|
|
||||||
(when (file-exists-p dest-file)
|
|
||||||
(message "Destination file %s already exists." dest-file)
|
|
||||||
(setq dest-file
|
|
||||||
(expand-file-name
|
|
||||||
(concat (file-name-base dest-name)
|
|
||||||
"_" (format-time-string "%Y%m%d_%H%M%S")
|
|
||||||
"." (file-name-extension dest-name))
|
|
||||||
dest-dir)))
|
|
||||||
;; Copy the file
|
;; Copy the file
|
||||||
(message "copying %s to %s." filename dest-file)
|
(message "copying %s to %s." filename dest-file)
|
||||||
(copy-file filename dest-file)
|
(copy-file filename dest-file)
|
||||||
|
|||||||
Reference in New Issue
Block a user