(let* ((tmp-src-file (org-babel-temp-file
"C-src-"
(pcase org-babel-c-variant
- ('c ".c") ('cpp ".cpp") ('d ".d"))))
+ (`c ".c") (`cpp ".cpp") (`d ".d"))))
(tmp-bin-file ;not used for D
(org-babel-process-file-name
(org-babel-temp-file "C-bin-" org-babel-exeext)))
" "))
(full-body
(pcase org-babel-c-variant
- ('c (org-babel-C-expand-C body params))
- ('cpp (org-babel-C-expand-C++ body params))
- ('d (org-babel-C-expand-D body params)))))
+ (`c (org-babel-C-expand-C body params))
+ (`cpp (org-babel-C-expand-C++ body params))
+ (`d (org-babel-C-expand-D body params)))))
(with-temp-file tmp-src-file (insert full-body))
(pcase org-babel-c-variant
- ((or 'c 'cpp)
+ ((or `c `cpp)
(org-babel-eval
(format "%s -o %s %s %s %s"
(pcase org-babel-c-variant
- ('c org-babel-C-compiler)
- ('cpp org-babel-C++-compiler))
+ (`c org-babel-C-compiler)
+ (`cpp org-babel-C++-compiler))
tmp-bin-file
flags
(org-babel-process-file-name tmp-src-file)
libs)
""))
- ('d nil)) ;; no separate compilation for D
+ (`d nil)) ;; no separate compilation for D
(let ((results
(org-babel-eval
(pcase org-babel-c-variant
- ((or 'c 'cpp)
+ ((or `c `cpp)
(concat tmp-bin-file cmdline))
- ('d
+ (`d
(format "%s %s %s %s"
org-babel-D-compiler
flags
(let* ((basetype (org-babel-C-val-to-base-type val))
(type
(pcase basetype
- ('integerp '("int" "%d"))
- ('floatp '("double" "%f"))
- ('stringp
+ (`integerp '("int" "%d"))
+ (`floatp '("double" "%f"))
+ (`stringp
(list
(if (eq org-babel-c-variant 'd) "string" "const char*")
"\"%s\""))
(let ((type nil))
(mapc (lambda (v)
(pcase (org-babel-C-val-to-base-type v)
- ('stringp (setq type 'stringp))
- ('floatp
+ (`stringp (setq type 'stringp))
+ (`floatp
(if (or (not type) (eq type 'integerp))
(setq type 'floatp)))
- ('integerp
+ (`integerp
(unless type (setq type 'integerp)))))
val)
type))
"Generate a utility function to convert a column name
into a column number."
(pcase org-babel-c-variant
- ((or 'c 'cpp)
+ ((or `c `cpp)
"int get_column_num (int nbcols, const char** header, const char* column)
{
int c;
return -1;
}
")
- ('d
+ (`d
"int get_column_num (string[] header, string column)
{
foreach (c, h; header)
(concat
(format
(pcase org-babel-c-variant
- ((or 'c 'cpp) "const char* %s_header[%d] = {%s};")
- ('d "string %s_header[%d] = [%s];"))
+ ((or `c `cpp) "const char* %s_header[%d] = {%s};")
+ (`d "string %s_header[%d] = [%s];"))
table
(length headers)
(mapconcat (lambda (h) (format "%S" h)) headers ","))
"\n"
(pcase org-babel-c-variant
- ((or 'c 'cpp)
+ ((or `c `cpp)
(format
"const char* %s_h (int row, const char* col) { return %s[row][get_column_num(%d,%s_header,col)]; }"
table table (length headers) table))
- ('d
+ (`d
(format
"string %s_h (size_t row, string col) { return %s[row][get_column_num(%s_header,col)]; }"
table table table))))))
(name (nth 4 info))
(name-string (if name (format " (%s) " name) " ")))
(pcase evalp
- ('nil nil)
- ('t t)
- ('query (or
+ (`nil nil)
+ (`t t)
+ (`query (or
(and (not (bound-and-true-p
org-babel-confirm-evaluate-answer-no))
(yes-or-no-p
(catch :found
(org-with-wide-buffer
(pcase (org-element-type context)
- ((or 'inline-babel-call 'inline-src-block)
+ ((or `inline-babel-call `inline-src-block)
;; Results for inline objects are located right after them.
;; There is no RESULTS line to insert either.
(let ((limit (org-element-property
(skip-chars-backward " \t")
(point)))
(point))))))))
- ((or 'babel-call 'src-block)
+ ((or `babel-call `src-block)
(let* ((name (org-element-property :name context))
(named-results (and name (org-babel-find-named-result name))))
(goto-char (or named-results (org-element-property :end context)))
(org-with-wide-buffer
(goto-char (org-element-property :post-affiliated element))
(pcase (org-element-type element)
- ('fixed-width
+ (`fixed-width
(let ((v (org-trim (org-element-property :value element))))
(or (org-babel--string-to-number v) v)))
- ('table (org-babel-read-table))
- ('plain-list (org-babel-read-list))
- ('example-block
+ (`table (org-babel-read-table))
+ (`plain-list (org-babel-read-list))
+ (`example-block
(let ((v (org-element-property :value element)))
(if (or org-src-preserve-indentation
(org-element-property :preserve-indent element))
v
(org-remove-indentation v))))
- ('export-block
+ (`export-block
(org-remove-indentation (org-element-property :value element)))
- ('paragraph
+ (`paragraph
;; Treat paragraphs containing a single link specially.
(skip-chars-forward " \t")
(if (and (looking-at org-bracket-link-regexp)
(buffer-substring-no-properties
(org-element-property :contents-begin element)
(org-element-property :contents-end element))))
- ((or 'center-block 'quote-block 'verse-block 'special-block)
+ ((or `center-block `quote-block `verse-block `special-block)
(org-remove-indentation
(buffer-substring-no-properties
(org-element-property :contents-begin element)
;;
;; #+name: call_src
;; #+begin_src ...
- ((and (or 'babel-call 'src-block) (guard object?))
+ ((and (or `babel-call `src-block) (guard object?))
nil)
(type type)))
(begin
(skip-chars-backward " \r\t\n")
(point)))))
(pcase type
- ('inline-src-block
+ (`inline-src-block
(let* ((info
(org-babel-get-src-block-info nil element))
(params (nth 2 info)))
;; insert value.
(delete-region begin end)
(insert replacement)))))
- ((or 'babel-call 'inline-babel-call)
+ ((or `babel-call `inline-babel-call)
(org-babel-exp-do-export (org-babel-lob-get-info element)
'lob)
(let ((rep
(goto-char begin)
(delete-region begin end)
(insert rep))))
- ('src-block
+ (`src-block
(let ((match-start (copy-marker (match-beginning 0)))
(ind (org-get-indentation)))
;; Take care of matched block: compute
(nth 2 info)
`((:results . ,(if silent "silent" "replace")))))))
(pcase type
- ('block (org-babel-execute-src-block nil info))
- ('inline
+ (`block (org-babel-execute-src-block nil info))
+ (`inline
;; Position the point on the inline source block
;; allowing `org-babel-insert-result' to check that the
;; block is inline.
(goto-char (nth 5 info))
(org-babel-execute-src-block nil info))
- ('lob
+ (`lob
(save-excursion
(goto-char (nth 5 info))
(let (org-confirm-babel-evaluate)
in BODY as elisp."
(when session (error "Sessions are not (yet) supported for Groovy"))
(pcase result-type
- ('output
+ (`output
(let ((src-file (org-babel-temp-file "groovy_")))
(progn (with-temp-file src-file (insert body))
(org-babel-eval
(concat org-babel-groovy-command " " src-file) ""))))
- ('value
+ (`value
(let* ((src-file (org-babel-temp-file "groovy_"))
(wrapper (format org-babel-groovy-wrapper-method body)))
(with-temp-file src-file (insert wrapper))
(org-babel-reassemble-table
(let ((result
(pcase result-type
- ('output (mapconcat #'identity (reverse (cdr results)) "\n"))
- ('value (car results)))))
+ (`output (mapconcat #'identity (reverse (cdr results)) "\n"))
+ (`value (car results)))))
(org-babel-result-cond (cdr (assq :result-params params))
result (org-babel-script-escape result)))
(org-babel-pick-name (cdr (assq :colname-names params))
in BODY as elisp."
(when session (error "Sessions are not (yet) supported for Io"))
(pcase result-type
- ('output
+ (`output
(if (member "repl" result-params)
(org-babel-eval org-babel-io-command body)
(let ((src-file (org-babel-temp-file "io-")))
(progn (with-temp-file src-file (insert body))
(org-babel-eval
(concat org-babel-io-command " " src-file) "")))))
- ('value (let* ((src-file (org-babel-temp-file "io-"))
+ (`value (let* ((src-file (org-babel-temp-file "io-"))
(wrapper (format org-babel-io-wrapper-method body)))
(with-temp-file src-file (insert wrapper))
(let ((raw (org-babel-eval
BODY is the contents of the block, as a string. PARAMS is
a property list containing the parameters of the block."
(require (pcase org-babel-lisp-eval-fn
- ('slime-eval 'slime)
- ('sly-eval 'sly)))
+ (`slime-eval 'slime)
+ (`sly-eval 'sly)))
(org-babel-reassemble-table
(let ((result
(funcall (if (member "output" (cdr (assq :result-params params)))
(when (equal name (org-element-property :name element))
(throw :found
(pcase (org-element-type element)
- ('src-block (org-babel-get-src-block-info t element))
- ('babel-call (org-babel-lob-get-info element))
+ (`src-block (org-babel-get-src-block-info t element))
+ (`babel-call (org-babel-lob-get-info element))
;; Non-executable data found. Since names
;; are supposed to be unique throughout
;; a document, bail out.
last statement in BODY, as elisp."
(let ((raw
(pcase result-type
- ('output (org-babel-eval org-babel-lua-command
+ (`output (org-babel-eval org-babel-lua-command
(concat (if preamble (concat preamble "\n"))
body)))
- ('value (let ((tmp-file (org-babel-temp-file "lua-")))
+ (`value (let ((tmp-file (org-babel-temp-file "lua-")))
(org-babel-eval
org-babel-lua-command
(concat
(funcall send-wait)))
(results
(pcase result-type
- ('output
+ (`output
(mapconcat
#'org-trim
(butlast
(insert org-babel-lua-eoe-indicator)
(funcall send-wait))
2) "\n"))
- ('value
+ (`value
(let ((tmp-file (org-babel-temp-file "lua-")))
(org-babel-comint-with-output
(session org-babel-lua-eoe-indicator nil body)
org-babel-matlab-shell-command
org-babel-octave-shell-command)))
(pcase result-type
- ('output (org-babel-eval cmd body))
- ('value (let ((tmp-file (org-babel-temp-file "octave-")))
- (org-babel-eval
- cmd
- (format org-babel-octave-wrapper-method body
- (org-babel-process-file-name tmp-file 'noquote)
- (org-babel-process-file-name tmp-file 'noquote)))
- (org-babel-octave-import-elisp-from-file tmp-file))))))
+ (`output (org-babel-eval cmd body))
+ (`value (let ((tmp-file (org-babel-temp-file "octave-")))
+ (org-babel-eval
+ cmd
+ (format org-babel-octave-wrapper-method body
+ (org-babel-process-file-name tmp-file 'noquote)
+ (org-babel-process-file-name tmp-file 'noquote)))
+ (org-babel-octave-import-elisp-from-file tmp-file))))))
(defun org-babel-octave-evaluate-session
(session body result-type &optional matlabp)
(wait-file (org-babel-temp-file "matlab-emacs-link-wait-signal-"))
(full-body
(pcase result-type
- ('output
+ (`output
(mapconcat
#'org-babel-chomp
(list body org-babel-octave-eoe-indicator) "\n"))
- ('value
+ (`value
(if (and matlabp org-babel-matlab-with-emacs-link)
(concat
(format org-babel-matlab-emacs-link-wrapper-method
t full-body)
(insert full-body) (comint-send-input nil t)))) results)
(pcase result-type
- ('value
+ (`value
(org-babel-octave-import-elisp-from-file tmp-file))
- ('output
+ (`output
(setq results
(if matlabp
(cdr (reverse (delq "" (mapcar
tmp-file 'noquote)))
(let ((results
(pcase result-type
- ('output
+ (`output
(with-temp-file tmp-file
(insert
(org-babel-eval org-babel-perl-command body))
(buffer-string)))
- ('value
+ (`value
(org-babel-eval org-babel-perl-command
(format org-babel-perl-wrapper-method
body tmp-babel-file))))))
last statement in BODY, as elisp."
(let ((raw
(pcase result-type
- ('output (org-babel-eval org-babel-python-command
+ (`output (org-babel-eval org-babel-python-command
(concat (if preamble (concat preamble "\n"))
body)))
- ('value (let ((tmp-file (org-babel-temp-file "python-")))
+ (`value (let ((tmp-file (org-babel-temp-file "python-")))
(org-babel-eval
org-babel-python-command
(concat
(funcall send-wait)))
(results
(pcase result-type
- ('output
+ (`output
(let ((body (if (string-match-p ".\n+." body) ; Multiline
(let ((tmp-src-file (org-babel-temp-file
"python-")))
(insert org-babel-python-eoe-indicator)
(funcall send-wait))
2) "\n")))
- ('value
+ (`value
(let ((tmp-file (org-babel-temp-file "python-")))
(org-babel-comint-with-output
(session org-babel-python-eoe-indicator nil body)
(goto-char
(org-element-property :post-affiliated e))
(pcase (org-element-type e)
- ('babel-call
+ (`babel-call
(throw :found
(org-babel-execute-src-block
nil (org-babel-lob-get-info e) params)))
- ('src-block
+ (`src-block
(throw :found
(org-babel-execute-src-block
nil nil
(if (not buffer)
;; external process evaluation
(pcase result-type
- ('output (org-babel-eval org-babel-ruby-command body))
- ('value (let ((tmp-file (org-babel-temp-file "ruby-")))
+ (`output (org-babel-eval org-babel-ruby-command body))
+ (`value (let ((tmp-file (org-babel-temp-file "ruby-")))
(org-babel-eval
org-babel-ruby-command
(format (if (member "pp" result-params)
(org-babel-eval-read-file tmp-file))))
;; comint session evaluation
(pcase result-type
- ('output
+ (`output
(let ((eoe-string (format "puts \"%s\"" org-babel-ruby-eoe-indicator)))
;; Force the session to be ready before the actual session
;; code is run. There is some problem in comint that will
"conf.prompt_mode=_org_prompt_mode;conf.echo=true"
eoe-string)))
"\n") "[\r\n]") 4) "\n")))
- ('value
+ (`value
(let* ((tmp-file (org-babel-temp-file "ruby-"))
(ppp (or (member "code" result-params)
(member "pp" result-params))))
(org-babel-temp-file "sql-out-")))
(header-delim "")
(command (pcase (intern engine)
- ('dbi (format "dbish --batch %s < %s | sed '%s' > %s"
+ (`dbi (format "dbish --batch %s < %s | sed '%s' > %s"
(or cmdline "")
(org-babel-process-file-name in-file)
"/^+/d;s/^|//;s/(NULL)/ /g;$d"
(org-babel-process-file-name out-file)))
- ('monetdb (format "mclient -f tab %s < %s > %s"
+ (`monetdb (format "mclient -f tab %s < %s > %s"
(or cmdline "")
(org-babel-process-file-name in-file)
(org-babel-process-file-name out-file)))
- ('mssql (format "sqlcmd %s -s \"\t\" %s -i %s -o %s"
+ (`mssql (format "sqlcmd %s -s \"\t\" %s -i %s -o %s"
(or cmdline "")
(org-babel-sql-dbstring-mssql
dbhost dbuser dbpassword database)
(org-babel-process-file-name in-file))
(org-babel-sql-convert-standard-filename
(org-babel-process-file-name out-file))))
- ('mysql (format "mysql %s %s %s < %s > %s"
+ (`mysql (format "mysql %s %s %s < %s > %s"
(org-babel-sql-dbstring-mysql
dbhost dbport dbuser dbpassword database)
(if colnames-p "" "-N")
(or cmdline "")
(org-babel-process-file-name in-file)
(org-babel-process-file-name out-file)))
- ('postgresql (format
+ (`postgresql (format
"%spsql --set=\"ON_ERROR_STOP=1\" %s -A -P \
footer=off -F \"\t\" %s -f %s -o %s %s"
(if dbpassword
(org-babel-process-file-name in-file)
(org-babel-process-file-name out-file)
(or cmdline "")))
- ('sqsh (format "sqsh %s %s -i %s -o %s -m csv"
+ (`sqsh (format "sqsh %s %s -i %s -o %s -m csv"
(or cmdline "")
(org-babel-sql-dbstring-sqsh
dbhost dbuser dbpassword database)
(org-babel-process-file-name in-file))
(org-babel-sql-convert-standard-filename
(org-babel-process-file-name out-file))))
- ('vertica (format "vsql %s -f %s -o %s %s"
- (org-babel-sql-dbstring-vertica
- dbhost dbport dbuser dbpassword database)
- (org-babel-process-file-name in-file)
- (org-babel-process-file-name out-file)
- (or cmdline "")))
- ('oracle (format
+ (`vertica (format "vsql %s -f %s -o %s %s"
+ (org-babel-sql-dbstring-vertica
+ dbhost dbport dbuser dbpassword database)
+ (org-babel-process-file-name in-file)
+ (org-babel-process-file-name out-file)
+ (or cmdline "")))
+ (`oracle (format
"sqlplus -s %s < %s > %s"
(org-babel-sql-dbstring-oracle
dbhost dbport dbuser dbpassword database)
(with-temp-file in-file
(insert
(pcase (intern engine)
- ('dbi "/format partbox\n")
- ('oracle "SET PAGESIZE 50000
+ (`dbi "/format partbox\n")
+ (`oracle "SET PAGESIZE 50000
SET NEWPAGE 0
SET TAB OFF
SET SPACE 0
SET COLSEP '|'
")
- ((or 'mssql 'sqsh) "SET NOCOUNT ON
+ ((or `mssql `sqsh) "SET NOCOUNT ON
")
- ('vertica "\\a\n")
+ (`vertica "\\a\n")
(_ ""))
(org-babel-expand-body:sql body params)
;; "sqsh" requires "go" inserted at EOF.
(or (not (memq (line-beginning-position 0) deadline-pos))
habitp))
nil)
- ('repeated-after-deadline
+ (`repeated-after-deadline
(let ((deadline (time-to-days
(org-get-deadline-time (point)))))
(and (<= schedule deadline) (> current deadline))))
- ('not-today pastschedp)
- ('t t)
+ (`not-today pastschedp)
+ (`t t)
(_ nil))
(throw :skip nil))
;; Skip habits if `org-habit-show-habits' is nil, or if we
(org-capture-put :exact-position (point))
(setq target-entry-p
(and (derived-mode-p 'org-mode) (org-at-heading-p))))
- ('(clock)
+ (`(clock)
(if (and (markerp org-clock-hd-marker)
(marker-buffer org-clock-hd-marker))
(progn (set-buffer (marker-buffer org-clock-hd-marker))
(goto-char (org-capture-get :pos))
(setq-local outline-level 'org-outline-level)
(pcase (org-capture-get :type)
- ((or 'nil 'entry) (org-capture-place-entry))
- ('table-line (org-capture-place-table-line))
- ('plain (org-capture-place-plain-text))
- ('item (org-capture-place-item))
- ('checkitem (org-capture-place-item)))
+ ((or `nil `entry) (org-capture-place-entry))
+ (`table-line (org-capture-place-table-line))
+ (`plain (org-capture-place-plain-text))
+ (`item (org-capture-place-item))
+ (`checkitem (org-capture-place-item)))
(org-capture-mode 1)
(setq-local org-capture-current-plist org-capture-plist))
(let ((insert-fun (if (equal key "C") #'insert
(lambda (s) (org-insert-link 0 s)))))
(pcase org-capture--clipboards
- ('nil nil)
+ (`nil nil)
(`(,value) (funcall insert-fun value))
(`(,first-value . ,_)
(funcall insert-fun
time (or org-time-was-given upcase?)
(member key '("u" "U"))
nil nil (list org-end-time-was-given))))
- ('nil
+ (`nil
;; Load history list for current prompt.
(setq org-capture--prompt-history
(gethash prompt org-capture--prompt-history-table))
(org-timestamp-change
(round (/ (float-time tdiff)
(pcase timestamp?
- ('minute 60)
- ('hour 3600)
- ('day (* 24 3600))
- ('month (* 24 3600 31))
- ('year (* 24 3600 365.2)))))
+ (`minute 60)
+ (`hour 3600)
+ (`day (* 24 3600))
+ (`month (* 24 3600 31))
+ (`year (* 24 3600 365.2)))))
timestamp? 'updown)))))))
;;;###autoload
(org-find-dblock "clocktable")
(org-show-entry))
(pcase (org-in-clocktable-p)
- ('nil
+ (`nil
(org-create-dblock
(org-combine-plists
(list :scope (if (org-before-first-heading-p) 'file 'subtree))
(error "Looking forward with quarters isn't implemented"))))
(when (= shift 0)
(pcase key
- ('yesterday (setq key 'today shift -1))
- ('lastweek (setq key 'week shift -1))
- ('lastmonth (setq key 'month shift -1))
- ('lastyear (setq key 'year shift -1))
- ('lastq (setq key 'quarter shift -1))))
+ (`yesterday (setq key 'today shift -1))
+ (`lastweek (setq key 'week shift -1))
+ (`lastmonth (setq key 'month shift -1))
+ (`lastyear (setq key 'year shift -1))
+ (`lastq (setq key 'quarter shift -1))))
;; Prepare start and end times depending on KEY's type.
(pcase key
- ((or 'day 'today) (setq m 0 h 0 h1 24 d (+ d shift)))
- ((or 'week 'thisweek)
+ ((or `day `today) (setq m 0 h 0 h1 24 d (+ d shift)))
+ ((or `week `thisweek)
(let* ((ws (or wstart 1))
(diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))))
(setq m 0 h 0 d (- d diff) d1 (+ 7 d))))
- ((or 'month 'thismonth)
+ ((or `month `thismonth)
(setq h 0 m 0 d (or mstart 1) month (+ month shift) month1 (1+ month)))
- ((or 'quarter 'thisq)
+ ((or `quarter `thisq)
;; Compute if this shift remains in this year. If not, compute
;; how many years and quarters we have to shift (via floor*) and
;; compute the shifted years, months and quarters.
(setq shiftedy y)
(let ((qshift (* 3 (1- (+ q shift)))))
(setq m 0 h 0 d 1 month (+ 1 qshift) month1 (+ 4 qshift))))))
- ((or 'year 'thisyear)
+ ((or `year `thisyear)
(setq m 0 h 0 d 1 month 1 y (+ y shift) y1 (1+ y)))
- ((or 'interactive 'untilnow)) ; Special cases, ignore them.
+ ((or `interactive `untilnow)) ; Special cases, ignore them.
(_ (user-error "No such time block %s" key)))
;; Format start and end times according to AS-STRINGS.
(let* ((start (pcase key
- ('interactive (org-read-date nil t nil "Range start? "))
+ (`interactive (org-read-date nil t nil "Range start? "))
;; In theory, all clocks started after the dawn of
;; humanity. However, the platform's clock
;; support might not go back that far. Choose the
;; that works, otherwise 0 (1970). Going back
;; billions of years would loop forever on Mac OS
;; X 10.6 with Emacs 26 and earlier (Bug#27736).
- ('untilnow
+ (`untilnow
(let ((old 0))
(dolist (older '((-32768 0) (-33554432 0)) old)
(when (ignore-errors (decode-time older))
(setq old older)))))
(_ (encode-time 0 m h d month y))))
(end (pcase key
- ('interactive (org-read-date nil t nil "Range end? "))
- ('untilnow (current-time))
+ (`interactive (org-read-date nil t nil "Range end? "))
+ (`untilnow (current-time))
(_ (encode-time 0
(or m1 m)
(or h1 h)
(or y1 y)))))
(text
(pcase key
- ((or 'day 'today) (format-time-string "%A, %B %d, %Y" start))
- ((or 'week 'thisweek) (format-time-string "week %G-W%V" start))
- ((or 'month 'thismonth) (format-time-string "%B %Y" start))
- ((or 'year 'thisyear) (format-time-string "the year %Y" start))
- ((or 'quarter 'thisq)
+ ((or `day `today) (format-time-string "%A, %B %d, %Y" start))
+ ((or `week `thisweek) (format-time-string "week %G-W%V" start))
+ ((or `month `thismonth) (format-time-string "%B %Y" start))
+ ((or `year `thisyear) (format-time-string "the year %Y" start))
+ ((or `quarter `thisq)
(concat (org-count-quarter shiftedq)
" quarter of " (number-to-string shiftedy)))
- ('interactive "(Range interactively set)")
- ('untilnow "now"))))
+ (`interactive "(Range interactively set)")
+ (`untilnow "now"))))
(if (not as-strings) (list start end text)
(let ((f (cdr org-time-stamp-formats)))
(list (format-time-string f start)
(catch 'exit
(let* ((scope (plist-get params :scope))
(files (pcase scope
- ('agenda
+ (`agenda
(org-agenda-files t))
- ('agenda-with-archives
+ (`agenda-with-archives
(org-add-archive-files (org-agenda-files t)))
- ('file-with-archives
+ (`file-with-archives
(and buffer-file-name
(org-add-archive-files (list buffer-file-name))))
((pred functionp) (funcall scope))
(setq narrow (intern (format "%d!" narrow))))
(pcase narrow
- ((or 'nil (pred integerp)) nil) ;nothing to do
+ ((or `nil (pred integerp)) nil) ;nothing to do
((and (pred symbolp)
(guard (string-match-p "\\`[0-9]+!\\'" (symbol-name narrow))))
(setq narrow-cut-p t)
(let ((id (plist-get params :id))
view-file view-pos)
(pcase id
- ('global nil)
- ((or 'local 'nil) (setq view-pos (point)))
+ (`global nil)
+ ((or `local `nil) (setq view-pos (point)))
((and (let id-string (format "%s" id))
(guard (string-match "^file:\\(.*\\)" id-string)))
(setq view-file (match-string-no-properties 1 id-string))
Raise an error if expected format is unknown."
(pcase (or fmt org-duration-format)
- ('h:mm
+ (`h:mm
(let ((minutes (floor minutes)))
(format "%d:%02d" (/ minutes 60) (mod minutes 60))))
- ('h:mm:ss
+ (`h:mm:ss
(let* ((whole-minutes (floor minutes))
(seconds (floor (* 60 (- minutes whole-minutes)))))
(format "%s:%02d"
((pred atom) (error "Invalid duration format specification: %S" fmt))
;; Mixed format. Call recursively the function on both parts.
((and duration-format
- (let `(special . ,(and mode (or 'h:mm:ss 'h:mm)))
+ (let `(special . ,(and mode (or `h:mm:ss `h:mm)))
(assq 'special duration-format)))
(let* ((truncated-format
;; Remove "special" mode from duration format in order to
(when datum
(let ((type (org-element-type datum)))
(pcase type
- ('org-data (list 'org-data nil))
- ('plain-text (substring-no-properties datum))
- ('nil (copy-sequence datum))
+ (`org-data (list 'org-data nil))
+ (`plain-text (substring-no-properties datum))
+ (`nil (copy-sequence datum))
(_
(list type (plist-put (copy-sequence (nth 1 datum)) :parent nil)))))))
bullet
(and counter (format "[@%d] " counter))
(pcase checkbox
- ('on "[X] ")
- ('off "[ ] ")
- ('trans "[-] ")
+ (`on "[X] ")
+ (`off "[ ] ")
+ (`trans "[-] ")
(_ nil))
(and tag (format "%s :: " tag))
(when contents
;; a format string, escape percent signs
;; in description.
(replace-regexp-in-string "%" "%%" contents)))
- ((or 'bracket
- 'nil
+ ((or `bracket
+ `nil
(guard (member type '("coderef" "custom-id" "fuzzy"))))
"[[%s]]")
;; Otherwise, just obey to `:format'.
- ('angle "<%s>")
- ('plain "%s")
+ (`angle "<%s>")
+ (`plain "%s")
(f (error "Wrong `:format' value: %s" f)))))
(format fmt
(pcase type
(let* ((repeat-string
(concat
(pcase (org-element-property :repeater-type timestamp)
- ('cumulate "+") ('catch-up "++") ('restart ".+"))
+ (`cumulate "+") (`catch-up "++") (`restart ".+"))
(let ((val (org-element-property :repeater-value timestamp)))
(and val (number-to-string val)))
(pcase (org-element-property :repeater-unit timestamp)
- ('hour "h") ('day "d") ('week "w") ('month "m") ('year "y"))))
+ (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))))
(warning-string
(concat
(pcase (org-element-property :warning-type timestamp)
- ('first "--") ('all "-"))
+ (`first "--") (`all "-"))
(let ((val (org-element-property :warning-value timestamp)))
(and val (number-to-string val)))
(pcase (org-element-property :warning-unit timestamp)
- ('hour "h") ('day "d") ('week "w") ('month "m") ('year "y"))))
+ (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))))
(build-ts-string
;; Build an Org timestamp string from TIME. ACTIVEP is
;; non-nil when time stamp is active. If WITH-TIME-P is
ts)))
(type (org-element-property :type timestamp)))
(pcase type
- ((or 'active 'inactive)
+ ((or `active `inactive)
(let* ((minute-start (org-element-property :minute-start timestamp))
(minute-end (org-element-property :minute-end timestamp))
(hour-start (org-element-property :hour-start timestamp))
(and hour-start minute-start)
(and time-range-p hour-end)
(and time-range-p minute-end))))
- ((or 'active-range 'inactive-range)
+ ((or `active-range `inactive-range)
(let ((minute-start (org-element-property :minute-start timestamp))
(minute-end (org-element-property :minute-end timestamp))
(hour-start (org-element-property :hour-start timestamp))
`table-row' or nil."
(if parentp
(pcase type
- ('headline 'section)
- ('inlinetask 'planning)
- ('plain-list 'item)
- ('property-drawer 'node-property)
- ('section 'planning)
- ('table 'table-row))
+ (`headline 'section)
+ (`inlinetask 'planning)
+ (`plain-list 'item)
+ (`property-drawer 'node-property)
+ (`section 'planning)
+ (`table 'table-row))
(pcase type
- ('item 'item)
- ('node-property 'node-property)
- ('planning 'property-drawer)
- ('table-row 'table-row))))
+ (`item 'item)
+ (`node-property 'node-property)
+ (`planning 'property-drawer)
+ (`table-row 'table-row))))
(defun org-element--parse-elements
(beg end mode structure granularity visible-only acc)
lower element
upper element)))))
(pcase side
- ('both (cons lower upper))
- ('nil lower)
+ (`both (cons lower upper))
+ (`nil lower)
(_ upper))))
(defun org-element--cache-put (element)
;; case for headline editing: if a headline is modified but
;; not removed, do not extend.
(when (pcase org-element--cache-change-warning
- ('t t)
- ('headline
+ (`t t)
+ (`headline
(not (and (org-with-limited-levels (org-at-heading-p))
(= (line-end-position) bottom))))
(_
(defun org-entities--user-safe-p (v)
"Non-nil if V is a safe value for `org-entities-user'."
(pcase v
- ('nil t)
+ (`nil t)
(`(,(and (pred stringp)
(pred (string-match-p "\\`[a-zA-Z][a-zA-Z0-9]*\\'")))
,(pred stringp) ,(pred booleanp) ,(pred stringp)
(defun org-gnus-store-link ()
"Store a link to a Gnus folder or message."
(pcase major-mode
- ('gnus-group-mode
+ (`gnus-group-mode
(let ((group (gnus-group-group-name)))
(when group
(org-store-link-props :type "gnus" :group group)
(let ((description (org-gnus-group-link group)))
(org-add-link-props :link description :description description)
description))))
- ((or 'gnus-summary-mode 'gnus-article-mode)
+ ((or `gnus-summary-mode `gnus-article-mode)
(let* ((group
(pcase (gnus-find-method-for-group gnus-newsgroup-name)
(`(nnvirtual . ,_)
(description (org-email-link-description)))
(org-add-link-props :link link :description description)
link)))
- ('message-mode
+ (`message-mode
(setq org-store-link-plist nil) ;reset
(save-excursion
(save-restriction
a heading. Moreover, if is is `inlinetask', the first star will
have `org-warning' face."
(let* ((line (aref (pcase heading
- ('nil org-indent--text-line-prefixes)
- ('inlinetask org-indent--inlinetask-line-prefixes)
+ (`nil org-indent--text-line-prefixes)
+ (`inlinetask org-indent--inlinetask-line-prefixes)
(_ org-indent--heading-line-prefixes))
level))
(wrap
(manual (car parts))
(node (or (nth 1 parts) "Top")))
(pcase format
- ('html
+ (`html
(format "<a href=\"%s#%s\">%s</a>"
(org-info-map-html-url manual)
(org-info--expand-node-name node)
(or desc path)))
- ('texinfo
+ (`texinfo
(let ((title (or desc "")))
(format "@ref{%s,%s,,%s,}" node title manual)))
(_ nil))))
"Hide inline tasks in buffer when STATE is `contents' or `children'.
This function is meant to be used in `org-cycle-hook'."
(pcase state
- ('contents
+ (`contents
(let ((regexp (org-inlinetask-outline-regexp)))
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(org-inlinetask-toggle-visibility)
(org-inlinetask-goto-end)))))
- ('children
+ (`children
(save-excursion
(while
(or (org-inlinetask-at-task-p)
(lambda (datum)
(let ((key (org-element-property :key datum)))
(pcase (org-element-type datum)
- ('keyword
+ (`keyword
(let ((value (org-element-property :value datum)))
(and (string= key "PROPERTY")
(string-match deprecated-re value)
(format "Deprecated syntax for \"%s\". \
Use header-args instead"
(match-string-no-properties 1 value))))))
- ('node-property
+ (`node-property
(and (member-ignore-case key deprecated-babel-properties)
(list
(org-element-property :begin datum)
(let ((name (org-trim (match-string-no-properties 0)))
(element (org-element-at-point)))
(pcase (org-element-type element)
- ((or 'drawer 'property-drawer)
+ ((or `drawer `property-drawer)
(goto-char (org-element-property :end element))
nil)
- ((or 'comment-block 'example-block 'export-block 'src-block
- 'verse-block)
+ ((or `comment-block `example-block `export-block `src-block
+ `verse-block)
nil)
(_
(push (list (line-beginning-position)
node-property src-block)
(lambda (datum)
(pcase (org-element-type datum)
- ((or 'babel-call 'inline-babel-call)
+ ((or `babel-call `inline-babel-call)
(funcall verify
datum
nil
(list
(org-element-property :inside-header datum)
(org-element-property :end-header datum)))))
- ('inline-src-block
+ (`inline-src-block
(funcall verify
datum
(org-element-property :language datum)
(org-babel-parse-header-arguments
(org-element-property :parameters datum))))
- ('keyword
+ (`keyword
(when (string= (org-element-property :key datum) "PROPERTY")
(let ((value (org-element-property :value datum)))
(when (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)?\\+? *"
(match-string 1 value)
(org-babel-parse-header-arguments
(substring value (match-end 0))))))))
- ('node-property
+ (`node-property
(let ((key (org-element-property :key datum)))
(when (let ((case-fold-search t))
(string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?\\+?"
(match-string 1 key)
(org-babel-parse-header-arguments
(org-element-property :value datum))))))
- ('src-block
+ (`src-block
(funcall verify
datum
(org-element-property :language datum)
(org-babel-parse-header-arguments
(org-trim
(pcase type
- ('src-block
+ (`src-block
(mapconcat
#'identity
(cons (org-element-property :parameters datum)
(org-element-property :header datum))
" "))
- ('inline-src-block
+ (`inline-src-block
(or (org-element-property :parameters datum) ""))
(_
(concat
\\{org-lint--report-mode-map}"
(setf tabulated-list-format
`[("Line" 6
- ,(lambda (a b)
- (< (string-to-number (aref (cadr a) 0))
- (string-to-number (aref (cadr b) 0))))
+ (lambda (a b)
+ (< (string-to-number (aref (cadr a) 0))
+ (string-to-number (aref (cadr b) 0))))
:right-align t)
("Trust" 5 t)
("Warning" 0 t)])
(message "Org linting process starting..."))
(let ((checkers
(pcase arg
- ('nil org-lint--checkers)
- ('(4)
+ (`nil org-lint--checkers)
+ (`(4)
(let ((category
(completing-read
"Checker category: "
(lambda (c)
(assoc-string (org-lint-checker-categories c) category))
org-lint--checkers)))
- ('(16)
+ (`(16)
(list
(let ((name (completing-read
"Checker name: "
(start (and (not splice)
(org-list--generic-eval
(pcase type
- ('ordered ostart)
- ('unordered ustart)
+ (`ordered ostart)
+ (`unordered ustart)
(_ dstart))
depth)))
(end (and (not splice)
(org-list--generic-eval
(pcase type
- ('ordered oend)
- ('unordered uend)
+ (`ordered oend)
+ (`unordered uend)
(_ dend))
depth))))
;; Make sure trailing newlines in END appear in the output by
(separator (and (org-export-get-next-element item info)
(org-list--generic-eval isep type depth)))
(closing (pcase (org-list--generic-eval iend type depth)
- ((or 'nil "") "\n")
+ ((or `nil "") "\n")
((and (guard separator) s)
(if (equal (substring s -1) "\n") s (concat s "\n")))
(s s))))
(or dtstart dtend ddstart ddend)))
(concat
(pcase (org-element-property :checkbox item)
- ('on cbon)
- ('off cboff)
- ('trans cbtrans))
+ (`on cbon)
+ (`off cboff)
+ (`trans cbtrans))
(and tag
(concat dtstart
(if backend
LIST is as returned by `org-list-to-lisp'. PARAMS is a property
list with overruling parameters for `org-list-to-generic'."
(let* ((blank (pcase (cdr (assq 'heading org-blank-before-new-entry))
- ('t t)
- ('auto (save-excursion
+ (`t t)
+ (`auto (save-excursion
(org-with-limited-levels (outline-previous-heading))
(org-previous-line-empty-p)))))
(level (org-reduced-level (or (org-current-level) 0)))
(let ((kwds org-todo-keywords-1))
(org-mouse-keyword-menu
kwds
- (lambda (kwd) (org-todo kwd))
+ `(lambda (kwd) (org-todo kwd))
(lambda (kwd) (equal state kwd))))))
(defun org-mouse-tag-menu () ;todo
(defun org-mouse-agenda-type (type)
(pcase type
- ('tags "Tags: ")
- ('todo "TODO: ")
- ('tags-tree "Tags tree: ")
- ('todo-tree "TODO tree: ")
- ('occur-tree "Occur tree: ")
+ (`tags "Tags: ")
+ (`todo "TODO: ")
+ (`tags-tree "Tags tree: ")
+ (`todo-tree "TODO tree: ")
+ (`occur-tree "Occur tree: ")
(_ "Agenda command ???")))
(defun org-mouse-list-options-menu (alloptions &optional function)
(y-labels (plist-get params :ylabels))
(plot-str "'%s' using %s%d%s with %s title '%s'")
(plot-cmd (pcase type
- ('2d "plot")
- ('3d "splot")
- ('grid "splot")))
+ (`2d "plot")
+ (`3d "splot")
+ (`grid "splot")))
(script "reset")
;; ats = add-to-script
(ats (lambda (line) (setf script (concat script "\n" line))))
(funcall ats (format "set term %s" (file-name-extension file)))
(funcall ats (format "set output '%s'" file)))
(pcase type ; type
- ('2d ())
- ('3d (when map (funcall ats "set map")))
- ('grid (funcall ats (if map "set pm3d map" "set pm3d"))))
+ (`2d ())
+ (`3d (when map (funcall ats "set map")))
+ (`grid (funcall ats (if map "set pm3d map" "set pm3d"))))
(when title (funcall ats (format "set title '%s'" title))) ; title
(mapc ats lines) ; line
(dolist (el sets) (funcall ats (format "set %s" el))) ; set
"%Y-%m-%d-%H:%M:%S") "\"")))
(unless preface
(pcase type ; plot command
- ('2d (dotimes (col num-cols)
+ (`2d (dotimes (col num-cols)
(unless (and (eq type '2d)
(or (and ind (equal (1+ col) ind))
(and deps (not (member (1+ col) deps)))))
(or (nth col col-labels)
(format "%d" (1+ col))))
plot-lines)))))
- ('3d
+ (`3d
(setq plot-lines (list (format "'%s' matrix with %s title ''"
data-file with))))
- ('grid
+ (`grid
(setq plot-lines (list (format "'%s' with %s title ''"
data-file with)))))
(funcall ats
(setf params (org-plot/collect-options params))))
;; Dump table to datafile (very different for grid).
(pcase (plist-get params :plot-type)
- ('2d (org-plot/gnuplot-to-data table data-file params))
- ('3d (org-plot/gnuplot-to-data table data-file params))
- ('grid (let ((y-labels (org-plot/gnuplot-to-grid-data
+ (`2d (org-plot/gnuplot-to-data table data-file params))
+ (`3d (org-plot/gnuplot-to-data table data-file params))
+ (`grid (let ((y-labels (org-plot/gnuplot-to-grid-data
table data-file params)))
(when y-labels (plist-put params :ylabels y-labels)))))
;; Check for timestamp ind column.
(defun org-src-switch-to-buffer (buffer context)
(pcase org-src-window-setup
- ('current-window (pop-to-buffer-same-window buffer))
- ('other-window
+ (`current-window (pop-to-buffer-same-window buffer))
+ (`other-window
(switch-to-buffer-other-window buffer))
- ('other-frame
+ (`other-frame
(pcase context
- ('exit
+ (`exit
(let ((frame (selected-frame)))
(switch-to-buffer-other-frame buffer)
(delete-frame frame)))
- ('save
+ (`save
(kill-buffer (current-buffer))
(pop-to-buffer-same-window buffer))
(_ (switch-to-buffer-other-frame buffer))))
- ('reorganize-frame
+ (`reorganize-frame
(when (eq context 'edit) (delete-other-windows))
(org-switch-to-buffer-other-window buffer)
(when (eq context 'exit) (delete-other-windows)))
- ('switch-invisibly (set-buffer buffer))
+ (`switch-invisibly (set-buffer buffer))
(_
(message "Invalid value %s for `org-src-window-setup'"
org-src-window-setup)
;; Make sure that contents are exported as Org data when :raw
;; parameter is non-nil.
,(when (and backend (plist-get params :raw))
- '(setq contents
+ `(setq contents
;; Since we don't know what are the pseudo object
;; types defined in backend, we cannot pass them to
;; `org-element-interpret-data'. As a consequence,
next to tags."
(mapconcat (lambda (token)
(pcase token
- ('(:startgroup) "{")
- ('(:endgroup) "}")
- ('(:startgrouptag) "[")
- ('(:endgrouptag) "]")
- ('(:grouptags) ":")
- ('(:newline) "\\n")
+ (`(:startgroup) "{")
+ (`(:endgroup) "}")
+ (`(:startgrouptag) "[")
+ (`(:endgrouptag) "]")
+ (`(:grouptags) ":")
+ (`(:newline) "\\n")
((and
(guard (not skip-key))
`(,(and tag (pred stringp)) . ,(and key (pred characterp))))
(when (eq group-status 'append)
(push (nreverse current-group) groups))
(setq group-status nil current-group nil))
- ('(:grouptags) (setq group-status 'append))
+ (`(:grouptags) (setq group-status 'append))
((and `(,tag . ,_) (guard group-status))
(if (eq group-status 'append) (push tag current-group)
(setq current-group (list tag))))
When optional argument PARENT is non-nil, consider parent
headline instead of current one."
(pcase (assq 'heading org-blank-before-new-entry)
- ('(heading . auto)
+ (`(heading . auto)
(save-excursion
(org-with-limited-levels
(unless (and (org-before-first-heading-p)
(let ((todo (and (not no-todo) (match-string 2)))
(priority (and (not no-priority) (match-string 3)))
(headline (pcase (match-string 4)
- ('nil "")
+ (`nil "")
((and (guard no-comment) h)
(replace-regexp-in-string
(eval-when-compile
(template (buffer-substring beg end))
(shift-n (and doshift (string-to-number (match-string 1 shift))))
(shift-what (pcase (and doshift (match-string 2 shift))
- ('nil nil)
+ (`nil nil)
("d" 'day)
("w" (setq shift-n (* 7 shift-n)) 'day)
("m" 'month)
(push (cons f (copy-sequence org-store-link-plist))
results-alist)))
(pcase results-alist
- ('nil nil)
+ (`nil nil)
(`((,_ . ,_)) t) ;single choice: nothing to do
(`((,name . ,_) . ,_)
;; Reinstate link plist associated to the chosen
#'identity
(append
(pcase org-refile-use-outline-path
- ('file (list (file-name-nondirectory
+ (`file (list (file-name-nondirectory
(buffer-file-name
(buffer-base-buffer)))))
- ('full-file-path
+ (`full-file-path
(list (buffer-file-name
(buffer-base-buffer))))
- ('buffer-name
+ (`buffer-name
(list (buffer-name
(buffer-base-buffer))))
(_ nil))
old-date)
(match-string 1 old-date)))))
(pcase arg
- ('(4)
+ (`(4)
(when (and old-date log)
(org-add-log-setup (if deadline? 'deldeadline 'delschedule)
nil old-date log))
(org-remove-timestamp-with-keyword keyword)
(message (if deadline? "Item no longer has a deadline."
"Item is no longer scheduled.")))
- ('(16)
+ (`(16)
(save-excursion
(org-back-to-heading t)
(let ((regexp (if deadline? org-deadline-time-regexp
(nreverse (org-split-string tags ":")))))
res)
(pcase onoff
- ('off (setq current (delete tag current)))
- ((or 'on (guard (not (member tag current))))
+ (`off (setq current (delete tag current)))
+ ((or `on (guard (not (member tag current))))
(setq res t)
(cl-pushnew tag current :test #'equal))
(_ (setq current (delete tag current))))
(interactive "sTags: ")
(let ((data
(pcase (if (stringp data) (org-trim data) data)
- ((or 'nil "") nil)
+ ((or `nil "") nil)
((pred listp) (format ":%s:" (mapconcat #'identity data ":")))
((pred stringp)
(format ":%s:"
This is a wrapper to handle the brain-dead convention in calendar that
user function argument order change dependent on argument order."
(pcase calendar-date-style
- ('american (list arg1 arg2 arg3))
- ('european (list arg2 arg1 arg3))
- ('iso (list arg2 arg3 arg1))))
+ (`american (list arg1 arg2 arg3))
+ (`european (list arg2 arg1 arg3))
+ (`iso (list arg2 arg3 arg1))))
(defun org-eval-in-calendar (form &optional keepdate)
"Eval FORM in the calendar window and return to current window.
(pcase origin-cat
;; `day' category ends before `hour' if any, or at the end
;; of the day name.
- ('day (min (or (match-beginning 7) (1- (match-end 5))) origin))
- ('hour (min (match-end 7) origin))
- ('minute (min (1- (match-end 8)) origin))
+ (`day (min (or (match-beginning 7) (1- (match-end 5))) origin))
+ (`hour (min (match-end 7) origin))
+ (`minute (min (1- (match-end 8)) origin))
((pred integerp) (min (1- (match-end 0)) origin))
;; Point was right after the time-stamp. However, the
;; time-stamp length might have changed, so refer to
;; (match-end 0) instead.
- ('after (match-end 0))
+ (`after (match-end 0))
;; `year' and `month' have both fixed size: point couldn't
;; have moved into another part.
(_ origin))))
(let ((element (org-element-at-point)))
(barf-if-buffer-read-only)
(pcase (org-element-type element)
- ('src-block
+ (`src-block
(if (not arg) (org-edit-src-code)
(let* ((info (org-babel-get-src-block-info))
(lang (nth 0 info))
(switch-to-buffer
(funcall (intern (concat "org-babel-prep-session:" lang))
session params))))))
- ('keyword
+ (`keyword
(if (member (org-element-property :key element) '("INCLUDE" "SETUPFILE"))
(org-open-link-from-string
(format "[[%s]]"
(match-string 0 value))
(t (user-error "No valid file specified")))))))
(user-error "No special environment to edit here")))
- ('table
+ (`table
(if (eq (org-element-property :type element) 'table.el)
(org-edit-table.el)
(call-interactively 'org-table-edit-formulas)))
;; Only Org tables contain `table-row' type elements.
- ('table-row (call-interactively 'org-table-edit-formulas))
- ('example-block (org-edit-src-code))
- ('export-block (org-edit-export-block))
- ('fixed-width (org-edit-fixed-width-region))
- ('latex-environment (org-edit-latex-environment))
+ (`table-row (call-interactively 'org-table-edit-formulas))
+ (`example-block (org-edit-src-code))
+ (`export-block (org-edit-export-block))
+ (`fixed-width (org-edit-fixed-width-region))
+ (`latex-environment (org-edit-latex-environment))
(_
;; No notable element at point. Though, we may be at a link or
;; a footnote reference, which are objects. Thus, scan deeper.
(let ((context (org-element-context element)))
(pcase (org-element-type context)
- ('footnote-reference (org-edit-footnote-reference))
- ('inline-src-block (org-edit-inline-src-code))
- ('link (call-interactively #'ffap))
+ (`footnote-reference (org-edit-footnote-reference))
+ (`inline-src-block (org-edit-inline-src-code))
+ (`link (call-interactively #'ffap))
(_ (user-error "No special environment to edit here"))))))))
(defvar org-table-coordinate-overlays) ; defined in org-table.el
;; a src block. Hence, we first check if point is in such
;; a block and then if it is at a blank line.
(pcase type
- ((or 'inline-src-block 'src-block)
+ ((or `inline-src-block `src-block)
(unless org-babel-no-eval-on-ctrl-c-ctrl-c
(org-babel-eval-wipe-error-buffer)
(org-babel-execute-src-block
(user-error
(substitute-command-keys
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))
- ((or 'babel-call 'inline-babel-call)
+ ((or `babel-call `inline-babel-call)
(let ((info (org-babel-lob-get-info context)))
(when info (org-babel-execute-src-block nil info))))
- ('clock (org-clock-update-time-maybe))
- ('dynamic-block
+ (`clock (org-clock-update-time-maybe))
+ (`dynamic-block
(save-excursion
(goto-char (org-element-property :post-affiliated context))
(org-update-dblock)))
- ('footnote-definition
+ (`footnote-definition
(goto-char (org-element-property :post-affiliated context))
(call-interactively 'org-footnote-action))
- ('footnote-reference (call-interactively #'org-footnote-action))
- ((or 'headline 'inlinetask)
+ (`footnote-reference (call-interactively #'org-footnote-action))
+ ((or `headline `inlinetask)
(save-excursion (goto-char (org-element-property :begin context))
(call-interactively #'org-set-tags)))
- ('item
+ (`item
;; At an item: `C-u C-u' sets checkbox to "[-]"
;; unconditionally, whereas `C-u' will toggle its presence.
;; Without a universal argument, if the item has a checkbox,
(when block-item
(message "Checkboxes were removed due to empty box at line %d"
(org-current-line block-item))))))
- ('keyword
+ (`keyword
(let ((org-inhibit-startup-visibility-stuff t)
(org-startup-align-all-tables nil))
(when (boundp 'org-table-coordinate-overlays)
(setq org-table-coordinate-overlays nil))
(org-save-outline-visibility 'use-markers (org-mode-restart)))
(message "Local setup has been refreshed"))
- ('plain-list
+ (`plain-list
;; At a plain list, with a double C-u argument, set
;; checkboxes of each item to "[-]", whereas a single one
;; will toggle their presence according to the state of the
struct (org-list-parents-alist struct) old-struct)
(org-update-checkbox-count-maybe)
(save-excursion (goto-char beginm) (org-list-send-list 'maybe))))
- ((or 'property-drawer 'node-property)
+ ((or `property-drawer `node-property)
(call-interactively #'org-property-action))
- ('radio-target
+ (`radio-target
(call-interactively #'org-update-radio-target-regexp))
- ('statistics-cookie
+ (`statistics-cookie
(call-interactively #'org-update-statistics-cookies))
- ((or 'table 'table-cell 'table-row)
+ ((or `table `table-cell `table-row)
;; At a table, recalculate every field and align it. Also
;; send the table if necessary. If the table has
;; a `table.el' type, just give up. At a table row or cell,
(cond (arg (call-interactively #'org-table-recalculate))
((org-table-maybe-recalculate-line))
(t (org-table-align))))))
- ((or 'timestamp (and 'planning (guard (org-at-timestamp-p 'lax))))
+ ((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax))))
(org-timestamp-change 0 'day))
- ((and 'nil (guard (org-at-heading-p)))
+ ((and `nil (guard (org-at-heading-p)))
;; When point is on an unsupported object type, we can miss
;; the fact that it also is at a heading. Handle it here.
(call-interactively #'org-set-tags))
INFO is a plist used as a communication channel."
(pcase (org-element-type element)
;; Elements with an absolute width: `headline' and `inlinetask'.
- ('inlinetask (plist-get info :ascii-inlinetask-width))
- ('headline
+ (`inlinetask (plist-get info :ascii-inlinetask-width))
+ (`headline
(- (plist-get info :ascii-text-width)
(let ((low-level-rank (org-export-low-level-p element info)))
(if low-level-rank (* low-level-rank 2)
(while (and (not justification)
(setq element (org-element-property :parent element)))
(pcase (org-element-type element)
- ('center-block (setq justification 'center))
- ('special-block
+ (`center-block (setq justification 'center))
+ (`special-block
(let ((name (org-element-property :type element)))
(cond ((string= name "JUSTIFYRIGHT") (setq justification 'right))
((string= name "JUSTIFYLEFT") (setq justification 'left)))))))
element info nil 'org-ascii--has-caption-p))
(title-fmt (org-ascii--translate
(pcase (org-element-type element)
- ('table "Table %d:")
- ('src-block "Listing %d:"))
+ (`table "Table %d:")
+ (`src-block "Listing %d:"))
info)))
(org-ascii--fill-string
(concat (format title-fmt reference)
`org-export-resolve-id-link'. INFO is the communication channel,
as a plist."
(pcase (org-element-type datum)
- ('plain-text (format "See file %s" datum)) ;External file
- ('headline
+ (`plain-text (format "See file %s" datum)) ;External file
+ (`headline
(format (org-ascii--translate "See section %s" info)
(if (org-export-numbered-headline-p datum info)
(mapconcat #'number-to-string
(org-element-lineage datum
'(headline paragraph src-block table) t)))
(pcase (org-element-type enumerable)
- ('headline
+ (`headline
(format (org-ascii--translate "See section %s" info)
(if (org-export-numbered-headline-p enumerable info)
(mapconcat #'number-to-string number ".")
(org-element-property :title enumerable) info))))
((guard (not number))
(org-ascii--translate "Unknown reference" info))
- ('paragraph
+ (`paragraph
(format (org-ascii--translate "See figure %s" info) number))
- ('src-block
+ (`src-block
(format (org-ascii--translate "See listing %s" info) number))
- ('table
+ (`table
(format (org-ascii--translate "See table %s" info) number))
(_ (org-ascii--translate "Unknown reference" info)))))))
INFO is a plist used as a communication channel."
(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
(pcase (org-element-property :checkbox item)
- ('on (if utf8p "☑ " "[X] "))
- ('off (if utf8p "☐ " "[ ] "))
- ('trans (if utf8p "☒ " "[-] ")))))
+ (`on (if utf8p "☑ " "[X] "))
+ (`off (if utf8p "☐ " "[ ] "))
+ (`trans (if utf8p "☒ " "[-] ")))))
\f
;; First parent of ITEM is always the plain-list. Get
;; `:type' property from it.
(pcase list-type
- ('descriptive
+ (`descriptive
(concat checkbox
(org-export-data (org-element-property :tag item)
info)))
- ('ordered
+ (`ordered
;; Return correct number for ITEM, paying attention to
;; counters.
(let* ((struct (org-element-property :structure item))
(format " (%s)"
(org-ascii--describe-datum destination info)))))
;; External file.
- ('plain-text destination)
- ('headline
+ (`plain-text destination)
+ (`headline
(if (org-export-numbered-headline-p destination info)
(mapconcat #'number-to-string
(org-export-get-headline-number destination info)
(match-string 1 options)
default)))
(pcase opt
- ('path (setq template
+ (`path (setq template
(replace-regexp-in-string
"%SCRIPT_PATH" val template t t)))
- ('sdepth (when (integerp (read val))
+ (`sdepth (when (integerp (read val))
(setq sdepth (min (read val) sdepth))))
- ('tdepth (when (integerp (read val))
+ (`tdepth (when (integerp (read val))
(setq tdepth (min (read val) tdepth))))
(_ (setq val
(cond
(extra-newline (if (and (org-string-nw-p contents) headline) "\n" "")))
(concat
(pcase type
- ('ordered
+ (`ordered
(let* ((counter term-counter-id)
(extra (if counter (format " value=\"%s\"" counter) "")))
(concat
(format "<li%s%s>" class extra)
(when headline (concat headline br)))))
- ('unordered
+ (`unordered
(let* ((id term-counter-id)
(extra (if id (format " id=\"%s\"" id) "")))
(concat
(format "<li%s%s>" class extra)
(when headline (concat headline br)))))
- ('descriptive
+ (`descriptive
(let* ((term term-counter-id))
(setq term (or term "(no term)"))
;; Check-boxes in descriptive lists are associated to tag.
(and (org-string-nw-p contents) (org-trim contents))
extra-newline
(pcase type
- ('ordered "</li>")
- ('unordered "</li>")
- ('descriptive "</dd>")))))
+ (`ordered "</li>")
+ (`unordered "</li>")
+ (`descriptive "</dd>")))))
(defun org-html-item (item contents info)
"Transcode an ITEM element from Org to HTML.
(cons 'plain-text org-element-all-objects)
(lambda (obj)
(pcase (org-element-type obj)
- ('plain-text (org-string-nw-p obj))
- ('link (if (= link-count 1) t
+ (`plain-text (org-string-nw-p obj))
+ (`link (if (= link-count 1) t
(cl-incf link-count)
(not (org-export-inline-image-p
obj (plist-get info :html-inline-image-rules)))))
(lambda (paragraph) (org-element-property :caption paragraph))"
(let ((paragraph (pcase (org-element-type element)
- ('paragraph element)
- ('link (org-export-get-parent element)))))
+ (`paragraph element)
+ (`link (org-export-get-parent element)))))
(and (eq (org-element-type paragraph) 'paragraph)
(or (not (fboundp 'org-html-standalone-image-predicate))
(funcall org-html-standalone-image-predicate paragraph))
(cons 'plain-text org-element-all-objects)
(lambda (obj)
(when (pcase (org-element-type obj)
- ('plain-text (org-string-nw-p obj))
- ('link (or (> (cl-incf link-count) 1)
+ (`plain-text (org-string-nw-p obj))
+ (`link (or (> (cl-incf link-count) 1)
(not (org-html-inline-image-p obj info))))
(_ t))
(throw 'exit nil)))
(org-export-resolve-id-link link info))))
(pcase (org-element-type destination)
;; ID link points to an external file.
- ('plain-text
+ (`plain-text
(let ((fragment (concat "ID-" path))
;; Treat links to ".org" files as ".html", if needed.
(path (funcall link-org-files-as-html-maybe
(format "<a href=\"%s#%s\"%s>%s</a>"
path fragment attributes (or desc destination))))
;; Fuzzy link points nowhere.
- ('nil
+ (`nil
(format "<i>%s</i>"
(or desc
(org-export-data
(org-element-property :raw-link link) info))))
;; Link points to a headline.
- ('headline
+ (`headline
(let ((href (or (org-element-property :CUSTOM_ID destination)
(org-export-get-reference destination info)))
;; What description to use?
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
(let* ((type (pcase (org-element-property :type plain-list)
- ('ordered "ol")
- ('unordered "ul")
- ('descriptive "dl")
+ (`ordered "ol")
+ (`unordered "ul")
+ (`descriptive "dl")
(other (error "Unknown HTML list type: %s" other))))
(class (format "org-%s" type))
(attributes (org-export-read-attribute :attr_html plain-list)))
nil t))))
;; Return proper string, depending on FLOAT.
(pcase float
- ('wrap (format "\\begin{wrapfigure}%s
+ (`wrap (format "\\begin{wrapfigure}%s
%s%s
%s%s
%s\\end{wrapfigure}"
(if center "\\centering" "")
comment-include image-code
(if caption-above-p "" caption)))
- ('sideways (format "\\begin{sidewaysfigure}
+ (`sideways (format "\\begin{sidewaysfigure}
%s%s
%s%s
%s\\end{sidewaysfigure}"
(if center "\\centering" "")
comment-include image-code
(if caption-above-p "" caption)))
- ('multicolumn (format "\\begin{figure*}%s
+ (`multicolumn (format "\\begin{figure*}%s
%s%s
%s%s
%s\\end{figure*}"
(if center "\\centering" "")
comment-include image-code
(if caption-above-p "" caption)))
- ('figure (format "\\begin{figure}%s
+ (`figure (format "\\begin{figure}%s
%s%s
%s%s
%s\\end{figure}"
;; Non-nil when OBJ can be added to the latex math block B.
(lambda (obj b)
(pcase (org-element-type obj)
- ('entity (org-element-property :latex-math-p obj))
- ('latex-fragment
+ (`entity (org-element-property :latex-math-p obj))
+ (`latex-fragment
(let ((value (org-element-property :value obj)))
(or (string-prefix-p "\\(" value)
(string-match-p "\\`\\$[^$]" value))))
- ((and type (or 'subscript 'superscript))
+ ((and type (or `subscript `superscript))
(not (memq type (mapcar #'org-element-type
(org-element-contents b)))))))))
(org-element-map data '(entity latex-fragment subscript superscript)
(let* ((bullet (org-element-property :bullet item))
(type (org-element-property :type (org-element-property :parent item)))
(checkbox (pcase (org-element-property :checkbox item)
- ('on "\\o'\\(sq\\(mu'")
- ('off "\\(sq ")
- ('trans "\\o'\\(sq\\(mi'")))
+ (`on "\\o'\\(sq\\(mu'")
+ (`off "\\(sq ")
+ (`trans "\\o'\\(sq\\(mi'")))
(tag (let ((tag (org-element-property :tag item)))
;; Check-boxes must belong to the tag.
(push "|" alignment))
(push
(concat (pcase (org-export-table-cell-alignment cell info)
- ('left "l") ('right "r") ('center "c"))
+ (`left "l") (`right "r") (`center "c"))
width
divider)
alignment)
(concat bullet
(make-string (- 4 (length bullet)) ? )
(pcase (org-element-property :checkbox item)
- ('on "[X] ")
- ('trans "[-] ")
- ('off "[ ] "))
+ (`on "[X] ")
+ (`trans "[-] ")
+ (`off "[ ] "))
(let ((tag (org-element-property :tag item)))
(and tag (format "**%s:** "(org-export-data tag info))))
(and contents
(org-export-resolve-fuzzy-link link info)
(org-export-resolve-id-link link info))))
(pcase (org-element-type destination)
- ('plain-text ; External file.
+ (`plain-text ; External file.
(let ((path (funcall link-org-files-as-md destination)))
(if (not contents) (format "<%s>" path)
(format "[%s](%s)" contents path))))
- ('headline
+ (`headline
(format
"[%s](#%s)"
;; Description.
(let ((first-child (car (org-element-contents h)))
(new-section (org-element-create 'section)))
(pcase (org-element-type first-child)
- ('section nil)
- ('nil (org-element-adopt-elements h new-section))
+ (`section nil)
+ (`nil (org-element-adopt-elements h new-section))
(_ (org-element-insert-before new-section first-child))))))
tree)
(project-plist (cdr project))
(publishing-function
(pcase (org-publish-property :publishing-function project)
- ('nil (user-error "No publishing function chosen"))
+ (`nil (user-error "No publishing function chosen"))
((and f (pred listp)) f)
(f (list f))))
(base-dir
(file-name-as-directory
(org-publish-property :base-directory project)))))
(pcase style
- ('list
+ (`list
(cons 'unordered
(mapcar
(lambda (f)
style
project)))
files)))
- ('tree
+ (`tree
(letrec ((files-only (cl-remove-if #'directory-name-p files))
(directories (cl-remove-if-not #'directory-name-p files))
(subtree-to-list
(let ((retval t))
;; First we sort files:
(pcase sort-files
- ('alphabetically
+ (`alphabetically
(let ((A (if (funcall org-file-p a)
(concat (file-name-directory a)
(org-publish-find-title a project))
(if ignore-case
(not (string-lessp (upcase B) (upcase A)))
(not (string-lessp B A))))))
- ((or 'anti-chronologically 'chronologically)
+ ((or `anti-chronologically `chronologically)
(let* ((adate (org-publish-find-date a project))
(bdate (org-publish-find-date b project))
(A (+ (ash (car adate) 16) (cadr adate)))
(if (eq sort-files 'chronologically)
(<= A B)
(>= A B)))))
- ('nil nil)
+ (`nil nil)
(_ (user-error "Invalid sort value %s" sort-files)))
;; Directory-wise wins:
(when (memq sort-folders '(first last))
"[[%s][%s]]"
;; Destination.
(pcase (car target)
- ('nil (format "file:%s" file))
- ('id (format "id:%s" (cdr target)))
- ('custom-id (format "file:%s::#%s" file (cdr target)))
+ (`nil (format "file:%s" file))
+ (`id (format "id:%s" (cdr target)))
+ (`custom-id (format "file:%s::#%s" file (cdr target)))
(_ (format "file:%s::*%s" file (cdr target))))
;; Description.
(car (last entry)))))
INFO is a plist used as a communication channel. See
`org-texinfo-text-markup-alist' for details."
(pcase (cdr (assq markup org-texinfo-text-markup-alist))
- ('nil text) ;no markup: return raw text
- ('code (format "@code{%s}" (org-texinfo--sanitize-content text)))
- ('samp (format "@samp{%s}" (org-texinfo--sanitize-content text)))
- ('verb
+ (`nil text) ;no markup: return raw text
+ (`code (format "@code{%s}" (org-texinfo--sanitize-content text)))
+ (`samp (format "@samp{%s}" (org-texinfo--sanitize-content text)))
+ (`verb
(let ((separator (org-texinfo--find-verb-separator text)))
(format "@verb{%s%s%s}" separator text separator)))
;; Else use format string.
unnumbered)
((org-export-numbered-headline-p headline info) numbered)
(t unnumbered)))
- ('nil 'plain-list)
+ (`nil 'plain-list)
(_ (user-error "Invalid Texinfo class specification: %S" class))))
(_ (user-error "Invalid Texinfo class specification: %S" class)))))))
(list tag))))))
(format "%s\n%s"
(pcase items
- ('nil "@item")
+ (`nil "@item")
(`(,item) (concat "@item " item))
(`(,item . ,items)
(concat "@item " item "\n"
(org-export-resolve-fuzzy-link link info)
(org-export-resolve-id-link link info))))
(pcase (org-element-type destination)
- ('nil
+ (`nil
(format org-texinfo-link-with-unknown-path-format
(org-texinfo--sanitize-content path)))
;; Id link points to an external file.
- ('plain-text
+ (`plain-text
(if desc (format "@uref{file://%s,%s}" destination desc)
(format "@uref{file://%s}" destination)))
- ((or 'headline
+ ((or `headline
;; Targets within headlines cannot be turned into
;; @anchor{}, so we refer to the headline parent
;; directly.
- (and 'target
+ (and `target
(guard (eq 'headline
(org-element-type
(org-element-property :parent destination))))))
(let ((value (org-texinfo-plain-text
(org-timestamp-translate timestamp) info)))
(pcase (org-element-property :type timestamp)
- ((or 'active 'active-range)
+ ((or `active `active-range)
(format (plist-get info :texinfo-active-timestamp-format) value))
- ((or 'inactive 'inactive-range)
+ ((or `inactive `inactive-range)
(format (plist-get info :texinfo-inactive-timestamp-format) value))
(_ (format (plist-get info :texinfo-diary-timestamp-format) value)))))
(progn ,@body)
(org-link-broken
(pcase (plist-get info :with-broken-links)
- ('nil (user-error "Unable to resolve link: %S" (nth 1 err)))
- ('mark (org-export-data
+ (`nil (user-error "Unable to resolve link: %S" (nth 1 err)))
+ (`mark (org-export-data
(format "[BROKEN LINK: %s]" (nth 1 err)) info))
(_ nil))))))
(let* ((type (org-element-type data))
A search cell is the internal representation of a fuzzy link. It
ignores white spaces and statistics cookies, if applicable."
(pcase (org-element-type datum)
- ('headline
+ (`headline
(let ((title (split-string
(replace-regexp-in-string
"\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" ""
(cons 'other title)
(let ((custom-id (org-element-property :custom-id datum)))
(and custom-id (cons 'custom-id custom-id)))))))
- ('target
+ (`target
(list (cons 'target (split-string (org-element-property :value datum)))))
((and (let name (org-element-property :name datum))
(guard name))