diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs.d/init/ycp-gnus.el | 10 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-hnreader.el | 25 |
2 files changed, 26 insertions, 9 deletions
diff --git a/emacs/.emacs.d/init/ycp-gnus.el b/emacs/.emacs.d/init/ycp-gnus.el index 43d56cc..13700e5 100644 --- a/emacs/.emacs.d/init/ycp-gnus.el +++ b/emacs/.emacs.d/init/ycp-gnus.el @@ -59,7 +59,8 @@ (require 'my-gnus) (my-keybind message-mode-map "M-n" #'my-message-after-next-cited - "M-p" #'my-message-before-previous-cited) + "M-p" #'my-message-before-previous-cited + "C-c M-e" #'my-message-elide-remaining) ) (my-package smtpmail @@ -151,9 +152,12 @@ "q" #'my-gnus-summary-exit-like-mu4e "M-u" nil "M-&" nil - "m" #'my-gnus-move-article-like-mu4e - "r" #'my-gnus-archive-article-like-mu4e + "M" #'my-gnus-move-article-like-mu4e + "a" #'my-gnus-archive-article-like-mu4e + "c" #'org-capture + "m" #'gnus-summary-post-news "d" #'my-gnus-trash-article-like-mu4e + "r" #'gnus-article-reply-with-original "." #'gnus-summary-show-raw-article) (setq gnus-sum-thread-tree-root "" gnus-sum-thread-tree-single-leaf "└>" diff --git a/emacs/.emacs.d/lisp/my/my-hnreader.el b/emacs/.emacs.d/lisp/my/my-hnreader.el index 761fad6..9f31200 100644 --- a/emacs/.emacs.d/lisp/my/my-hnreader.el +++ b/emacs/.emacs.d/lisp/my/my-hnreader.el @@ -80,11 +80,12 @@ (let ((comments (dom-by-class dom "^athing comtr$")) (title (hnreader--get-title dom)) (info (hnreader--get-post-info dom)) - (more-link (dom-by-class dom "morelink"))) - (with-current-buffer (hnreader--get-hn-comment-buffer) + (more-link (dom-by-class dom "morelink")) + (buffer (my-hnreader-buffer url))) + (with-current-buffer buffer (read-only-mode -1) (erase-buffer) - (insert "-*-Org-*-\n") + (insert "-*- org -*-\n") (insert "#+TITLE: " (car title)) (insert (format "\n%s\n" (cdr title))) (insert (car info)) @@ -101,10 +102,22 @@ (insert "\n* " (format "[[elisp:(hnreader-comment \"%s\")][More]]" (concat "https://news.ycombinator.com/" (dom-attr more-link 'href))))) (insert "\n* " (format "[[elisp:(hnreader-comment \"%s\")][Reload]]" url)) - (org-mode) - ;; (org-shifttab 3) (goto-char (point-min)) - (forward-line 2)))) + (forward-line 2) + (save-buffer)) + (switch-to-buffer buffer))) + +(defvar my-hnreader-save-dir (locate-user-emacs-file "hn-archive") + "The directory to save hnreader org files.") + +(defun my-hnreader-buffer (url) + "Return file name to save to for URL." + (if (string-match + "https://news\\.ycombinator\\.com/item\\?id=\\([0-9]+\\)" url) + (find-file-noselect + (expand-file-name (format "%s.org" (match-string 1 url)) + my-hnreader-save-dir)) + (error "URL %s not supported." url))) (provide 'my-hnreader) ;;; my-hnreader.el ends here |