Skip to content

Commit

Permalink
Merge pull request Emacs-SF#22 from jefftrull/master
Browse files Browse the repository at this point in the history
Notes cleanup (esp 2021)
  • Loading branch information
jefftrull authored Jun 10, 2024
2 parents 9a3e61b + 3adeb20 commit abca632
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 15 deletions.
16 changes: 2 additions & 14 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,9 @@ https://github.com/Emacs-SF/meetup-notes/blob/master/README.org
- [[http://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2024/20240222.org][2/22 meeting notes]]
**** 2024-01-25 Emacs Lisp Hacking Night
- [[http://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2024/20240125.org][1/25 meeting notes]]
**** 2021-07-01 online foss.org, "Emacs Lisp: Macros and Quoting"
- [[http://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2021/20210701.org][7/1 meeting notes]]
**** 2021-05-27 online foss.org, "Emacs Lisp: Cracking Open compilation-mode"
- [[http://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2021/20210527.org][5/27 meeting notes]]
**** 2021-04-29 online fosshost.org, "Emacs Lisp: Foundational Utility Packages"
- [[https://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2021/20210429.org][4/29 meeting notes]]
**** 2021-03-05 online fosshost.org, "Emacs Lisp and menu packages: dmenu, hydra, posframe, transient, etc."
- [[https://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2021/20210305.org][3/5 meeting notes]]
**** 2021-02-12 jitsi.org, topics: Org-roam, org-roam, Emacs
- [[file:meetups/2021/20210212.org][2/12 meeting notes]]
**** 2021-01-27 jitsi.org, topics: Emacs completion packages, Emacs
- [[file:meetups/2021/20210127.org][1/27 meeting notes]]
**** 2021-01-09 jitsi.org, topics: Online Hangout VI: org-mode GTD focus
- [[file:meetups/2021/20210109.org][1/9 meeting notes]]

*** Prior year archives (reverse chronological order)
- [[file:meetups/2021/index.org][2021]]
- [[file:meetups/2020/index.org][2020]]
- [[file:meetups/2019/index.org][2019]]
- [[file:meetups/2018/index.org][2018]]
Expand Down
140 changes: 140 additions & 0 deletions meetups/2021/20210916.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#+TITLE: Emacs Lisp: Org-mode Hacks
#+OPTIONS: TOC:nil
#+LATEX_CLASS_OPTIONS: [svgnames]
#+LATEX_HEADER: \usepackage{pagecolor}
#+LATEX_HEADER: \pagecolor{black}
#+LATEX_HEADER: \color{white}

* Introduction
- Still behind on the videos
- doing our best, sorry for the delay
- Looking for speakers and topics
- put ideas in wiki at https://github.com/Emacs-SF/meetup-notes/wiki/Backlog
- Do we have any lightning talks (or discussion topics)?
- I'm counting on you!

* Jeff Trull: Clock Tables to Invoices
** Macros
*** Defining
**** Inline

#+MACRO: TODAY (eval (format-time-string "%A %B %e, %Y"))

The "(eval" is a signal to the exporter that the rest is Elisp.

Now we can say that today is {{{TODAY}}}

**** Via Elisp

You can also add it to `org-export-global-macros`:
#+begin_src elisp
(push (cons 'TODAY "(eval (format-time-string \"%A %B %e, %Y\"))")
org-export-global-macros)
;; note the value is a string!
#+end_src

**** Making It Cleaner

Macro definitions are strings and can get really long

#+begin_src elisp
(defmacro jet/make-org-macro (name form)
"Create macro name/string pair suitable for supplying to org-export-global-macros"
`(cons ,name ,(concat "(eval " (prin1-to-string form) ")")))

(push (jet/make-org-macro
'TOMORROW
(format-time-string "%A %B %e, %Y"
(encode-time
(decoded-time-add (decode-time)
(make-decoded-time :day 1)))))
org-export-global-macros)
#+end_src

Tomorrow is {{{TOMORROW}}}.

*** Usage Restrictions

From the manual:

#+begin_quote
Org recognizes macro references in following Org markup areas: paragraphs,
headlines, verse blocks, tables cells and lists. Org also recognizes macro
references in keywords, such as ‘CAPTION’, ‘TITLE’, ‘AUTHOR’, ‘DATE’, and
for /some back-end specific export options/.
#+end_quote

- This seems to mean they are only usable for text substitution
and not for, e.g. changing the behavior of the exporting process.

- Order of evaluation w.r.t. elisp source blocks is unclear
- The reference for this kind of thing appears to be the code itself

** Dynamic Blocks
A way to run arbitrary Elisp from org, supplying parameters

#+begin_src elisp :results output silent
(defun org-dblock-write:emacssf-fancy (params)
(insert
;; bold and gold *both* in the buffer and in the export
"@@latex:{\\color{Gold}\\textbf @@"
(propertize (plist-get params :text)
'font-lock-face ;; NOT "face" here
'(:foreground "gold" :weight 'bold))
"@@latex:}@@"))
#+end_src

# Oro en Paz, Fierro en Guerra
#+BEGIN: emacssf-fancy :text "San Francisco"
#+END:

*** Examples
- Column View
- Clock Tables

** Clock Tables
*** Intro
- A summary of information from clock entries
- in table form

*** Demo

*** Elisp hooks
**** :scope
- A mechanism for specifying what files or parts of files to use
- Normally things like "this file", "this heading", etc.
- Can instead supply a function returning a list of files
- ~buffer-file-name~ will give us same result as =file=
**** :formula
- table formulas to apply after the clock table is created
- Round time values to nearest 5 minutes
- Calculate subtotals
**** :formatter
- supply your own Elisp to produce the table
- typically used to postprocess the default result

** Other Invoicing flows
After the meeting I was made aware of some other work in this area:
- [[https://news.ycombinator.com/item?id=19146032][one from Hacker News]]
- [[https://list.orgmode.org/[email protected]/T/][one from the emacs-orgmode mailing list]]
- [[https://www.adventuresinwhy.com/post/org-mode-timekeeping/][one pointed out to me by an org-mode maintainer]]

* Clock Tables to CSV to Spreadsheet (Brian Wood)

* OrgMark and org-capture via HammerSpoon (Sean Farley)
** OrgMark
- quick demo using a separate iPad with the orgmark app
** org-capture
- demonstrates launching Emacs from a browser with a link to add to reading list
- This is done with the help of [[http://www.hammerspoon.org/][Hammerspoon]] (Mac only)
- see also [[https://xenodium.com/emacs-utilities-for-your-os/][Álvaro Ramírez]] on a related subject
- Howard Abrams discusses capturing for both Mac and Linux desktops [[https://howardism.org/Technical/Emacs/capturing-content.html][here]]
- org-protocol
- e.g. roam-ref, capture-html
- documented [[https://orgmode.org/manual/Protocols.html][here]]
- Emacsclient understands them as commnad-line args when preceeded with =org-protocol://=
- Doom comes with a bunch of capture templates
- [[https://github.com/seanfarley/dotfiles/blob/main/.config/hammerspoon/emacs.lua][Sean's Hammerspoon config]]
- Cameron Desautels notes [[https://github.com/alphapapa/org-protocol-capture-html][alphapapa's org-protocol-capture-html]] which Sean uses


4 changes: 4 additions & 0 deletions meetups/2021/index.org
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

** Past (reverse chronological order)

*** 2021-09-16 online
**** title: Emacs Lisp: Org-Mode Hacks
**** [[https://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2021/20210916.org][9/16 meeting notes]]

*** 2021-07-01 Thursday online
**** title: Emacs Lisp: Macros and Quoting
**** [[https://github.com/Emacs-SF/meetup-notes/blob/master/meetups/2021/20210701.org][7/1 meeting notes]]
Expand Down
20 changes: 19 additions & 1 deletion meetups/2024/20240328.org
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,23 @@
- System Crafters, [[https://www.youtube.com/watch?v=O6hMwJfaXV8][Code Dive: Project.el in in Emacs]]. Goes into how it works at the ELisp level.
- LCOLONQ, on [[https://www.twitch.tv/lcolonq][Twitch]] Tuesdays and Fridays, I don't know what coffee he is drinking but it's strong. Fun.

* Previous Meetup on the same Subject
See [[../2021/20210916.org][Org-mode Hacks (2021)]]

* Presentations
** Charles Choi: Running SQL on org tables
http://yummymelon.com/presentations/org-sql-tables/org-sql-table.html
- [[http://yummymelon.com/presentations/org-sql-tables/org-sql-table.html][Slides]]
*** Discussion
- Someone mentioned [[https://github.com/stuartsierra/org-mode/blob/master/contrib/lisp/orgtbl-sqlinsert.el][orgtbl-to-sqlinsert]] as an alternative
- There's also Jonas Bernoulli's [[https://github.com/magit/emacsql][emacsql]]
*** References
- [[http://yummymelon.com/devnull/running-sql-queries-on-org-tables.html][nfdn: Running SQL Queries on Org Tables]]
- [[https://gist.github.com/kickingvegas/00312e090acb57ed5f2e9a8e13f0d696][cc/org-table-to-sqlite]]
- [[https://orgmode.org/manual/Evaluating-Code-Blocks.html][Evaluating Code Blocks (The Org Manual)]]
- [[https://orgmode.org/manual/Library-of-Babel.html][Library of Babel (The Org Manual)]]
- [[https://orgmode.org/manual/Noweb-Reference-Syntax.html][Noweb Reference Syntax (The Org Manual)]]


** Jeff Trull: org-mode exporters
# memo to self: C-x n s org-narrow-to-subtree
*** Learning
Expand Down Expand Up @@ -55,6 +69,10 @@ of one particular exporter and note some interesting parts.

- run ~~ in an org buffer to see AST
- very helpful for understanding exporter behavior
*** Discussion
- Charles: there is a [[https://github.com/titaniumbones/ox-slack/blob/master/ox-slack.el][Slack exporter]] based on =ox-gfm=, would be nice to insert the result into Slack window
- Radon suggests the [[https://github.com/alpha22jp/atomic-chrome][Emacs fork of Atomic Chrome]] for this purpose

** Jeff Trull: an exporter for Keynote
*** Motivation
- Beamer output viewed as unprofessional (at least with the themes I chose)
Expand Down

0 comments on commit abca632

Please sign in to comment.