summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2021-12-11 11:55:01 +0100
committerQuentin Aristote <quentin@aristote.fr>2021-12-11 11:55:01 +0100
commit51f9e066436b490c6be969e659155b34bb87f87d (patch)
treedfc60a0de9f88dd83aa0ce62d5591f8ac68556d1
parent260ef4efd5ac330dde21b9fef9a51458501799ba (diff)
autoload mode
-rw-r--r--README.org1
-rw-r--r--local/bibli-paris/bibli-paris.el14
-rw-r--r--packages.el3
3 files changed, 14 insertions, 4 deletions
diff --git a/README.org b/README.org
index c0502af..57fc527 100644
--- a/README.org
+++ b/README.org
@@ -39,7 +39,6 @@ The following commands are available.
| Command | Shortcut | Description |
|---------------------------------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| =bibli-paris/mode= | =SPC mb= | Enable the shortcuts described in this table. |
| =bibli-paris/import-from-csv= | =SPC mi= | Import entries from the CSV file downloaded on https://bibliotheques.paris.fr/. The first argument is the path to the CSV file, and the second and third (optional) arguments are the tags and state to set the imported entries to. |
| =bibli-paris/next-entry= | =SPC mj= | Move the cursor to and put forward the next entry. |
| =bibli-paris/previous-entry= | =SPC mk= | Move the cursor to and put forward the previous entry. |
diff --git a/local/bibli-paris/bibli-paris.el b/local/bibli-paris/bibli-paris.el
index ca00fab..10839e2 100644
--- a/local/bibli-paris/bibli-paris.el
+++ b/local/bibli-paris/bibli-paris.el
@@ -461,11 +461,13 @@ STATE (string)."
(org-show-subtree)
(recenter))
+;;;###autoload
(defun bibli-paris/previous-entry ()
"Move to and put forward the previous entry."
(interactive)
(bibli-paris/change-entry 'outline-get-last-sibling))
+;;;###autoload
(defun bibli-paris/next-entry ()
"Move to and put forward the next entry."
(interactive)
@@ -474,26 +476,31 @@ STATE (string)."
;; change the state of an entry
+;;;###autoload
(defun bibli-paris/set-to-todo ()
"Switch the entry at point to the TODO state."
(interactive)
(org-todo "TODO"))
+;;;###autoload
(defun bibli-paris/set-to-next ()
"Switch the entry at point to the NEXT state."
(interactive)
(org-todo "NEXT"))
+;;;###autoload
(defun bibli-paris/set-to-booked ()
"Switch the entry at point to the BOOKED state."
(interactive)
(org-todo "BOOKED"))
+;;;###autoload
(defun bibli-paris/set-to-done ()
"Switch the entry at point to the DONE state."
(interactive)
(org-todo "DONE"))
+
;; minor mode
;;;###autoload
@@ -501,4 +508,11 @@ STATE (string)."
"Manage reading lists of documents available in Paris' libraries."
:lighter "bibli-paris")
+(add-hook 'find-file-hook
+ (lambda ()
+ (when (and (string= (file-name-base buffer-file-name) "Bibliothèques de Paris")
+ (string-prefix-p "org" (file-name-extension buffer-file-name)))
+ (bibli-paris/mode +1))))
+
+
(provide 'bibli-paris)
diff --git a/packages.el b/packages.el
index de46234..4fce0ae 100644
--- a/packages.el
+++ b/packages.el
@@ -3,10 +3,7 @@
(defun bibli-paris/init-bibli-paris ()
(use-package bibli-paris
- ;; :defer t
:config (progn
- (spacemacs/set-leader-keys-for-major-mode 'org-mode
- "mb" 'bibli-paris/mode)
(spacemacs/declare-prefix-for-minor-mode 'bibli-paris/mode
"m" "bibli-paris")
(spacemacs/declare-prefix-for-minor-mode 'bibli-paris/mode