From fed367f31e61f16a6e952630f332d5121c43b904 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 2 Nov 2023 00:10:17 +1100 Subject: [emacs] Add google-docs-odt and fix my-lem-org --- emacs/.emacs.d/init/ycp-web.el | 6 ++++++ emacs/.emacs.d/lisp/my/lem-org.el | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'emacs') diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el index f6da859..d672c3a 100644 --- a/emacs/.emacs.d/init/ycp-web.el +++ b/emacs/.emacs.d/init/ycp-web.el @@ -128,6 +128,12 @@ :description "duckduckgo result transform." :match (concat url-rw-www-re (rx "duckduckgo.com/l/?uddg=")) :actions ((replace-by-redirect "uddg"))) + (:name google-docs-odt + :description "Download Google docs document as odt." + :match (concat url-rw-www-re (rx "docs.google.com/document/d/")) + :actions ((replace-path-regexp "\\(/document/d/.*?\\)/.*" + "\\1/export") + (put-query "format" "odt"))) (:name google-to-ddg :description "Google search to duckduckgo html." :match (concat url-rw-www-re (rx "google.com/search?q=")) diff --git a/emacs/.emacs.d/lisp/my/lem-org.el b/emacs/.emacs.d/lisp/my/lem-org.el index 37a7bfb..67e4e54 100644 --- a/emacs/.emacs.d/lisp/my/lem-org.el +++ b/emacs/.emacs.d/lisp/my/lem-org.el @@ -51,9 +51,9 @@ (when-let ((host-and-id (lem-org-parse-post-url url))) ;; The (local) binding of `lem-instance-url' and `lem-api-version' ;; are required by `lem-get-post' and `lem-api-get-post-comments'. - (let ((lem-instance-url (car host-and-id)) - (lem-api-version "v3") - (post-id (cdr host-and-id))) + (let ((post-id (cdr host-and-id))) + (setq lem-instance-url (car host-and-id) + lem-api-version "v3") (cons `(post . ,(lem-get-post post-id)) (lem-api-get-post-comments post-id "All" nil 50))))) @@ -164,7 +164,8 @@ those at the top level." (with-current-buffer (get-buffer-create "*lem-org*") (erase-buffer) (insert post "\n\n" comments) - (goto-char (point-min))) + (goto-char (point-min)) + (org-mode)) (display-buffer "*lem-org*"))) (provide 'lem-org) -- cgit v1.2.3