Add icon selection function
This commit is contained in:
parent
e56299d08c
commit
0218f7d95c
2 changed files with 63 additions and 28 deletions
|
@ -28,43 +28,75 @@
|
||||||
(with-current-buffer oldname
|
(with-current-buffer oldname
|
||||||
(delete-file newname)))
|
(delete-file newname)))
|
||||||
|
|
||||||
(defun dwpost (psubject tags icon location)
|
(defun dwsecurity ()
|
||||||
(interactive (list (read-string "Post title (REQUIRED): ")
|
|
||||||
(read-string "Tags (comma-separated): ")
|
|
||||||
(read-string "Icon: ")
|
|
||||||
(read-string "Location: " "🏠")))
|
|
||||||
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
|
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
|
||||||
(if (not security)
|
(if (not security)
|
||||||
(setq security "xpublicx"))
|
(setq security "skip"))
|
||||||
|
(if (equal security "skip")
|
||||||
|
(sleep-for 0)
|
||||||
|
(insert (concat "post-security: "
|
||||||
|
(let* ((securityjunk
|
||||||
|
(format "%S" security))
|
||||||
|
(end (- (length securityjunk) 2)))
|
||||||
|
(substring securityjunk 2 end))"\n"))))
|
||||||
|
|
||||||
|
(defun dwmood ()
|
||||||
(setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried")))
|
(setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried")))
|
||||||
(if (not mood)
|
(if (not mood)
|
||||||
(setq mood "xnonex"))
|
(setq mood "skip"))
|
||||||
(dwexport)
|
(if (equal mood "skip")
|
||||||
(kill-buffer newname)
|
(sleep-for 0)
|
||||||
(compose-mail "tobli+0397@post.dreamwidth.org" psubject)
|
|
||||||
(with-current-buffer "*unsent mail to tobli*"
|
|
||||||
(insert (concat "post-tags: org-export, "tags "\n\n"))
|
|
||||||
(insert (concat "post-security: "
|
|
||||||
(let* ((stringjunk
|
|
||||||
(format "%S" security))
|
|
||||||
(end (- (length stringjunk) 2)))
|
|
||||||
(substring stringjunk 2 end))"\n\n"))
|
|
||||||
(insert (concat "post-icon: "icon "\n\n"))
|
|
||||||
(insert (concat "post-mood: "
|
(insert (concat "post-mood: "
|
||||||
(let* ((moodjunk
|
(let* ((moodjunk
|
||||||
(format "%S" mood))
|
(format "%S" mood))
|
||||||
(end (- (length moodjunk) 2)))
|
(end (- (length moodjunk) 2)))
|
||||||
(substring moodjunk 2 end))"\n\n"))
|
(substring moodjunk 2 end))"\n"))))
|
||||||
(insert (concat "post-location: "location "\n\n"))
|
|
||||||
|
(defun dwmusic ()
|
||||||
(setq music (lastfm-user-get-recent-tracks :user "litrovers" :from 1 :to 1))
|
(setq music (lastfm-user-get-recent-tracks :user "litrovers" :from 1 :to 1))
|
||||||
(setq music (replace-regexp-in-string (regexp-quote "\" \"") " – " (format "%S" music) nil 'literal))
|
(setq music (replace-regexp-in-string (regexp-quote "\" \"") " – " (format "%S" music) nil 'literal))
|
||||||
|
(sleep-for 1)
|
||||||
|
(if (not music)
|
||||||
|
(setq music "skip"))
|
||||||
|
(if (equal music "skip")
|
||||||
|
(sleep-for 0)
|
||||||
(insert (concat "post-music: "
|
(insert (concat "post-music: "
|
||||||
(let* ((musicjunk
|
(let* ((musicjunk
|
||||||
(format "%S" music))
|
(format "%S" music))
|
||||||
(end (- (length musicjunk) 4)))
|
(end (- (length musicjunk) 4)))
|
||||||
(substring musicjunk 4 end))"\n\n"))
|
(substring musicjunk 4 end))"\n"))))
|
||||||
|
|
||||||
|
(defun dwicon (thefile)
|
||||||
|
(setq icon "skip")
|
||||||
|
(with-current-buffer thefile
|
||||||
|
(cond
|
||||||
|
((string-match-p "\\bbraska\\b" (buffer-substring (point-min) (point-max))) (setq icon "braska"))
|
||||||
|
((string-match-p "\\bffx[^-]\\b" (buffer-substring (point-min) (point-max))) (setq icon "ffx"))
|
||||||
|
((string-match-p "\\bffx-2\\b" (buffer-substring (point-min) (point-max))) (setq icon "ffx-2"))
|
||||||
|
((string-match-p "\\belp\\b" (buffer-substring (point-min) (point-max))) (setq icon "elp"))
|
||||||
|
((string-match-p "\\bprog\\b" (buffer-substring (point-min) (point-max))) (setq icon "prog"))
|
||||||
|
((string-match-p "\\btarkus\\b" (buffer-substring (point-min) (point-max))) (setq icon "tarkus"))))
|
||||||
|
(if (equal icon "skip")
|
||||||
|
(sleep-for 0)
|
||||||
|
(insert (concat "post-icon: "icon "\n"))))
|
||||||
|
|
||||||
|
(defun dwpost (psubject tags location)
|
||||||
|
(interactive (list (read-string "Post title (REQUIRED): ")
|
||||||
|
(read-string "Tags (comma-separated): ")
|
||||||
|
(read-string "Location: " "🏠")))
|
||||||
|
(dwexport)
|
||||||
|
(compose-mail "tobli+0397@post.dreamwidth.org" psubject)
|
||||||
|
(with-current-buffer "*unsent mail to tobli*"
|
||||||
|
(insert (concat "post-tags: org-export, "tags "\n"))
|
||||||
|
(insert (concat "post-location: "location "\n"))
|
||||||
|
(dwsecurity)
|
||||||
|
(dwicon newname)
|
||||||
|
(dwmood)
|
||||||
|
(dwmusic)
|
||||||
|
(insert (concat "\n"))
|
||||||
(insert-file-contents newname)
|
(insert-file-contents newname)
|
||||||
(message-send-and-exit))
|
(message-send-and-exit))
|
||||||
|
(kill-buffer newname)
|
||||||
(kill-buffer "*sent mail to tobli*")
|
(kill-buffer "*sent mail to tobli*")
|
||||||
(with-current-buffer oldname
|
(with-current-buffer oldname
|
||||||
(delete-file newname)))
|
(delete-file newname)))
|
||||||
|
|
5
init.el
5
init.el
|
@ -189,7 +189,10 @@
|
||||||
(setq calibredb-root-dir "~/Documents/drive/calibre/ebooks")
|
(setq calibredb-root-dir "~/Documents/drive/calibre/ebooks")
|
||||||
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
||||||
(setq calibredb-library-alist '(("~/Documents/drive/calibre/ebooks")
|
(setq calibredb-library-alist '(("~/Documents/drive/calibre/ebooks")
|
||||||
("~/Documents/drive/calibre/ffff"))))
|
("~/Documents/drive/calibre/ffff")
|
||||||
|
("~/Documents/drive/calibre/ovely")))
|
||||||
|
(setq calibredb-sort-by 'author)
|
||||||
|
(setq calibredb-order 'asc))
|
||||||
(use-package nov
|
(use-package nov
|
||||||
:init
|
:init
|
||||||
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
|
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue