diff options
author | Yuchen Pei <id@ypei.org> | 2023-11-02 00:10:17 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-11-02 00:10:17 +1100 |
commit | fed367f31e61f16a6e952630f332d5121c43b904 (patch) | |
tree | a6b52d7bbf5e627e7f3bb7f8b5eb1ab506a3317d | |
parent | 94643dfd001fa66319d857fa260d15e543ea9f5d (diff) |
[emacs] Add google-docs-odt and fix my-lem-org
-rw-r--r-- | emacs/.emacs.d/init/ycp-web.el | 6 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/lem-org.el | 9 |
2 files changed, 11 insertions, 4 deletions
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) |