Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #+TITLE: Dev-Team
- * All Dev People
- #+NAME: people-tbl
- | First | Last | Team | Slack | Mail |
- |-----------+-----------+--------+------------+----------------|
- | Han | Solo | Falcon | @han | han.solo |
- | Luke | Skywalker | Jedi | @luke | luke.skywalker |
- | Darth | Vader | Sith | @darth | darth.vader |
- | Princess | Leia | Falcon | @leia | princess.leia |
- | Master | Yoda | Jedi | @yoda | master.yoda |
- | Imperator | Palpatine | Sith | @imperator | palpatine |
- * E-Mail / Calendar
- ** All people
- #+BEGIN_SRC emacs-lisp :results raw drawer :var people=people-tbl by-team=by-team email-list=email-list
- (email-list people)
- #+END_SRC
- #+RESULTS:
- :RESULTS:
- Han Solo <han.solo@example.org>, Luke Skywalker <luke.skywalker@example.org>, Darth Vader <darth.vader@example.org>, Princess Leia <princess.leia@example.org>, Master Yoda <master.yoda@example.org>, Imperator Palpatine <palpatine@example.org>
- :END:
- ** All people filtered by a team
- #+BEGIN_SRC emacs-lisp :results raw drawer :var people=people-tbl by-team=by-team email-list=email-list
- (email-list (by-team 'Jedi people))
- #+END_SRC
- #+RESULTS:
- :RESULTS:
- Luke Skywalker <luke.skywalker@example.org>, Master Yoda <master.yoda@example.org>
- :END:
- * Slack
- ** All people
- #+BEGIN_SRC emacs-lisp :results raw drawer :var people=people-tbl by-team=by-team slack-list=slack-list
- (slack-list people)
- #+END_SRC
- #+RESULTS:
- :RESULTS:
- @han, @luke, @darth, @leia, @yoda, @imperator
- :END:
- ** All people filtered by a team
- #+BEGIN_SRC emacs-lisp :results raw drawer :var people=people-tbl by-team=by-team slack-list=slack-list
- (slack-list (by-team 'Jedi people))
- #+END_SRC
- #+RESULTS:
- :RESULTS:
- @luke, @yoda
- :END:
- * Helper functions
- Filter the table by team
- #+NAME: by-team
- #+BEGIN_SRC emacs-lisp :tangle no
- (defun by-team (team people)
- (seq-filter (lambda (x) (string-equal (nth 2 x) team)) people)
- )
- #+END_SRC
- Format the names as email or calendar receipients
- #+NAME: email-list
- #+BEGIN_SRC emacs-lisp
- (defun email-list (people)
- (let* (
- (output-fmt "%s %s <%s@example.org>")
- (format-members (lambda (x)
- (format output-fmt (nth 0 x) (nth 1 x) (nth 4 x))
- ))
- (formatted (mapcar format-members people)))
- (mapconcat 'identity formatted ", ")
- )
- )
- #+END_SRC
- Format the names as slack mentions
- #+NAME: slack-list
- #+BEGIN_SRC emacs-lisp
- (defun slack-list (people)
- (let* (
- (format-members (lambda (x)
- (format "%s" (nth 3 x))
- ))
- (formatted (mapcar format-members people)))
- (mapconcat 'identity formatted ", ")
- )
- )
- #+END_SRC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement