summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Vivier <zaeph@zaeph.net>2022-09-21 23:16:34 +0200
committerLeo Vivier <zaeph@zaeph.net>2022-09-21 23:16:40 +0200
commitc64153a6a1583db7dceec902acf6d16e6305ef81 (patch)
tree1f58ec02c283c8a4b2b51e5fca443313304687c1
parent17ca2c4fb44096e509714e4edd0a56797d18e530 (diff)
downloademacsconf-wiki-c64153a6a1583db7dceec902acf6d16e6305ef81.tar.xz
emacsconf-wiki-c64153a6a1583db7dceec902acf6d16e6305ef81.zip
Move code away from the top of the file
Diffstat (limited to '')
-rw-r--r--2022/organizers-notebook.org207
1 files changed, 106 insertions, 101 deletions
diff --git a/2022/organizers-notebook.org b/2022/organizers-notebook.org
index 316f3966..b6395efe 100644
--- a/2022/organizers-notebook.org
+++ b/2022/organizers-notebook.org
@@ -9,7 +9,8 @@
#+TOC: headlines 4
* Working with this file :noexport:
-You can open the following links (~C-c C-o~ or ~<mouse-1>~) to run the associated actions:
+You can open the following links (~C-c C-o~ or ~<mouse-1>~) to run the
+associated actions:
General:
- [[elisp:(org-babel-ref-resolve "general-setup()")][General setup]] (to get the main function definitions)
@@ -22,107 +23,10 @@ Export:
- [[elisp:(emacsconf-org-publish-this-page)][Export, tangle, commit, push]]
- [[elisp:(org-babel-ref-resolve "md-export-on-save-toggle-on()")][Export on save]]
- [[elisp:(org-babel-ref-resolve "md-export-on-save-toggle-off()")][Stop exporting on save]]
-
-** Code
-*** General
-#+name: general-setup
-#+begin_src emacs-lisp :eval query
-(defvar emacsconf-danger-allow-dangerous-stuff nil
- "When non-nil, trade safety for convenience.")
-
-(defvar emacsconf-danger-asked nil
- "When non-nil, user has already been asked for security trade-off.")
-
-(defun emacsconf-danger--ask (forms)
- "Ask to run dangerous FORMS.
-Return t if the answer is “yes”."
- (when (y-or-n-p (format "FORMS:\n%s\n\nThis is dangerous. Run anyway? "
- (prin1-to-string forms)))
- (unless emacsconf-danger-asked
- (if (y-or-n-p "Would you like to trade security for convenience for the rest of the session? ")
- (setq-local emacsconf-danger-allow-dangerous-stuff t)
- (setq-local emacsconf-danger-asked t)))
- t))
-
-(defmacro emacsconf-danger--shield (error &rest forms)
- "Protect user from dangerous FORMS.
-Throw an error if ERROR is non-nil, skip otherwise."
- `(let ((shield (not (or emacsconf-danger-allow-dangerous-stuff
- (emacsconf-danger--ask ',@forms)))))
- (if shield
- ,(when error
- '(user-error "Dangerous action cancelled by user"))
- ,@forms)))
-
-(defmacro emacsconf-danger-shield (&rest forms)
- "Protect user from dangerous FORMS by throwing an ERROR."
- `(emacsconf-danger--shield t ,@forms))
-
-(defmacro emacsconf-danger-skip (&rest forms)
- "Protect user from dangerous FORMS by skipping them."
- `(emacsconf-danger--shield nil ,@forms))
-
-(message "General setup has been loaded")
-#+end_src
-
-#+name: elisp-no-confirmation
-#+begin_src emacs-lisp
-(emacsconf-danger-shield
- (setq-local org-confirm-babel-evaluate nil
- org-confirm-elisp-link-function nil))
-(message "No longer asking for confirmation in this buffer")
-#+end_src
-
-#+name: i-like-danger
-#+begin_src emacs-lisp
-(setq-local emacsconf-danger-allow-dangerous-stuff t)
-(org-babel-ref-resolve "elisp-no-confirmation()")
-
-(message "Now allowing dangerous stuff. Buckle up, buckaroo!")
-#+end_src
-
-#+name: back-to-safety
-#+begin_src emacs-lisp
-(kill-local-variable 'emacsconf-danger-allow-dangerous-stuff)
-(kill-local-variable 'emacsconf-danger-asked)
-(kill-local-variable 'org-confirm-babel-evaluate)
-(kill-local-variable 'org-confirm-elisp-link-function)
-
-(message "Back to safety. Phew!")
-#+end_src
-
-*** Export
-#+name: md-export-on-save-setup
-#+begin_src emacs-lisp :eval query
-(defun emacsconf-export-md-on-save ()
- "Export markdown on save.
-Meant to be used with `after-save-hook'."
- (org-md-export-to-markdown)
- (org-babel-tangle))
-
-(defvar emacsconf-export-md-on-save-configured t
- "Non-nil when the setup code-block has been executed.")
-#+end_src
-
-#+name: md-export-on-save-toggle-on
-#+begin_src emacs-lisp :eval query
-(unless (bound-and-true-p emacsconf-export-md-on-save-configured)
- (org-babel-ref-resolve "md-export-on-save-setup()"))
-
-(add-hook 'after-save-hook #'emacsconf-export-md-on-save nil t)
-
-(when (memq #'emacsconf-export-md-on-save after-save-hook)
- (message "Hook is active"))
-#+end_src
-
-#+name: md-export-on-save-toggle-off
-#+begin_src emacs-lisp :eval query :outputs none
-(remove-hook 'after-save-hook #'emacsconf-export-md-on-save t)
-
-(unless (memq #'emacsconf-export-md-on-save after-save-hook)
- (message "Hook is no longer active"))
-#+end_src
+You can use ~C-c /~ (~org-sparse-tree~) to filter this for TODOs,
+or ~C-c \~ (~org-match-sparse-tree~) to see anything tagged with your tag.
+~org-agenda~ with ~<~ for the file restriction may also be handy.
* Current tasks / status
:PROPERTIES:
@@ -1462,6 +1366,74 @@ emacsconf-discuss list, so as to help avoid generating extra off-topic
chatter in the other lists Cc'd on this message. Thank you.
* Supporting code
+** General
+#+name: general-setup
+#+begin_src emacs-lisp :eval query
+(defvar emacsconf-danger-allow-dangerous-stuff nil
+ "When non-nil, trade safety for convenience.")
+
+(defvar emacsconf-danger-asked nil
+ "When non-nil, user has already been asked for security trade-off.")
+
+(defun emacsconf-danger--ask (forms)
+ "Ask to run dangerous FORMS.
+Return t if the answer is “yes”."
+ (when (y-or-n-p (format "FORMS:\n%s\n\nThis is dangerous. Run anyway? "
+ (prin1-to-string forms)))
+ (unless emacsconf-danger-asked
+ (if (y-or-n-p "Would you like to trade security for convenience for the rest of the session? ")
+ (setq-local emacsconf-danger-allow-dangerous-stuff t)
+ (setq-local emacsconf-danger-asked t)))
+ t))
+
+(defmacro emacsconf-danger--shield (error &rest forms)
+ "Protect user from dangerous FORMS.
+Throw an error if ERROR is non-nil, skip otherwise."
+ `(let ((shield (not (or emacsconf-danger-allow-dangerous-stuff
+ (emacsconf-danger--ask ',@forms)))))
+ (if shield
+ ,(when error
+ '(user-error "Dangerous action cancelled by user"))
+ ,@forms)))
+
+(defmacro emacsconf-danger-shield (&rest forms)
+ "Protect user from dangerous FORMS by throwing an ERROR."
+ `(emacsconf-danger--shield t ,@forms))
+
+(defmacro emacsconf-danger-skip (&rest forms)
+ "Protect user from dangerous FORMS by skipping them."
+ `(emacsconf-danger--shield nil ,@forms))
+
+(message "General setup has been loaded")
+#+end_src
+
+#+name: elisp-no-confirmation
+#+begin_src emacs-lisp
+(emacsconf-danger-shield
+ (setq-local org-confirm-babel-evaluate nil
+ org-confirm-elisp-link-function nil))
+(message "No longer asking for confirmation in this buffer")
+#+end_src
+
+#+name: i-like-danger
+#+begin_src emacs-lisp
+(setq-local emacsconf-danger-allow-dangerous-stuff t)
+
+(org-babel-ref-resolve "elisp-no-confirmation()")
+
+(message "Now allowing dangerous stuff. Buckle up, buckaroo!")
+#+end_src
+
+#+name: back-to-safety
+#+begin_src emacs-lisp
+(kill-local-variable 'emacsconf-danger-allow-dangerous-stuff)
+(kill-local-variable 'emacsconf-danger-asked)
+(kill-local-variable 'org-confirm-babel-evaluate)
+(kill-local-variable 'org-confirm-elisp-link-function)
+
+(message "Back to safety. Phew!")
+#+end_src
+
** Publish this page
#+begin_src emacs-lisp
(defun emacsconf-org-publish-this-page ()
@@ -1473,6 +1445,39 @@ chatter in the other lists Cc'd on this message. Thank you.
(call-interactively #'magit-push-current-to-pushremote))
#+end_src
+*** Export to markdown
+
+#+name: md-export-on-save-setup
+#+begin_src emacs-lisp :eval query
+(defun emacsconf-export-md-on-save ()
+ "Export markdown on save.
+Meant to be used with `after-save-hook'."
+ (org-md-export-to-markdown)
+ (org-babel-tangle))
+
+(defvar emacsconf-export-md-on-save-configured t
+ "Non-nil when the setup code-block has been executed.")
+#+end_src
+
+#+name: md-export-on-save-toggle-on
+#+begin_src emacs-lisp :eval query
+(unless (bound-and-true-p emacsconf-export-md-on-save-configured)
+ (org-babel-ref-resolve "md-export-on-save-setup()"))
+
+(add-hook 'after-save-hook #'emacsconf-export-md-on-save nil t)
+
+(when (memq #'emacsconf-export-md-on-save after-save-hook)
+ (message "Hook is active"))
+#+end_src
+
+#+name: md-export-on-save-toggle-off
+#+begin_src emacs-lisp :eval query :outputs none
+(remove-hook 'after-save-hook #'emacsconf-export-md-on-save t)
+
+(unless (memq #'emacsconf-export-md-on-save after-save-hook)
+ (message "Hook is no longer active"))
+#+end_src
+
** Tangle and publish on save
#+name: md-export-on-save-setup
#+begin_src emacs-lisp :eval query