update packages
This commit is contained in:
+25
-32
@@ -1,47 +1,40 @@
|
||||
-*- mode: org; fill-column:70 -*-
|
||||
|
||||
This is a distribution of Org, a plain text notes and project planning
|
||||
tool for Emacs.
|
||||
|
||||
The homepage of Org is at:
|
||||
https://orgmode.org
|
||||
Check the [[https://orgmode.org][homepage of Org]] and the [[https://orgmode.org/org.html#Installation][installations instructions]].
|
||||
|
||||
The installations instructions are at:
|
||||
https://orgmode.org/org.html#Installation
|
||||
* Contents of this distribution
|
||||
|
||||
This distribution contains:
|
||||
- README :: This file.
|
||||
|
||||
README
|
||||
This file.
|
||||
- COPYING :: The GNU General Public License.
|
||||
|
||||
COPYING
|
||||
The GNU General Public License.
|
||||
- Makefile :: The makefile to compile and install Org. For installation
|
||||
instructions, see the manual or [[https://orgmode.org/worg/dev/org-build-system.html][the more detailed procedure on Worg]].
|
||||
|
||||
- mk/ :: Files needed for building Org.
|
||||
|
||||
Makefile
|
||||
The makefile to compile and install Org. For installation
|
||||
instructions, see the manual or the more detailed procedure
|
||||
on Worg: https://orgmode.org/worg/dev/org-build-system.html
|
||||
- lisp/ :: Directory with all the Emacs Lisp files that make up Org.
|
||||
|
||||
mk/
|
||||
Files needed for building Org.
|
||||
- doc/ :: The documentation files. org.texi is the source of the
|
||||
documentation, org.html and org.pdf are formatted versions of it.
|
||||
|
||||
lisp/
|
||||
Directory with all the Emacs Lisp files that make up Org.
|
||||
- contrib/ :: A directory with third-party additions for Org. Some
|
||||
really cool stuff is in there.
|
||||
|
||||
doc/
|
||||
The documentation files. org.texi is the source of the
|
||||
documentation, org.html and org.pdf are formatted versions of it.
|
||||
- etc/ :: Files needed for the ODT exporter.
|
||||
|
||||
contrib/
|
||||
A directory with third-party additions for Org. Some really cool
|
||||
stuff is in there.
|
||||
- testing/ :: Testing suite for Org.
|
||||
|
||||
etc/
|
||||
Files needed for the ODT exporter.
|
||||
- request-assign-future.txt :: The form that contributors have to sign
|
||||
and get processed with the FSF before contributed changes can be
|
||||
integrated into the Org core. All files in this distribution except
|
||||
the contrib/ directory have copyright assigned to the FSF.
|
||||
|
||||
testing/
|
||||
Testing suite for Org.
|
||||
* License
|
||||
|
||||
request-assign-future.txt
|
||||
The form that contributors have to sign and get processed with
|
||||
the FSF before contributed changes can be integrated into the Org
|
||||
core. All files in this distribution except the contrib/ directory
|
||||
have copyright assigned to the FSF.
|
||||
Org-mode is published under [[https://www.gnu.org/licenses/gpl-3.0.html][the GNU GPLv3 license]] or any later
|
||||
version, the same as GNU Emacs. See the COPYING file in this
|
||||
directory.
|
||||
|
||||
@@ -21,6 +21,16 @@
|
||||
"org-mode blocks for PHP."
|
||||
:group 'org)
|
||||
|
||||
(defcustom org-babel-php-command "php"
|
||||
"The command to execute babel body code."
|
||||
:group 'ob-php
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-babel-php-command-options nil
|
||||
"The php command options to use when execute code."
|
||||
:group 'ob-php
|
||||
:type 'string)
|
||||
|
||||
(defcustom ob-php:inf-php-buffer "*php*"
|
||||
"Default PHP inferior buffer."
|
||||
:group 'ob-php
|
||||
@@ -29,13 +39,12 @@
|
||||
;;;###autoload
|
||||
(defun org-babel-execute:php (body params)
|
||||
"Orgmode Babel PHP evaluate function for `BODY' with `PARAMS'."
|
||||
(let* ((cmd "php")
|
||||
(let* ((cmd (concat org-babel-php-command " " org-babel-php-command-options))
|
||||
(body (concat "<?php\n" body "\n?>")))
|
||||
(org-babel-eval cmd body)
|
||||
))
|
||||
(org-babel-eval cmd body)))
|
||||
|
||||
;;;###autoload
|
||||
(eval-after-load "org"
|
||||
(eval-after-load 'org
|
||||
'(add-to-list 'org-src-lang-modes '("php" . php)))
|
||||
|
||||
(defvar org-babel-default-header-args:php '())
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
(eval-after-load "org"
|
||||
(eval-after-load 'org
|
||||
'(add-to-list 'org-src-lang-modes '("redis" . redis)))
|
||||
|
||||
(provide 'ob-redis)
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
;; TODO: temporary can't find way to let sclang output to stdout for org-babel.
|
||||
(:output . "none")))
|
||||
|
||||
(eval-after-load "org"
|
||||
(eval-after-load 'org
|
||||
'(progn
|
||||
(add-to-list 'org-src-lang-modes '("sclang" . sclang))))
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Otherwise prompt the user for the right bookmark to use."
|
||||
:follow #'org-bookmark-open
|
||||
:store #'org-bookmark-store-link)
|
||||
|
||||
(defun org-bookmark-open (bookmark)
|
||||
(defun org-bookmark-open (bookmark _)
|
||||
"Visit the bookmark BOOKMARK."
|
||||
(bookmark-jump bookmark))
|
||||
|
||||
|
||||
@@ -82,12 +82,8 @@
|
||||
:follow #'org-elisp-symbol-open
|
||||
:store #'org-elisp-symbol-store-link)
|
||||
|
||||
(defun org-elisp-symbol-open (path)
|
||||
"Visit the emacs-lisp elisp-symbol at PATH."
|
||||
(let* ((search (when (string-match "::\\(.+\\)\\'" path)
|
||||
(match-string 1 path)))
|
||||
(path (substring path 0 (match-beginning 0))))
|
||||
(org-open-file path t nil search)))
|
||||
(defun org-elisp-symbol-open (symbol arg)
|
||||
(org-link-open-as-file symbol arg))
|
||||
|
||||
(defun org-elisp-symbol-store-link ()
|
||||
"Store a link to an emacs-lisp elisp-symbol."
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
;; bare git link
|
||||
(org-link-set-parameters "gitbare" :follow #'org-gitbare-open)
|
||||
|
||||
(defun org-gitbare-open (str)
|
||||
(defun org-gitbare-open (str _)
|
||||
(let* ((strlist (org-git-split-string str))
|
||||
(gitdir (nth 0 strlist))
|
||||
(object (nth 1 strlist)))
|
||||
@@ -96,7 +96,7 @@
|
||||
;; user friendly link
|
||||
(org-link-set-parameters "git" :follow #'org-git-open :store #'org-git-store-link)
|
||||
|
||||
(defun org-git-open (str)
|
||||
(defun org-git-open (str _)
|
||||
(let* ((strlist (org-git-split-string str))
|
||||
(filepath (nth 0 strlist))
|
||||
(commit (nth 1 strlist))
|
||||
|
||||
@@ -35,10 +35,19 @@
|
||||
:group 'org-link
|
||||
:type '(choice (const man) (const woman)))
|
||||
|
||||
(defun org-man-open (path)
|
||||
(defun org-man-open (path _)
|
||||
"Visit the manpage on PATH.
|
||||
PATH should be a topic that can be thrown at the man command."
|
||||
(funcall org-man-command path))
|
||||
PATH should be a topic that can be thrown at the man command.
|
||||
If PATH contains extra ::STRING which will use `occur' to search
|
||||
matched strings in man buffer."
|
||||
(string-match "\\(.*?\\)\\(?:::\\(.*\\)\\)?$" path)
|
||||
(let* ((command (match-string 1 path))
|
||||
(search (match-string 2 path)))
|
||||
(funcall org-man-command command)
|
||||
(when search
|
||||
(with-current-buffer (concat "*Man " command "*")
|
||||
(goto-char (point-min))
|
||||
(search-forward search)))))
|
||||
|
||||
(defun org-man-store-link ()
|
||||
"Store a link to a README file."
|
||||
@@ -68,6 +77,7 @@ PATH should be a topic that can be thrown at the man command."
|
||||
((eq format 'latex) (format "\\href{%s}{%s}" path desc))
|
||||
((eq format 'texinfo) (format "@uref{%s,%s}" path desc))
|
||||
((eq format 'ascii) (format "%s (%s)" desc path))
|
||||
((eq format 'md) (format "[%s](%s)" desc path))
|
||||
(t path))))
|
||||
|
||||
(provide 'ol-man)
|
||||
|
||||
@@ -191,7 +191,7 @@ with \"t\" key."
|
||||
(let ((folder-or-path (mew-summary-folder-name)))
|
||||
(mew-folder-path-to-folder folder-or-path t))))))
|
||||
|
||||
(defun org-mew-open (path)
|
||||
(defun org-mew-open (path _)
|
||||
"Follow the Mew message link specified by PATH."
|
||||
(let (folder message-id)
|
||||
(cond ((string-match "\\`\\(+.*\\)+\\+\\([0-9]+\\)\\'" path) ; for Bastien's
|
||||
|
||||
@@ -86,7 +86,7 @@ Should accept a notmuch search string as the sole argument."
|
||||
(org-link-add-props :link link :description desc)
|
||||
link)))
|
||||
|
||||
(defun org-notmuch-open (path)
|
||||
(defun org-notmuch-open (path _)
|
||||
"Follow a notmuch message link specified by PATH."
|
||||
(funcall org-notmuch-open-function path))
|
||||
|
||||
@@ -113,7 +113,7 @@ Can link to more than one message, if so all matching messages are shown."
|
||||
:description desc)
|
||||
link)))
|
||||
|
||||
(defun org-notmuch-search-open (path)
|
||||
(defun org-notmuch-search-open (path _)
|
||||
"Follow a notmuch message link specified by PATH."
|
||||
(message "%s" path)
|
||||
(org-notmuch-search-follow-link path))
|
||||
@@ -139,7 +139,7 @@ Can link to more than one message, if so all matching messages are shown."
|
||||
:description desc)
|
||||
link)))
|
||||
|
||||
(defun org-notmuch-tree-open (path)
|
||||
(defun org-notmuch-tree-open (path _)
|
||||
"Follow a notmuch message link specified by PATH."
|
||||
(message "%s" path)
|
||||
(org-notmuch-tree-follow-link path))
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
(org-add-link-props :link link :description desc)
|
||||
link))))
|
||||
|
||||
(defun org-vm-open (path)
|
||||
(defun org-vm-open (path _)
|
||||
"Follow a VM message link specified by PATH."
|
||||
(let (folder article)
|
||||
(if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
|
||||
@@ -127,7 +127,7 @@
|
||||
(when article
|
||||
(org-vm-select-message (org-link-add-angle-brackets article)))))
|
||||
|
||||
(defun org-vm-imap-open (path)
|
||||
(defun org-vm-imap-open (path _)
|
||||
"Follow a VM link to an IMAP folder."
|
||||
(require 'vm-imap)
|
||||
(when (string-match "\\([^:]+\\):\\([^#]+\\)#?\\(.+\\)?" path)
|
||||
|
||||
@@ -104,9 +104,10 @@ googlegroups otherwise."
|
||||
(defvar elmo-nntp-default-server)
|
||||
|
||||
(defconst org-wl-folder-types
|
||||
'(("%" . imap) ("-" . nntp) ("+" . mh) ("=" . spool)
|
||||
("$" . archive) ("&" . pop) ("@" . shimbun) ("[" . search)
|
||||
("*" . multi) ("/" . filter) ("|" . pipe) ("'" . internal))
|
||||
'(("%" . imap) ("-" . nntp) ("+" . mh) ("." . maildir)
|
||||
("=" . spool) ("$" . archive) ("&" . pop) ("@" . shimbun)
|
||||
("rss" . rss) ("[" . search) ("*" . multi) ("/" . filter)
|
||||
("|" . pipe) ("'" . internal) )
|
||||
"List of folder indicators. See Wanderlust manual, section 3.")
|
||||
|
||||
;; Install the link type
|
||||
@@ -255,7 +256,7 @@ ENTITY is a message entity."
|
||||
(concat "@" (or (cdr server) (car server))))
|
||||
(if article (concat "#" article) "")))))
|
||||
|
||||
(defun org-wl-open (path)
|
||||
(defun org-wl-open (path &rest _)
|
||||
"Follow the WL message link specified by PATH.
|
||||
When called with one prefix, open message in namazu search folder
|
||||
with `org-wl-namazu-default-index' as search index. When called
|
||||
|
||||
@@ -479,7 +479,7 @@ NEW-MARK and OLD-MARK are the text of the new and old marks."
|
||||
|
||||
;;; Setting it all up
|
||||
|
||||
(eval-after-load "org"
|
||||
(eval-after-load 'org
|
||||
'(progn
|
||||
(add-to-list 'org-todo-setup-filter-hook
|
||||
#'org-choose-setup-filter)
|
||||
|
||||
@@ -210,7 +210,7 @@ This does two different kinds of triggers:
|
||||
(pos (plist-get change-plist :position))
|
||||
(from (plist-get change-plist :from))
|
||||
(to (plist-get change-plist :to))
|
||||
(org-log-done nil) ; IMPROTANT!: no logging during automatic trigger!
|
||||
(org-log-done nil) ; IMPORTANT!: no logging during automatic trigger!
|
||||
trigger triggers tr p1 p2 kwd id)
|
||||
(catch 'return
|
||||
(unless (eq type 'todo-state-change)
|
||||
@@ -367,7 +367,7 @@ this ID property, that entry is also checked."
|
||||
(pos (plist-get change-plist :position))
|
||||
(from (plist-get change-plist :from))
|
||||
(to (plist-get change-plist :to))
|
||||
(org-log-done nil) ; IMPROTANT!: no logging during automatic trigger
|
||||
(org-log-done nil) ; IMPORTANT!: no logging during automatic trigger
|
||||
blocker blockers bl p1 p2
|
||||
(proceed-p
|
||||
(catch 'return
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;;; org-eldoc.el --- display org header and src block info using eldoc
|
||||
;;; org-eldoc.el --- display org header and src block info using eldoc -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (c) 2014-2020 Free Software Foundation, Inc.
|
||||
|
||||
@@ -114,11 +114,18 @@
|
||||
doc-func)
|
||||
(if (eq 'empty cached-func)
|
||||
(when (fboundp mode-func)
|
||||
(with-temp-buffer
|
||||
(funcall mode-func)
|
||||
(setq doc-func (and eldoc-documentation-function
|
||||
(symbol-value 'eldoc-documentation-function)))
|
||||
(puthash lang doc-func org-eldoc-local-functions-cache))
|
||||
(with-temp-buffer
|
||||
(funcall mode-func)
|
||||
(setq doc-func (if (boundp 'eldoc-documentation-functions)
|
||||
(let ((doc-funs eldoc-documentation-functions))
|
||||
(lambda (callback)
|
||||
(let ((eldoc-documentation-functions doc-funs))
|
||||
(run-hook-with-args-until-success
|
||||
'eldoc-documentation-functions
|
||||
callback))))
|
||||
(and eldoc-documentation-function
|
||||
(symbol-value 'eldoc-documentation-function))))
|
||||
(puthash lang doc-func org-eldoc-local-functions-cache))
|
||||
doc-func)
|
||||
cached-func)))
|
||||
|
||||
@@ -127,7 +134,7 @@
|
||||
(declare-function php-eldoc-function "php-eldoc" ())
|
||||
(declare-function go-eldoc--documentation-function "go-eldoc" ())
|
||||
|
||||
(defun org-eldoc-documentation-function ()
|
||||
(defun org-eldoc-documentation-function (&rest args)
|
||||
"Return breadcrumbs when on a headline, args for src block header-line,
|
||||
calls other documentation functions depending on lang when inside src body."
|
||||
(or
|
||||
@@ -136,10 +143,16 @@
|
||||
(let ((lang (org-eldoc-get-src-lang)))
|
||||
(cond ((or
|
||||
(string= lang "emacs-lisp")
|
||||
(string= lang "elisp")) (if (fboundp 'elisp-eldoc-documentation-function)
|
||||
(elisp-eldoc-documentation-function)
|
||||
(let (eldoc-documentation-function)
|
||||
(eldoc-print-current-symbol-info))))
|
||||
(string= lang "elisp"))
|
||||
(cond ((boundp 'eldoc-documentation-functions) ; Emacs>=28
|
||||
(let ((eldoc-documentation-functions
|
||||
'(elisp-eldoc-var-docstring elisp-eldoc-funcall)))
|
||||
(eldoc-print-current-symbol-info)))
|
||||
((fboundp 'elisp-eldoc-documentation-function)
|
||||
(elisp-eldoc-documentation-function))
|
||||
(t ; Emacs<25
|
||||
(let (eldoc-documentation-function)
|
||||
(eldoc-print-current-symbol-info)))))
|
||||
((or
|
||||
(string= lang "c") ;; http://github.com/nflath/c-eldoc
|
||||
(string= lang "C")) (when (require 'c-eldoc nil t)
|
||||
@@ -154,14 +167,29 @@
|
||||
(string= lang "go")
|
||||
(string= lang "golang")) (when (require 'go-eldoc nil t)
|
||||
(go-eldoc--documentation-function)))
|
||||
(t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang)))
|
||||
(when (functionp doc-fun) (funcall doc-fun))))))))
|
||||
(t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))
|
||||
(callback (car args)))
|
||||
(when (functionp doc-fun)
|
||||
(if (functionp callback)
|
||||
(funcall doc-fun callback)
|
||||
(funcall doc-fun)))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-eldoc-load ()
|
||||
"Set up org-eldoc documentation function."
|
||||
(interactive)
|
||||
(setq-local eldoc-documentation-function #'org-eldoc-documentation-function))
|
||||
;; This approach is taken from python.el.
|
||||
(with-no-warnings
|
||||
(cond
|
||||
((null eldoc-documentation-function) ; Emacs<25
|
||||
(setq-local eldoc-documentation-function
|
||||
#'org-eldoc-documentation-function))
|
||||
((boundp 'eldoc-documentation-functions) ; Emacs>=28
|
||||
(add-hook 'eldoc-documentation-functions
|
||||
#'org-eldoc-documentation-function nil t))
|
||||
(t
|
||||
(add-function :before-until (local 'eldoc-documentation-function)
|
||||
#'org-eldoc-documentation-function)))))
|
||||
|
||||
;;;###autoload
|
||||
(add-hook 'org-mode-hook #'org-eldoc-load)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
;;; org-link-edit.el --- Slurp and barf with Org links -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2015-2017 Kyle Meyer <kyle@kyleam.com>
|
||||
;; Copyright (C) 2015-2020 Kyle Meyer <kyle@kyleam.com>
|
||||
|
||||
;; Author: Kyle Meyer <kyle@kyleam.com>
|
||||
;; URL: https://gitlab.com/kyleam/org-link-edit
|
||||
;; URL: https://git.kyleam.com/org-link-edit/about
|
||||
;; Keywords: convenience
|
||||
;; Version: 1.1.1
|
||||
;; Package-Requires: ((cl-lib "0.5") (org "8.2.10"))
|
||||
;; Version: 1.2.1
|
||||
;; Package-Requires: ((cl-lib "0.5") (org "9.3"))
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
@@ -19,7 +19,7 @@
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@@ -67,12 +67,7 @@
|
||||
(require 'cl-lib)
|
||||
|
||||
(defun org-link-edit--on-link-p (&optional element)
|
||||
(let ((el (or element (org-element-context))))
|
||||
;; Don't use `org-element-lineage' because it isn't available
|
||||
;; until Org version 8.3.
|
||||
(while (and el (not (memq (car el) '(link))))
|
||||
(setq el (org-element-property :parent el)))
|
||||
(eq (car el) 'link)))
|
||||
(org-element-lineage (or element (org-element-context)) '(link) t))
|
||||
|
||||
(defun org-link-edit--link-data ()
|
||||
"Return list with information about the link at point.
|
||||
@@ -90,13 +85,13 @@ The list includes
|
||||
;; Use match-{beginning,end} because match-end is consistently
|
||||
;; positioned after ]], while the :end property is positioned
|
||||
;; at the next word on the line, if one is present.
|
||||
((looking-at org-bracket-link-regexp)
|
||||
((looking-at org-link-bracket-re)
|
||||
(list (match-beginning 0)
|
||||
(match-end 0)
|
||||
(save-match-data
|
||||
(org-link-unescape (match-string-no-properties 1)))
|
||||
(or (match-string-no-properties 2) "")))
|
||||
((looking-at org-plain-link-re)
|
||||
((looking-at org-link-plain-re)
|
||||
(list (match-beginning 0)
|
||||
(match-end 0)
|
||||
(match-string-no-properties 0)
|
||||
@@ -170,7 +165,7 @@ If N is negative, slurp leading blobs instead of trailing blobs."
|
||||
(setq desc (concat desc slurped)
|
||||
end (+ end (length slurped)))
|
||||
(delete-region beg (point))
|
||||
(insert (org-make-link-string link desc))
|
||||
(insert (org-link-make-string link desc))
|
||||
(goto-char beg)
|
||||
slurped)))))
|
||||
|
||||
@@ -212,7 +207,7 @@ If N is negative, slurp trailing blobs instead of leading blobs."
|
||||
(setq desc (concat slurped desc)
|
||||
beg (- beg (length slurped)))
|
||||
(delete-region (point) end)
|
||||
(insert (org-make-link-string link desc))
|
||||
(insert (org-link-make-string link desc))
|
||||
(goto-char beg)
|
||||
slurped)))))
|
||||
|
||||
@@ -282,7 +277,7 @@ If N is negative, barf leading blobs instead of trailing blobs."
|
||||
(unless new-desc (user-error "Not enough blobs in description"))
|
||||
(goto-char beg)
|
||||
(delete-region beg end)
|
||||
(insert (org-make-link-string link new-desc))
|
||||
(insert (org-link-make-string link new-desc))
|
||||
(when (string= new-desc "")
|
||||
(setq barfed (concat " " barfed)))
|
||||
(insert barfed)
|
||||
@@ -321,7 +316,7 @@ If N is negative, barf trailing blobs instead of leading blobs."
|
||||
(unless new-desc (user-error "Not enough blobs in description"))
|
||||
(goto-char beg)
|
||||
(delete-region beg end)
|
||||
(insert (org-make-link-string link new-desc))
|
||||
(insert (org-link-make-string link new-desc))
|
||||
(when (string= new-desc "")
|
||||
(setq barfed (concat barfed " ")))
|
||||
(goto-char beg)
|
||||
@@ -331,12 +326,12 @@ If N is negative, barf trailing blobs instead of leading blobs."
|
||||
(defun org-link-edit--next-link-data (&optional previous)
|
||||
(save-excursion
|
||||
(if (funcall (if previous #'re-search-backward #'re-search-forward)
|
||||
org-any-link-re nil t)
|
||||
org-link-any-re nil t)
|
||||
(org-link-edit--link-data)
|
||||
(user-error "No %s link found" (if previous "previous" "next")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-link-edit-transport-next-link (&optional previous beg end)
|
||||
(defun org-link-edit-transport-next-link (&optional previous beg end overwrite)
|
||||
"Move the next link to point.
|
||||
|
||||
If the region is active, use the selected text as the link's
|
||||
@@ -346,11 +341,16 @@ With prefix argument PREVIOUS, move the previous link instead of
|
||||
the next link.
|
||||
|
||||
Non-interactively, use the text between BEG and END as the
|
||||
description, moving the next (or previous) link relative BEG and
|
||||
END."
|
||||
(interactive (cons current-prefix-arg
|
||||
(and (use-region-p)
|
||||
(list (region-beginning) (region-end)))))
|
||||
description, moving the next (or previous) link relative to BEG
|
||||
and END. By default, refuse to overwrite an existing
|
||||
description. If OVERWRITE is `ask', prompt for confirmation
|
||||
before overwriting; for any other non-nil value, overwrite
|
||||
without asking."
|
||||
(interactive `(,current-prefix-arg
|
||||
,@(if (use-region-p)
|
||||
(list (region-beginning) (region-end))
|
||||
(list nil nil))
|
||||
ask))
|
||||
(let ((pt (point))
|
||||
(desc-bounds (cond
|
||||
((and beg end)
|
||||
@@ -374,10 +374,14 @@ END."
|
||||
(goto-char (or (car desc-bounds) pt))
|
||||
(cl-multiple-value-bind (link-beg link-end link orig-desc)
|
||||
(org-link-edit--next-link-data previous)
|
||||
(unless (or (not desc-bounds) (= (length orig-desc) 0))
|
||||
(unless (or (not desc-bounds)
|
||||
(= (length orig-desc) 0)
|
||||
(if (eq overwrite 'ask)
|
||||
(y-or-n-p "Overwrite existing description?")
|
||||
overwrite))
|
||||
(user-error "Link already has a description"))
|
||||
(delete-region link-beg link-end)
|
||||
(insert (org-make-link-string
|
||||
(insert (org-link-make-string
|
||||
link
|
||||
(if desc-bounds
|
||||
(delete-and-extract-region (car desc-bounds)
|
||||
|
||||
@@ -494,7 +494,7 @@ The links are of the form <link>::split::<name>."
|
||||
;; Handle links from together.app
|
||||
(org-link-set-parameters "x-together-item" :follow #'org-mac-together-item-open)
|
||||
|
||||
(defun org-mac-together-item-open (uid)
|
||||
(defun org-mac-together-item-open (uid _)
|
||||
"Open UID, which is a reference to an item in Together."
|
||||
(shell-command (concat "open -a Together \"x-together-item:" uid "\"")))
|
||||
|
||||
@@ -553,7 +553,7 @@ The links are of the form <link>::split::<name>."
|
||||
;; Handle links from AddressBook.app
|
||||
(org-link-set-parameters "addressbook" :follow #'org-mac-addressbook-item-open)
|
||||
|
||||
(defun org-mac-addressbook-item-open (uid)
|
||||
(defun org-mac-addressbook-item-open (uid _)
|
||||
"Open UID, which is a reference to an item in the addressbook."
|
||||
(shell-command (concat "open \"addressbook:" uid "\"")))
|
||||
|
||||
@@ -588,7 +588,7 @@ The links are of the form <link>::split::<name>."
|
||||
|
||||
(org-link-set-parameters "skim" :follow #'org-mac-skim-open)
|
||||
|
||||
(defun org-mac-skim-open (uri)
|
||||
(defun org-mac-skim-open (uri _)
|
||||
"Visit page of pdf in Skim"
|
||||
(let* ((page (when (string-match "::\\(.+\\)\\'" uri)
|
||||
(match-string 1 uri)))
|
||||
@@ -647,7 +647,7 @@ The links are of the form <link>::split::<name>."
|
||||
|
||||
(org-link-set-parameters "acrobat" :follow #'org-mac-acrobat-open)
|
||||
|
||||
(defun org-mac-acrobat-open (uri)
|
||||
(defun org-mac-acrobat-open (uri _)
|
||||
"Visit page of pdf in Acrobat"
|
||||
(let* ((page (when (string-match "::\\(.+\\)\\'" uri)
|
||||
(match-string 1 uri)))
|
||||
@@ -697,7 +697,7 @@ The links are of the form <link>::split::<name>."
|
||||
|
||||
(org-link-set-parameters "mac-outlook" :follow #'org-mac-outlook-message-open)
|
||||
|
||||
(defun org-mac-outlook-message-open (msgid)
|
||||
(defun org-mac-outlook-message-open (msgid _)
|
||||
"Open a message in Outlook"
|
||||
(do-applescript
|
||||
(concat
|
||||
@@ -809,7 +809,7 @@ after heading."
|
||||
|
||||
(org-link-set-parameters "mac-evernote" :follow #'org-mac-evernote-note-open)
|
||||
|
||||
(defun org-mac-evernote-note-open (noteid)
|
||||
(defun org-mac-evernote-note-open (noteid _)
|
||||
"Open a note in Evernote"
|
||||
(do-applescript
|
||||
(concat
|
||||
@@ -860,7 +860,7 @@ note(s) in Evernote.app and make a link out of it/them."
|
||||
|
||||
(org-link-set-parameters "x-devonthink-item" :follow #'org-devonthink-item-open)
|
||||
|
||||
(defun org-devonthink-item-open (uid)
|
||||
(defun org-devonthink-item-open (uid _)
|
||||
"Open UID, which is a reference to an item in DEVONthink Pro Office."
|
||||
(shell-command (concat "open \"x-devonthink-item:" uid "\"")))
|
||||
|
||||
@@ -908,11 +908,11 @@ selected items in DEVONthink Pro Office and make link(s) out of it/them."
|
||||
|
||||
(org-link-set-parameters "message" :follow #'org-mac-message-open)
|
||||
|
||||
(defun org-mac-message-open (message-id)
|
||||
(defun org-mac-message-open (message-id _)
|
||||
"Visit the message with MESSAGE-ID.
|
||||
This will use the command `open' with the message URL."
|
||||
(start-process (concat "open message:" message-id) nil
|
||||
"open" (concat "message://<" (substring message-id 2) ">")))
|
||||
"open" (concat "message://%3C" (substring message-id 2) "%3E")))
|
||||
|
||||
(defun org-as-get-selected-mail ()
|
||||
"AppleScript to create links to selected messages in Mail.app."
|
||||
|
||||
@@ -139,7 +139,7 @@ the buffer just like 'message-send-and-exit' does."
|
||||
(cons (list link desc) org-stored-links)))
|
||||
(message-bury (current-buffer)))
|
||||
|
||||
(defun org-mairix-open (search)
|
||||
(defun org-mairix-open (search _)
|
||||
"Function to open mairix link.
|
||||
|
||||
We first need to split it into its individual parts, and then
|
||||
@@ -186,7 +186,7 @@ applications in order to mimic `org-store-link'. Used by
|
||||
:type 'string)
|
||||
|
||||
;; When we resolve some of the issues with `org-store-link' detailed
|
||||
;; at <http://thread.gmane.org/gmane.emacs.orgmode/4217/focus=4635>,
|
||||
;; at <https://orgmode.org/list/20071105181739.GB13544@atlantic.linksys.moosehall
|
||||
;; we might not need org-mairix-insert-link.
|
||||
|
||||
(defun org-mairix-insert-link ()
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
(require 'org-element)
|
||||
|
||||
(declare-function appt-delete-window "appt" ())
|
||||
@@ -74,6 +74,11 @@
|
||||
:type 'boolean
|
||||
:group 'org-notify)
|
||||
|
||||
(defcustom org-notify-max-notifications-per-run 3
|
||||
"Maximum number of notifications per run of `org-notify-process'."
|
||||
:type 'integer
|
||||
:group 'org-notify)
|
||||
|
||||
(defconst org-notify-actions
|
||||
'("show" "show" "done" "done" "hour" "one hour later" "day" "one day later"
|
||||
"week" "one week later")
|
||||
@@ -155,36 +160,40 @@ PERIOD."
|
||||
(message "Warning: notification for \"%s\" behind schedule!" heading))
|
||||
t)
|
||||
|
||||
(defun org-notify-process ()
|
||||
(cl-defun org-notify-process ()
|
||||
"Process the todo-list, and possibly notify user about upcoming or
|
||||
forgotten tasks."
|
||||
(cl-macrolet ((prm (k) `(plist-get prms ,k)) (td (k) `(plist-get todo ,k)))
|
||||
(dolist (todo (org-notify-todo-list))
|
||||
(let* ((deadline (td :deadline)) (heading (td :heading))
|
||||
(uid (td :uid)) (last-run-sym
|
||||
(intern (concat ":last-run-" uid))))
|
||||
(dolist (prms (plist-get org-notify-map (td :notify)))
|
||||
(when (< deadline (org-notify-string->seconds (prm :time)))
|
||||
(let ((period (org-notify-string->seconds (prm :period)))
|
||||
(last-run (prm last-run-sym)) (now (float-time))
|
||||
(actions (prm :actions)) diff plist)
|
||||
(when (or (not last-run)
|
||||
(and period (< period (setq diff (- now last-run)))
|
||||
(org-notify-maybe-too-late diff period heading)))
|
||||
(setq prms (plist-put prms last-run-sym now)
|
||||
plist (append todo prms))
|
||||
(if (if (plist-member prms :audible)
|
||||
(prm :audible)
|
||||
org-notify-audible)
|
||||
(ding))
|
||||
(unless (listp actions)
|
||||
(setq actions (list actions)))
|
||||
(dolist (action actions)
|
||||
(funcall (if (fboundp action) action
|
||||
(intern (concat "org-notify-action"
|
||||
(symbol-name action))))
|
||||
plist))))
|
||||
(return)))))))
|
||||
(let ((notification-cnt 0))
|
||||
(cl-macrolet ((prm (k) `(plist-get prms ,k)) (td (k) `(plist-get todo ,k)))
|
||||
(dolist (todo (org-notify-todo-list))
|
||||
(let* ((deadline (td :deadline)) (heading (td :heading))
|
||||
(uid (td :uid)) (last-run-sym
|
||||
(intern (concat ":last-run-" uid))))
|
||||
(cl-dolist (prms (plist-get org-notify-map (td :notify)))
|
||||
(when (< deadline (org-notify-string->seconds (prm :time)))
|
||||
(let ((period (org-notify-string->seconds (prm :period)))
|
||||
(last-run (prm last-run-sym)) (now (float-time))
|
||||
(actions (prm :actions)) diff plist)
|
||||
(when (or (not last-run)
|
||||
(and period (< period (setq diff (- now last-run)))
|
||||
(org-notify-maybe-too-late diff period heading)))
|
||||
(setq prms (plist-put prms last-run-sym now)
|
||||
plist (append todo prms))
|
||||
(if (if (plist-member prms :audible)
|
||||
(prm :audible)
|
||||
org-notify-audible)
|
||||
(ding))
|
||||
(unless (listp actions)
|
||||
(setq actions (list actions)))
|
||||
(cl-incf notification-cnt)
|
||||
(dolist (action actions)
|
||||
(funcall (if (fboundp action) action
|
||||
(intern (concat "org-notify-action"
|
||||
(symbol-name action))))
|
||||
plist))
|
||||
(when (>= notification-cnt org-notify-max-notifications-per-run)
|
||||
(cl-return-from org-notify-process)))
|
||||
(cl-return)))))))))
|
||||
|
||||
(defun org-notify-add (name &rest params)
|
||||
"Add a new notification type.
|
||||
|
||||
@@ -154,7 +154,8 @@ to `org-bibtex-citation-p' predicate."
|
||||
|
||||
;;; Follow cite: links
|
||||
|
||||
(defun org-bibtex-file nil "Org-mode file of bibtex entries.")
|
||||
(defvar org-bibtex-file nil
|
||||
"Org file of BibTeX entries.")
|
||||
|
||||
(defun org-bibtex-goto-citation (&optional citation)
|
||||
"Visit a citation given its ID."
|
||||
@@ -162,13 +163,11 @@ to `org-bibtex-citation-p' predicate."
|
||||
(let ((citation (or citation (completing-read "Citation: " (obe-citations)))))
|
||||
(find-file (or org-bibtex-file
|
||||
(error "`org-bibtex-file' has not been configured")))
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward (format " :CUSTOM_ID: %s" citation) nil t)
|
||||
(outline-previous-visible-heading 1)
|
||||
t)))
|
||||
(let ((position (org-find-property "CUSTOM_ID" citation)))
|
||||
(and position (progn (goto-char position) t)))))
|
||||
|
||||
(let ((jump-fn (car (cl-remove-if-not #'fboundp '(ebib org-bibtex-goto-citation)))))
|
||||
(org-add-link-type "cite" jump-fn))
|
||||
(org-add-link-type "cite-bt" jump-fn))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,10 @@
|
||||
(template . org-confluence-template)
|
||||
(timestamp . org-confluence-timestamp)
|
||||
(underline . org-confluence-underline)
|
||||
(verbatim . org-confluence-verbatim)))
|
||||
(verbatim . org-confluence-verbatim))
|
||||
:menu-entry
|
||||
'(?f "Export to Confluence"
|
||||
((?f "As Confluence buffer" org-confluence-export-as-confluence))))
|
||||
|
||||
(defcustom org-confluence-lang-alist
|
||||
'(("sh" . "bash"))
|
||||
@@ -125,15 +128,17 @@
|
||||
(if (org-string-nw-p contents) contents ""))))
|
||||
|
||||
(defun org-confluence-link (link desc info)
|
||||
(let ((raw-link (org-element-property :raw-link link)))
|
||||
(concat "["
|
||||
(when (org-string-nw-p desc) (format "%s|" desc))
|
||||
(cond
|
||||
((string-match "^confluence:" raw-link)
|
||||
(replace-regexp-in-string "^confluence:" "" raw-link))
|
||||
(t
|
||||
raw-link))
|
||||
"]")))
|
||||
(if (string= "radio" (org-element-property :type link))
|
||||
desc
|
||||
(let ((raw-link (org-element-property :raw-link link)))
|
||||
(concat "["
|
||||
(when (org-string-nw-p desc) (format "%s|" desc))
|
||||
(cond
|
||||
((string-match "^confluence:" raw-link)
|
||||
(replace-regexp-in-string "^confluence:" "" raw-link))
|
||||
(t
|
||||
raw-link))
|
||||
"]"))))
|
||||
|
||||
(defun org-confluence-paragraph (paragraph contents info)
|
||||
"Transcode PARAGRAPH element for Confluence.
|
||||
|
||||
@@ -1248,7 +1248,7 @@ INFO is a plist holding contextual information. See
|
||||
((string= type "file") (org-export-file-uri raw-path))
|
||||
(t raw-path))))
|
||||
(cond
|
||||
((org-export-custom-protocol-maybe link desc 'groff))
|
||||
((org-export-custom-protocol-maybe link desc 'groff info))
|
||||
;; Image file.
|
||||
(imagep (org-groff-link--inline-image link info))
|
||||
;; import groff files
|
||||
|
||||
@@ -483,10 +483,6 @@ e.g. \"title-subject:t\"."
|
||||
(defvar org-koma-letter-special-contents nil
|
||||
"Holds special content temporarily.")
|
||||
|
||||
(make-obsolete-variable 'org-koma-letter-use-title
|
||||
'org-export-with-title
|
||||
"25.1" 'set)
|
||||
|
||||
|
||||
;;; Define Back-End
|
||||
|
||||
@@ -748,7 +744,8 @@ holding export options."
|
||||
(if (symbolp with-subject) with-subject
|
||||
(mapconcat #'symbol-name with-subject ","))))
|
||||
;; Hyperref.
|
||||
(format-spec hyperref-template spec)
|
||||
(and (stringp hyperref-template)
|
||||
(format-spec hyperref-template spec))
|
||||
;; Document start.
|
||||
"\\begin{document}\n\n"
|
||||
;; Subject and title.
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
;; :END:
|
||||
;;
|
||||
;;;; * TODO
|
||||
;; - Look at org-file-properties, org-global-properties and
|
||||
;; - Look at org-keyword-properties, org-global-properties and
|
||||
;; org-global-properties-fixed
|
||||
;; - What about property inheritance and org-property-inherit-p?
|
||||
;; - Use TYPE_TODO as an way to assign resources
|
||||
@@ -841,8 +841,8 @@ a unique id will be associated to it."
|
||||
(priority
|
||||
(let ((pri (org-element-property :priority task)))
|
||||
(and pri
|
||||
(max 1 (/ (* 1000 (- org-lowest-priority pri))
|
||||
(- org-lowest-priority org-highest-priority)))))))
|
||||
(max 1 (/ (* 1000 (- org-priority-lowest pri))
|
||||
(- org-priority-lowest org-priority-highest)))))))
|
||||
(concat
|
||||
;; Opening task.
|
||||
(format "task %s \"%s\" {\n"
|
||||
|
||||
+1533
-1287
File diff suppressed because it is too large
Load Diff
@@ -114,8 +114,8 @@ the entire show and hide functionalities into a single command,
|
||||
:END:
|
||||
|
||||
Headlines define the structure of an outline tree. The headlines in
|
||||
Org start with one or more stars, on the left margin[fn:1]. For
|
||||
example:
|
||||
Org start on the left margin[fn:1] with one or more stars followed by
|
||||
a space. For example:
|
||||
|
||||
#+begin_example
|
||||
,* Top level headline
|
||||
|
||||
+756
-522
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
@c automatically generated, do not edit
|
||||
@set VERSION 9.3.6 (release_9.3.6)
|
||||
@set DATE 2020-02-13
|
||||
@set VERSION 9.4.4 (release_9.4.4)
|
||||
@set DATE 2020-12-22
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
% automatically generated, do not edit
|
||||
\def\orgversionnumber{9.3.6}
|
||||
\def\orgversionnumber{9.4.4}
|
||||
\def\versionyear{2020}
|
||||
\def\year{2020}
|
||||
|
||||
Binary file not shown.
+582
-349
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -513,7 +513,7 @@ after ``{\tt :}'', and dictionary words elsewhere.
|
||||
\key{special commands in property lines}{C-c C-c}
|
||||
\key{next/previous allowed value}{S-LEFT/RIGHT}
|
||||
\key{turn on column view}{C-c C-x C-c}
|
||||
\key{capture columns view in dynamic block}{C-c C-x i}
|
||||
\key{capture columns view in dynamic block}{C-c C-x x}
|
||||
|
||||
\key{quit column view}{q}
|
||||
\key{show full value}{v}
|
||||
@@ -556,7 +556,7 @@ after ``{\tt :}'', and dictionary words elsewhere.
|
||||
\key{stop/cancel clock on current item}{C-c C-x C-o/x}
|
||||
\key{display total subtree times}{C-c C-x C-d}
|
||||
\key{remove displayed times}{C-c C-c}
|
||||
\key{insert/update table with clock report}{C-c C-x C-r}
|
||||
\key{insert/update table with clock report}{C-c C-x C-x}
|
||||
|
||||
\section{Agenda Views}
|
||||
|
||||
|
||||
Binary file not shown.
+94
-93
@@ -213,7 +213,8 @@ File: orgguide, Node: Headlines, Next: Visibility Cycling, Up: Document Struc
|
||||
=============
|
||||
|
||||
Headlines define the structure of an outline tree. The headlines in Org
|
||||
start with one or more stars, on the left margin(1). For example:
|
||||
start on the left margin(1) with one or more stars followed by a space.
|
||||
For example:
|
||||
|
||||
* Top level headline
|
||||
** Second level
|
||||
@@ -2540,98 +2541,98 @@ Ref: Activation7115
|
||||
Ref: Feedback7555
|
||||
Node: Document Structure7789
|
||||
Node: Headlines8855
|
||||
Ref: Headlines-Footnote-19714
|
||||
Node: Visibility Cycling9837
|
||||
Node: Motion11055
|
||||
Node: Structure Editing11472
|
||||
Ref: Structure Editing-Footnote-112661
|
||||
Node: Sparse Trees12765
|
||||
Ref: Sparse Trees-Footnote-113828
|
||||
Node: Plain Lists13943
|
||||
Node: Tables16444
|
||||
Ref: Creation and conversion18130
|
||||
Ref: Re-aligning and field motion18682
|
||||
Ref: Column and row editing19198
|
||||
Node: Hyperlinks20203
|
||||
Ref: Internal links20956
|
||||
Ref: External Links21409
|
||||
Ref: Handling Links23239
|
||||
Node: TODO Items24628
|
||||
Node: TODO Basics25600
|
||||
Node: Multi-state Workflow26990
|
||||
Node: Progress Logging28781
|
||||
Ref: Closing items29523
|
||||
Ref: Tracking TODO state changes30078
|
||||
Ref: Progress Logging-Footnote-131077
|
||||
Ref: Progress Logging-Footnote-231150
|
||||
Node: Priorities31228
|
||||
Node: Breaking Down Tasks32119
|
||||
Node: Checkboxes32917
|
||||
Node: Tags33972
|
||||
Ref: Tag inheritance34592
|
||||
Ref: Setting tags35330
|
||||
Ref: Tag groups37050
|
||||
Ref: Tag searches37846
|
||||
Ref: Tags-Footnote-138938
|
||||
Node: Properties39042
|
||||
Node: Dates and Times40796
|
||||
Node: Timestamps41393
|
||||
Node: Creating Timestamps43445
|
||||
Node: Deadlines and Scheduling45101
|
||||
Ref: Deadlines and Scheduling-Footnote-147120
|
||||
Ref: Deadlines and Scheduling-Footnote-247281
|
||||
Node: Clocking Work Time47444
|
||||
Node: Capture Refile Archive48752
|
||||
Node: Capture49555
|
||||
Ref: Setting up capture49852
|
||||
Ref: Using capture50123
|
||||
Ref: Capture templates50718
|
||||
Ref: Capture-Footnote-152134
|
||||
Ref: Capture-Footnote-252245
|
||||
Node: Refile and Copy52336
|
||||
Node: Archiving53529
|
||||
Node: Agenda Views54836
|
||||
Node: Agenda Files56286
|
||||
Node: Agenda Dispatcher56941
|
||||
Node: Built-in Agenda Views57866
|
||||
Node: Global TODO List58950
|
||||
Node: Matching Tags and Properties59662
|
||||
Node: Search View61626
|
||||
Node: Agenda Commands62731
|
||||
Ref: Motion (1)63312
|
||||
Ref: View/Go to Org file63453
|
||||
Ref: Change display63800
|
||||
Ref: Remote editing64888
|
||||
Ref: Quit and exit66079
|
||||
Node: Custom Agenda Views66285
|
||||
Node: Markup67756
|
||||
Node: Paragraphs68577
|
||||
Node: Emphasis and Monospace69694
|
||||
Node: Embedded LaTeX70107
|
||||
Node: Literal examples70971
|
||||
Node: Images72056
|
||||
Node: Creating Footnotes72652
|
||||
Node: Exporting73568
|
||||
Node: The Export Dispatcher74439
|
||||
Node: Export Settings74964
|
||||
Node: Table of Contents75784
|
||||
Node: Include Files76512
|
||||
Node: Comment Lines77193
|
||||
Node: ASCII/UTF-8 Export77886
|
||||
Node: HTML Export78580
|
||||
Node: LaTeX Export79592
|
||||
Node: iCalendar Export81226
|
||||
Node: Publishing81922
|
||||
Node: Working with Source Code83456
|
||||
Ref: Using header arguments84718
|
||||
Ref: Evaluating code blocks85896
|
||||
Ref: Results of evaluation86771
|
||||
Ref: Exporting code blocks87993
|
||||
Ref: Extracting source code88457
|
||||
Node: Miscellaneous88984
|
||||
Ref: Completion89102
|
||||
Ref: Structure Templates89439
|
||||
Ref: Clean view89765
|
||||
Ref: Headlines-Footnote-19732
|
||||
Node: Visibility Cycling9855
|
||||
Node: Motion11073
|
||||
Node: Structure Editing11490
|
||||
Ref: Structure Editing-Footnote-112679
|
||||
Node: Sparse Trees12783
|
||||
Ref: Sparse Trees-Footnote-113846
|
||||
Node: Plain Lists13961
|
||||
Node: Tables16462
|
||||
Ref: Creation and conversion18148
|
||||
Ref: Re-aligning and field motion18700
|
||||
Ref: Column and row editing19216
|
||||
Node: Hyperlinks20221
|
||||
Ref: Internal links20974
|
||||
Ref: External Links21427
|
||||
Ref: Handling Links23257
|
||||
Node: TODO Items24646
|
||||
Node: TODO Basics25618
|
||||
Node: Multi-state Workflow27008
|
||||
Node: Progress Logging28799
|
||||
Ref: Closing items29541
|
||||
Ref: Tracking TODO state changes30096
|
||||
Ref: Progress Logging-Footnote-131095
|
||||
Ref: Progress Logging-Footnote-231168
|
||||
Node: Priorities31246
|
||||
Node: Breaking Down Tasks32137
|
||||
Node: Checkboxes32935
|
||||
Node: Tags33990
|
||||
Ref: Tag inheritance34610
|
||||
Ref: Setting tags35348
|
||||
Ref: Tag groups37068
|
||||
Ref: Tag searches37864
|
||||
Ref: Tags-Footnote-138956
|
||||
Node: Properties39060
|
||||
Node: Dates and Times40814
|
||||
Node: Timestamps41411
|
||||
Node: Creating Timestamps43463
|
||||
Node: Deadlines and Scheduling45119
|
||||
Ref: Deadlines and Scheduling-Footnote-147138
|
||||
Ref: Deadlines and Scheduling-Footnote-247299
|
||||
Node: Clocking Work Time47462
|
||||
Node: Capture Refile Archive48770
|
||||
Node: Capture49573
|
||||
Ref: Setting up capture49870
|
||||
Ref: Using capture50141
|
||||
Ref: Capture templates50736
|
||||
Ref: Capture-Footnote-152152
|
||||
Ref: Capture-Footnote-252263
|
||||
Node: Refile and Copy52354
|
||||
Node: Archiving53547
|
||||
Node: Agenda Views54854
|
||||
Node: Agenda Files56304
|
||||
Node: Agenda Dispatcher56959
|
||||
Node: Built-in Agenda Views57884
|
||||
Node: Global TODO List58968
|
||||
Node: Matching Tags and Properties59680
|
||||
Node: Search View61644
|
||||
Node: Agenda Commands62749
|
||||
Ref: Motion (1)63330
|
||||
Ref: View/Go to Org file63471
|
||||
Ref: Change display63818
|
||||
Ref: Remote editing64906
|
||||
Ref: Quit and exit66097
|
||||
Node: Custom Agenda Views66303
|
||||
Node: Markup67774
|
||||
Node: Paragraphs68595
|
||||
Node: Emphasis and Monospace69712
|
||||
Node: Embedded LaTeX70125
|
||||
Node: Literal examples70989
|
||||
Node: Images72074
|
||||
Node: Creating Footnotes72670
|
||||
Node: Exporting73586
|
||||
Node: The Export Dispatcher74457
|
||||
Node: Export Settings74982
|
||||
Node: Table of Contents75802
|
||||
Node: Include Files76530
|
||||
Node: Comment Lines77211
|
||||
Node: ASCII/UTF-8 Export77904
|
||||
Node: HTML Export78598
|
||||
Node: LaTeX Export79610
|
||||
Node: iCalendar Export81244
|
||||
Node: Publishing81940
|
||||
Node: Working with Source Code83474
|
||||
Ref: Using header arguments84736
|
||||
Ref: Evaluating code blocks85914
|
||||
Ref: Results of evaluation86789
|
||||
Ref: Exporting code blocks88011
|
||||
Ref: Extracting source code88475
|
||||
Node: Miscellaneous89002
|
||||
Ref: Completion89120
|
||||
Ref: Structure Templates89457
|
||||
Ref: Clean view89783
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Binary file not shown.
@@ -39,7 +39,7 @@ modify this GNU manual.''
|
||||
@finalout
|
||||
@titlepage
|
||||
@title Org Mode Compact Guide
|
||||
@subtitle Release 9.3
|
||||
@subtitle Release 9.4
|
||||
@author The Org Mode Developers
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@@ -231,9 +231,9 @@ the entire show and hide functionalities into a single command,
|
||||
@section Headlines
|
||||
|
||||
Headlines define the structure of an outline tree. The headlines in
|
||||
Org start with one or more stars, on the left margin@footnote{See the variable @code{org-special-ctrl-a/e} to configure special
|
||||
behavior of @kbd{C-a} and @kbd{C-e} in headlines.}. For
|
||||
example:
|
||||
Org start on the left margin@footnote{See the variable @code{org-special-ctrl-a/e} to configure special
|
||||
behavior of @kbd{C-a} and @kbd{C-e} in headlines.} with one or more stars followed by
|
||||
a space. For example:
|
||||
|
||||
@example
|
||||
* Top level headline
|
||||
|
||||
+568
-14
@@ -10,6 +10,547 @@ See the end of the file for license conditions.
|
||||
|
||||
Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
|
||||
|
||||
* Version 9.5 (not yet released)
|
||||
* Version 9.4
|
||||
** Incompatible changes
|
||||
*** Possibly broken internal file links: please check and fix
|
||||
|
||||
A bug has been affecting internal links to headlines, like
|
||||
|
||||
: [[*Headline][A link to a headline]]
|
||||
|
||||
Storing a link to a headline may have been broken in your setup and
|
||||
those links may appear as
|
||||
|
||||
: [[*TODO Headline][A link to a headline]]
|
||||
|
||||
Following the link above will result in an error: the TODO keyword
|
||||
should not be part of internal file links.
|
||||
|
||||
You can use the following command to fix links in an Org buffer:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun org-fix-links ()
|
||||
"Fix ill-formatted internal links.
|
||||
E.g. replace [[*TODO Headline][headline]] by [[*Headline][headline]].
|
||||
Go through the buffer and ask for the replacement."
|
||||
(interactive)
|
||||
(visible-mode 1)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((regexp (format "\\[\\[\\*%s\\s-+"
|
||||
(regexp-opt org-todo-keywords-1 t))))
|
||||
(while (re-search-forward regexp nil t)
|
||||
(when (and (save-excursion
|
||||
(goto-char (match-beginning 0))
|
||||
(looking-at-p org-link-bracket-re))
|
||||
(y-or-n-p "Fix link (remove TODO keyword)? "))
|
||||
(replace-match "[[*")))))
|
||||
(visible-mode -1))
|
||||
#+end_src
|
||||
|
||||
*** Calling conventions changes when opening or exporting custom links
|
||||
|
||||
This changes affects export back-ends, and libraries providing new
|
||||
link types.
|
||||
|
||||
Function used in ~:follow~ link parameter is required to accept a
|
||||
second argument. Likewise, function used in ~:export~ parameter needs
|
||||
to accept a fourth argument. See ~org-link-set-parameters~ for
|
||||
details.
|
||||
|
||||
Eventually, the function ~org-export-custom-protocol-maybe~ is now
|
||||
called with a fourth argument. Even though the 3-arguments definition
|
||||
is still supported, at least for now, we encourage back-end developers
|
||||
to switch to the new signature.
|
||||
|
||||
*** Python session return values must be top-level expression statements
|
||||
|
||||
Python blocks with ~:session :results value~ header arguments now only
|
||||
return a value if the last line is a top-level expression statement.
|
||||
Also, when a None value is returned, "None" will be printed under
|
||||
"#+RESULTS:", as it already did with ~:results value~ for non-session
|
||||
blocks.
|
||||
|
||||
*** In HTML export, change on how outline-container-* is set
|
||||
|
||||
When the headline has a =CUSTOM_ID=, use this custom id to build the
|
||||
div id. For example, if you have =:CUSTOM_ID: my-headline= then the
|
||||
resulting <div> will be ~<div id="outline-container-my-headline">~.
|
||||
|
||||
You may want to check whether your HTML files are rendered differently
|
||||
after this change.
|
||||
|
||||
*** New keybinding =<C-c C-TAB>= for ~org-force-cycle-archived~
|
||||
|
||||
~org-force-cycle-archived~ used to be associated with =<C-TAB>= but
|
||||
this keybinding is used in Emacs for navigating tabs in Emacs. The
|
||||
new keybinding is =<C-c C-TAB>=.
|
||||
|
||||
** New default settings for some options
|
||||
|
||||
These options now default to =t=:
|
||||
|
||||
- ~org-loop-over-headlines-in-active-region~
|
||||
- ~org-fontify-done-headline~
|
||||
- ~org-src-tab-acts-natively~
|
||||
|
||||
You may want to read the docstrings of these options to understand the
|
||||
consequences of this change.
|
||||
|
||||
Also, ~org-startup-folded~ now defaults to ~showeverything~.
|
||||
|
||||
** New features
|
||||
|
||||
*** Looping agenda commands over headlines
|
||||
|
||||
~org-agenda-loop-over-headlines-in-active-region~ allows you to loop
|
||||
agenda commands over the active region.
|
||||
|
||||
When set to =t= (the default), loop over all headlines. When set to
|
||||
='start-level=, loop over headlines with the same level as the first
|
||||
headline in the region. When set to a string, loop over lines
|
||||
matching this regular expression.
|
||||
|
||||
*** New minor mode ~org-table-header-line-mode~
|
||||
|
||||
Turn on the display of the first data row of the table at point in the
|
||||
window header line when this first row is not visible anymore in the
|
||||
buffer.
|
||||
|
||||
You can activate this minor mode by default by setting the option
|
||||
~org-table-header-line-p~ to =t=. You can also change the face for
|
||||
the header line by customizing the ~org-table-header~ face.
|
||||
|
||||
*** New minor mode ~org-list-checkbox-radio-mode~
|
||||
|
||||
When this minor mode is on, checkboxes behave as radio buttons: if a
|
||||
checkbox is turned on, other checkboxes at the same level are turned
|
||||
off.
|
||||
|
||||
If you want to occasionally toggle a checkbox as a radio button
|
||||
without turning this minor mode on, you can use =<C-c C-x C-r>= to
|
||||
call ~org-toggle-radio-button~.
|
||||
|
||||
You can also add =#+ATTR_ORG: :radio t= right before the list to tell
|
||||
Org to use radio buttons for this list only.
|
||||
|
||||
*** New allowed value for ~org-adapt-indentation~
|
||||
|
||||
~org-adapt-indentation~ now accepts a new value, ='headline-data=.
|
||||
|
||||
When set to this value, Org will only adapt indentation of headline
|
||||
data lines, such as planning/clock lines and property/logbook drawers.
|
||||
Also, with this setting, =org-indent-mode= will keep these data lines
|
||||
correctly aligned with the headline above.
|
||||
|
||||
*** Numeric priorities are now allowed (up to 65)
|
||||
|
||||
You can now set ~org-priority-highest/lowest/default~ to integers to
|
||||
use numeric priorities globally or set, for example
|
||||
|
||||
#+PRIORITIES: 1 10 5
|
||||
|
||||
to define a buffer-local range and default for priorities. Priority
|
||||
commands should work as usual. You cannot use numbers superior to 64
|
||||
for numeric priorities, as it would clash with priorities like [#A]
|
||||
where the "A" is internally converted to its numeric value of 65.
|
||||
|
||||
*** Property drawers allowed before first headline
|
||||
|
||||
Property drawers are now allowed before the first headline.
|
||||
|
||||
Org mode is moving more towards making things before the first
|
||||
headline behave just as if it was at outline level 0. Inheritance for
|
||||
properties will work also for this level. In other words: defining
|
||||
things in a property drawer before the first headline will make them
|
||||
"inheritable" for all headlines.
|
||||
|
||||
*** Refinement in window behavior on exiting Org source buffer
|
||||
|
||||
After editing a source block, Org will restore the window layout when
|
||||
~org-src-window-setup~ is set to a value that modifies the layout.
|
||||
|
||||
*** Display remote inline images
|
||||
|
||||
Org now knows how to display remote images inline.
|
||||
|
||||
Whether the images are actually displayed is controlled by the new
|
||||
option ~org-display-remote-inline-images~.
|
||||
|
||||
*** New option to resolve open clock at a provided time
|
||||
|
||||
~org-resolve-clocks~ now has a `t' option, which works just like the
|
||||
`k' option, but the user specifies a time of day, not a number of
|
||||
minutes.
|
||||
|
||||
*** New step value =semimonth= accepted for clock tables
|
||||
|
||||
*** Allow text rescaling in column view
|
||||
|
||||
You can now use =C-x C-+= in column view: the columns face size will
|
||||
increase or decrease, together with the column header size.
|
||||
|
||||
*** New startup option =#+startup: num=
|
||||
|
||||
When this startup option is set, display headings as numerated.
|
||||
|
||||
Use =#+startup: nonum= to turn this off.
|
||||
|
||||
*** New tool for custom links
|
||||
|
||||
Org provides a new tool ~org-link-open-as-file~, useful when defining
|
||||
new link types similar to "file"-type links. See docstring for
|
||||
details.
|
||||
|
||||
*** New optional numeric argument for ~org-return~
|
||||
|
||||
In situations where ~org-return~ calls ~newline~, multiple newlines
|
||||
can now be inserted with this prefix argument.
|
||||
|
||||
*** New source code block header argument =:file-mode=
|
||||
|
||||
Source code block header argument =:file-mode= can set file
|
||||
permissions if =:file= argument is provided.
|
||||
|
||||
*** =RET= and =C-j= now obey ~electric-indent-mode~
|
||||
|
||||
Since Emacs 24.4, ~electric-indent-mode~ is enabled by default. In
|
||||
most major modes, this causes =RET= to reindent the current line and
|
||||
indent the new line, and =C-j= to insert a newline without indenting.
|
||||
|
||||
Org mode now obeys this minor mode: when ~electric-indent-mode~ is
|
||||
enabled, and point is neither in a table nor on a timestamp or a link:
|
||||
|
||||
- =RET= (bound to ~org-return~) reindents the current line and indents
|
||||
the new line;
|
||||
- =C-j= (bound to the new command ~org-return-and-maybe-indent~)
|
||||
merely inserts a newline.
|
||||
|
||||
To get the previous behaviour back, disable ~electric-indent-mode~
|
||||
explicitly:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
|
||||
#+end_src
|
||||
|
||||
Alternatively, if you wish to keep =RET= as the "smart-return" key,
|
||||
but dislike Org's default indentation of sections, you may prefer to
|
||||
customize ~org-adapt-indentation~ to either =nil= or ='headline-data=.
|
||||
|
||||
*** =ob-C.el= allows the inclusion of non-system header files
|
||||
|
||||
In C and C++ blocks, ~:includes~ arguments that do not start with a
|
||||
~<~ character will now be formatted as double-quoted ~#include~
|
||||
statements.
|
||||
|
||||
*** =ob-clojure.el= supports inf-clojure.el and ClojureScript evaluation
|
||||
|
||||
You can now set ~(setq org-babel-clojure-backend 'inf-clojure)~ and
|
||||
evaluate Clojure source blocks using [[https://github.com/clojure-emacs/inf-clojure][inf-clojure]]. With a header
|
||||
argument like =:alias "alias"= the Clojure REPL will boot with
|
||||
=clojure -Aalias=. Otherwise Clojure will boot with =lein=, =boot= or
|
||||
=tools.deps=, depending on whether the current directory contains a
|
||||
=project.clj=, =build.boot= or =deps.edn=, falling back on
|
||||
~inf-clojure-generic-cmd~ in case no such file is present.
|
||||
|
||||
Also, when using [[https://github.com/clojure-emacs/cider][cider]], you can now use =#+begin_src clojurescript= to
|
||||
execute ClojureScript code from Org files. Note that this works only
|
||||
if your Org file is associated with a cider session that knows how to
|
||||
run ClojureScript code. A bare =lein repl= session outside of a
|
||||
directory configured for ClojureScript will /not/ work.
|
||||
|
||||
*** =ob-java.el= supports Java command line arguments
|
||||
|
||||
Babel Java blocks recognize header argument =:cmdargs= and pass its
|
||||
value in call to =java=.
|
||||
|
||||
*** =ob-screen.el= now accepts =:screenrc= header argument
|
||||
|
||||
Screen blocks now recognize the =:screenrc= header argument and pass
|
||||
its value to the screen command via the "-c" option. The default
|
||||
remains =/dev/null= (i.e. a clean screen session)
|
||||
|
||||
*** =ob-plantuml=: now supports using PlantUML executable to generate diagrams
|
||||
|
||||
Set =org-plantuml-exec-mode= to ='plantuml= in order to use the
|
||||
executable instead of JAR. When using an executable it is also
|
||||
possible to configure executable location as well as arguments via:
|
||||
=org-plantuml-executable-path= and =org-plantuml-executable-args=.
|
||||
|
||||
** New commands
|
||||
*** ~org-table-header-line-mode~
|
||||
|
||||
Turn on a minor mode to display the first data row of the table at
|
||||
point in the header-line when the beginning of the table is invisible.
|
||||
|
||||
*** ~org-agenda-ctrl-c-ctrl-c~
|
||||
|
||||
Hitting =<C-c C-c>= in an agenda view now calls ~org-agenda-set-tags~.
|
||||
|
||||
*** ~org-hide-entry~
|
||||
|
||||
This command is the counterpart of ~org-show-entry~.
|
||||
|
||||
*** ~org-columns-toggle-or-columns-quit~
|
||||
|
||||
=<C-c C-c>= bound to ~org-columns-toggle-or-columns-quit~ replaces the
|
||||
recent ~org-columns-set-tags-or-toggle~. Tag setting is still
|
||||
possible via column view value edit or with =<C-c C-q>=.
|
||||
|
||||
*** ~org-datetree-find-month-create~
|
||||
|
||||
Find or create a month entry for a date.
|
||||
|
||||
** New options and settings
|
||||
*** New option ~org-html-prefer-user-labels~
|
||||
|
||||
When non-nil, use =NAME= affiliated keyword, or raw target values, to
|
||||
generate anchor's ID. Otherwise, consistently use internal naming
|
||||
scheme.
|
||||
|
||||
=CUSTOM_ID= values are still always used, when available.
|
||||
*** New option for using tabs in ~org-agenda-window-setup~
|
||||
|
||||
Choosing ~other-tab~ for ~org-agenda-window-setup~ will open the
|
||||
agenda view in a new tab. This will work with versions of Emacs since
|
||||
27.1 when ~tab-bar-mode~ was introduced.
|
||||
|
||||
*** New option ~org-table-header-line-p~
|
||||
|
||||
Setting this option to =t= will activate ~org-table-header-line-mode~
|
||||
in org-mode buffers.
|
||||
|
||||
*** New option ~org-startup-numerated~
|
||||
|
||||
When this option is =t=, Org files will start using ~(org-num-mode 1)~
|
||||
and headings will be visually numerated.
|
||||
|
||||
You can turn this on/off on a per-file basis with =#+startup: num= or
|
||||
=#+startup: nonum=.
|
||||
|
||||
*** New option ~org-clock-auto-clockout-timer~
|
||||
|
||||
When this option is set to a number and the user configuration
|
||||
contains =(org-clock-auto-clockout-insinuate)=, Org will clock out the
|
||||
currently clocked in task after that number of seconds of idle time.
|
||||
|
||||
This is useful when you often forget to clock out before being idle
|
||||
and don't want to have to manually set the clocking time to take into
|
||||
account.
|
||||
|
||||
*** New option to group captured datetime entries by month
|
||||
|
||||
A new `:tree-type month' option was added to org-capture-templates to
|
||||
group new datetime entries by month.
|
||||
|
||||
*** New option to show source buffers using "plain" display-buffer
|
||||
|
||||
There is a new option ~plain~ to ~org-src-window-setup~ to show source
|
||||
buffers using ~display-buffer~. This allows users to control how
|
||||
source buffers are displayed by modifying ~display-buffer-alist~ or
|
||||
~display-buffer-base-action~.
|
||||
|
||||
*** New option ~org-archive-subtree-save-file-p~
|
||||
|
||||
Archiving a subtree used to always save the target archive buffer.
|
||||
Commit [[https://code.orgmode.org/bzg/org-mode/commit/b186d1d7][b186d1d7]] changed this behavior by always not saving the target
|
||||
buffer, because batch archiving from agenda could take too much time.
|
||||
|
||||
This new option ~org-archive-subtree-save-file-p~ defaults to the
|
||||
value =from-org= so that archiving a subtree will save the target
|
||||
buffer when done from an org-mode buffer, but not from the agenda.
|
||||
You can also set this option to =t= or to =from-agenda=.
|
||||
|
||||
*** New option ~org-show-notification-timeout~
|
||||
|
||||
This option will add a timeout to notifications.
|
||||
|
||||
*** New option ~org-latex-to-html-convert-command~
|
||||
|
||||
This new option allows you to convert a LaTeX fragment directly into
|
||||
HTML.
|
||||
|
||||
*** New option ~org-babel-shell-results-defaults-to-output~
|
||||
|
||||
By default, source code blocks are executed in "functional mode": it
|
||||
means that the results of executing them are the value of their last
|
||||
statement (see [[https://orgmode.org/manual/Results-of-Evaluation.html][the documentation]].)
|
||||
|
||||
The value of a shell script's execution is its exit code. But most
|
||||
users expect the results of executing a shell script to be its output,
|
||||
not its exit code.
|
||||
|
||||
So we introduced this option, that you can set to =nil= if you want
|
||||
to stick using ~:results value~ as the implicit header.
|
||||
|
||||
In all Babel libraries, the absence of a ~:results~ header should
|
||||
produce the same result than setting ~:results value~, unless there is
|
||||
an option to explicitly create an exception.
|
||||
|
||||
See [[https://orgmode.org/list/CA+A2iZaziAfMeGpBqL6qGrzrWEVvLvC0DUw++T4gCF3NGuW-DQ@mail.gmail.com/][this thread]] for more context.
|
||||
|
||||
*** New option in ~org-attach-store-link-p~
|
||||
|
||||
~org-attach-store-link-p~ has a new option to store a file link to the
|
||||
attachment.
|
||||
*** New option ~org-fontify-todo-headline~
|
||||
|
||||
This feature is the same as ~org-fontify-done-headline~, but for TODO
|
||||
headlines instead. This allows you to distinguish TODO headlines from
|
||||
normal headlines. The face can be customized via ~org-headline-todo~.
|
||||
|
||||
*** New default value for ~org-file-apps~
|
||||
|
||||
The new value uses Emacs as the application for opening directory.
|
||||
|
||||
*** New hook ~org-agenda-filter-hook~
|
||||
|
||||
Functions in this hook are run after ~org-agenda-filter~ is called.
|
||||
|
||||
** Removed or renamed functions and variables
|
||||
*** Deprecated ~org-flag-drawer~ function
|
||||
|
||||
Use ~org-hide-drawer-toggle~ instead.
|
||||
|
||||
*** Deprecated ~org-hide-block-toggle-maybe~ function
|
||||
|
||||
Use ~org-hide-block-toggle~ instead.
|
||||
|
||||
*** Deprecated ~org-hide-block-toggle-all~ function
|
||||
|
||||
This function was not used in the code base, and has no clear use
|
||||
either. It has been marked for future removal. Please contact the
|
||||
mailing list if you use this function.
|
||||
|
||||
*** Deprecated ~org-return-indent~ function
|
||||
|
||||
In Elisp code, use ~(org-return t)~ instead. Interactively, =C-j= is
|
||||
now bound to ~org-return-and-maybe-indent~, which indents the new line
|
||||
when ~electric-indent-mode~ is disabled.
|
||||
|
||||
*** Removed ~org-maybe-keyword-time-regexp~
|
||||
|
||||
The variable was not used in the code base.
|
||||
|
||||
*** Removed ~org-export-special-keywords~
|
||||
|
||||
The variable was not used in the code base.
|
||||
|
||||
*** Renamed ~org-at-property-block-p~
|
||||
|
||||
The new name is ~org-at-property-drawer-p~, which is less confusing.
|
||||
|
||||
*** Renamed ~org-columns-set-tags-or-toggle~
|
||||
|
||||
See [[*~org-columns-toggle-or-columns-quit~]].
|
||||
|
||||
*** Renamed priority options
|
||||
|
||||
From ~org-lowest-priority~ to ~org-priority-lowest~.
|
||||
From ~org-default-priority~ to ~org-priority-default~.
|
||||
From ~org-highest-priority~ to ~org-priority-highest~.
|
||||
From ~org-enable-priority-commands~ to ~org-priority-enable-commands~.
|
||||
From ~org-show-priority~ to ~org-priority-show~.
|
||||
|
||||
** Miscellaneous
|
||||
*** =ob-screen.el= now respects screen =:session= name
|
||||
|
||||
Screen babel session are now named based on the =:session= header
|
||||
argument (defaults to ~default~).
|
||||
|
||||
Previously all session names had ~org-babel-session-~ prepended.
|
||||
|
||||
*** Forward/backward paragraph functions in line with the rest of Emacs
|
||||
|
||||
~org-forward-paragraph~ and ~org-backward-paragraph~, bound to
|
||||
~<C-UP>~ and ~<C-DOWN>~ functions mimic more closely behaviour of
|
||||
~forward-paragraph~ and ~backward-paragraph~ functions when
|
||||
available.
|
||||
|
||||
They also accept an optional argument for multiple calls.
|
||||
|
||||
See their docstring for details.
|
||||
*** ~org-table-to-lisp~ no longer checks if point is at a table
|
||||
|
||||
The caller is now responsible for the check. It can use, e.g.,
|
||||
~org-at-table-p~.
|
||||
|
||||
The function is also much more efficient than it used to be, even on
|
||||
very large tables.
|
||||
|
||||
*** New function ~org-collect-keywords~
|
||||
*** Drawers' folding use an API similar to block's
|
||||
|
||||
Tooling for folding drawers interactively or programmatically is now
|
||||
on par with block folding. In particular, ~org-hide-drawer-toggle~,
|
||||
a new function, is the central place for drawer folding.
|
||||
|
||||
*** Duration can be read and written in compact form
|
||||
|
||||
~org-duration-to-minutes~ understands =1d3h5min= as a duration,
|
||||
whereas ~org-duration-from-minutes~ can output this compact form if
|
||||
the duration format contains the symbol ~compact~.
|
||||
|
||||
*** C-n, C-p, SPC and DEL in agenda commands dispatch window
|
||||
|
||||
You can now use =<C-n>=, =<C-p>=, =<SPC>= and =<DEL>= key to scroll up
|
||||
and down the agenda and attach dispatch window.
|
||||
|
||||
*** =<C-c C-c>= in agenda calls ~org-agenda-set-tags~
|
||||
|
||||
Both =<C-c C-q>= and =<C-c C-c>= set the tags of the headline in the
|
||||
Org buffer. Both keybindings are now available from the agenda too.
|
||||
|
||||
*** Allow to use an empty HTML extension
|
||||
|
||||
Using =(setq org-html-extension "")= or setting the HTML extension in
|
||||
any fashion will produce the expected output, with no trailing period
|
||||
to the resulting HTML file.
|
||||
|
||||
*** Handle repeated tasks with =.+= type and hours step
|
||||
|
||||
A task using a =.+= repeater and hours step is repeated starting from
|
||||
now. E.g.,
|
||||
|
||||
#+begin_example
|
||||
,,** TODO Wash my hands
|
||||
DEADLINE: <2019-04-05 08:00 Sun .+1h>
|
||||
Marking this DONE shifts the date to exactly one hour from now.
|
||||
#+end_example
|
||||
|
||||
*** The format of equation reference in HTML export can now be specified
|
||||
|
||||
By default, HTML (via MathJax) and LaTeX export equation references
|
||||
using different commands. LaTeX must use ~\ref{%s}~ because it is used
|
||||
for all labels; however, HTML (via MathJax) uses ~\eqref{%s}~ for
|
||||
equations producing inconsistent output. New option
|
||||
~org-html-equation-reference-format~ sets the command used in HTML
|
||||
export.
|
||||
|
||||
*** =ob-haskell.el= supports compilation with =:compile= header argument
|
||||
|
||||
By default, Haskell blocks are interpreted. By adding =:compile yes=
|
||||
to a Haskell source block, it will be compiled, executed and the
|
||||
results will be displayed.
|
||||
|
||||
*** Support for ~org-edit-special~ with LaTeX fragments
|
||||
|
||||
Calling ~org-edit-special~ on an inline LaTeX fragment calls a new
|
||||
function, ~org-edit-latex-fragment~. This functions in a comparable
|
||||
manner to editing inline source blocks, bringing up a minibuffer set
|
||||
to LaTeX mode. The math-mode deliminators are read only.
|
||||
|
||||
*** ~org-capture-current-plist~ is now accessible during ~org-capture-mode-hook~
|
||||
*** New =org-refile.el= file
|
||||
|
||||
Org refile variables and functions have been moved to a new file.
|
||||
|
||||
*** The end of a 7 years old bug
|
||||
|
||||
This bug [[https://lists.gnu.org/archive/html/emacs-orgmode/2013-08/msg00072.html][originally reported]] by Matt Lundin and investigated by Andrew
|
||||
Hyatt has been fixed. Thanks to both of them.
|
||||
|
||||
* Version 9.3
|
||||
|
||||
** Incompatible changes
|
||||
@@ -137,7 +678,7 @@ Export ignore done tasks with a deadline when
|
||||
Likewise, scheduled done tasks are also ignored when
|
||||
~org-icalendar-use-scheduled~ contains the same symbol.
|
||||
|
||||
*** Add split-window-right option for src block edit window placement
|
||||
*** Add ~split-window-right~ option for src block edit window placement
|
||||
|
||||
Given the increasing popularity of wide screen monitors, splitting
|
||||
horizontally may make more sense than splitting vertically. An
|
||||
@@ -360,7 +901,6 @@ the headline to use for making the table of contents.
|
||||
,* Another section
|
||||
,#+TOC: headlines 1 :target "#TargetSection"
|
||||
#+end_example
|
||||
|
||||
** New functions
|
||||
*** ~org-dynamic-block-insert-dblock~
|
||||
|
||||
@@ -470,6 +1010,16 @@ I.e. treat the whole file as if it was a subtree.
|
||||
|
||||
*** Respect narrowing when agenda command is restricted to buffer
|
||||
|
||||
*** ~org-table-insert-column~ inserts the column at point position
|
||||
|
||||
Before, the new column was inserted to the right of the column at
|
||||
point position.
|
||||
|
||||
*** Table column deletion now consistent with row deletion
|
||||
|
||||
Point stays in the column at deletion, except when deleting the
|
||||
rightmost column.
|
||||
|
||||
* Version 9.2
|
||||
** Incompatible changes
|
||||
*** Removal of OrgStruct mode mode and radio lists
|
||||
@@ -480,7 +1030,7 @@ and ~org-list-radio-lists-templates~) are removed from the code base.
|
||||
Note that only radio /lists/ have been removed, not radio tables.
|
||||
|
||||
If you want to manipulate lists like in Org in other modes, we suggest
|
||||
to use orgalist.el, which you can install from GNU ELPA.
|
||||
to use =orgalist.el=, which you can install from GNU ELPA.
|
||||
|
||||
If you want to use Org folding outside of Org buffers, you can have a
|
||||
look at the outshine package in the MELPA repository.
|
||||
@@ -1272,9 +1822,9 @@ removed from Gnus circa September 2010.
|
||||
|
||||
*** ~org-agenda-repeating-timestamp-show-all~ is removed.
|
||||
|
||||
For an equivalent to a ~nil~ value, set
|
||||
For an equivalent to a =nil= value, set
|
||||
~org-agenda-show-future-repeats~ to nil and
|
||||
~org-agenda-prefer-last-repeat~ to ~t~.
|
||||
~org-agenda-prefer-last-repeat~ to =t=.
|
||||
|
||||
*** ~org-gnus-nnimap-query-article-no-from-file~ is removed.
|
||||
|
||||
@@ -1292,7 +1842,7 @@ equivalent to the removed format string.
|
||||
|
||||
*** ~org-enable-table-editor~ is removed.
|
||||
|
||||
Setting it to a ~nil~ value broke some other features (e.g., speed
|
||||
Setting it to a =nil= value broke some other features (e.g., speed
|
||||
keys).
|
||||
|
||||
*** ~org-export-use-babel~ cannot be set to ~inline-only~
|
||||
@@ -1373,16 +1923,20 @@ is now obsolete.
|
||||
|
||||
Now ~=...=~ markup uses ~@samp{}~ instead of ~@verb{}~. You can use
|
||||
~@verb{}~ again by customizing the variable.
|
||||
|
||||
*** Texinfo exports example blocks as ~@example~
|
||||
*** Texinfo exports inline source blocks as ~@code{}~
|
||||
*** Texinfo default table markup is ~@asis~
|
||||
|
||||
It used to be ~@samp~ but ~@asis~ is neutral and, therefore, more
|
||||
suitable as a default value.
|
||||
|
||||
*** Texinfo default process includes ~--no-split~ option
|
||||
*** New entities : ~\dollar~ and ~\USD~
|
||||
*** Support for date style URLs in =org-protocol://open-source=
|
||||
URLs like =https://cool-blog.com/2017/05/20/cool-post/= are
|
||||
covered by rewrite rules.
|
||||
|
||||
URLs like =https://cool-blog.com/2017/05/20/cool-post/= are covered by
|
||||
rewrite rules.
|
||||
|
||||
*** Add (C) =COMMENT= support to ~org-structure-template-alist~
|
||||
|
||||
@@ -1472,7 +2026,7 @@ Moreover, ~:export-block~ keyword used in ~org-export-define-backend~ and
|
||||
~org-export-define-derived-backend~ is no longer used and needs to be
|
||||
removed.
|
||||
|
||||
*** Footnotes
|
||||
*** Footnotes changes
|
||||
|
||||
**** [1]-like constructs are not valid footnotes
|
||||
|
||||
@@ -2212,7 +2766,7 @@ without changing the headline.
|
||||
|
||||
*** Hierarchies of tags
|
||||
|
||||
The functionality of nesting tags in hierarchies is added to org-mode.
|
||||
The functionality of nesting tags in hierarchies is added to Org mode.
|
||||
This is the generalization of what was previously called "Tag groups"
|
||||
in the manual. That term is now changed to "Tag hierarchy".
|
||||
|
||||
@@ -4101,7 +4655,7 @@ See https://orgmode.org/elpa/
|
||||
|
||||
You can temporarily activate continuous clocking with =C-u C-u
|
||||
C-u M-x= [[doc::org-clock-in][org-clock-in]] =RET= (three universal prefix arguments)
|
||||
and =C-u C-u M-x= [[org-clock-in-last][org-clock-in-last]] =RET= (two universal prefix
|
||||
and =C-u C-u M-x= [[doc::org-clock-in-last][org-clock-in-last]] =RET= (two universal prefix
|
||||
arguments).
|
||||
|
||||
|
||||
@@ -4577,7 +5131,7 @@ that Calc formulas can operate on them.
|
||||
|
||||
The new system has a technically cleaner implementation and more
|
||||
possibilities for capturing different types of data. See
|
||||
[[http://thread.gmane.org/gmane.emacs.orgmode/26441/focus%3D26441][Carsten's announcement]] for more details.
|
||||
[[https://orgmode.org/list/C46F10DC-DE51-43D4-AFFE-F71E440D1E1F@gmail.com][Carsten's announcement]] for more details.
|
||||
|
||||
To switch over to the new system:
|
||||
|
||||
@@ -4708,7 +5262,7 @@ that Calc formulas can operate on them.
|
||||
|
||||
**** Modified link escaping
|
||||
|
||||
David Maus worked on `org-link-escape'. See [[http://article.gmane.org/gmane.emacs.orgmode/37888][his message]]:
|
||||
David Maus worked on `org-link-escape'. See [[https://orgmode.org/list/87k4gysacq.wl%dmaus@ictsoc.de][his message]]:
|
||||
|
||||
: Percent escaping is used in Org mode to escape certain characters
|
||||
: in links that would either break the parser (e.g. square brackets
|
||||
@@ -5147,7 +5701,7 @@ that Calc formulas can operate on them.
|
||||
|
||||
Thanks to Nicolas Goaziou for coding these changes.
|
||||
|
||||
**** A property value of "nil" now means to unset a property
|
||||
**** A property value of =nil= now means to unset a property
|
||||
|
||||
This can be useful in particular with property inheritance, if
|
||||
some upper level has the property, and some grandchild of it
|
||||
|
||||
@@ -182,7 +182,7 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
|
||||
cmdline)))
|
||||
"")))
|
||||
(when results
|
||||
(setq results (org-trim (org-remove-indentation results)))
|
||||
(setq results (org-remove-indentation results))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assq :result-params params))
|
||||
(org-babel-read results t)
|
||||
@@ -232,7 +232,13 @@ its header arguments."
|
||||
(list
|
||||
;; includes
|
||||
(mapconcat
|
||||
(lambda (inc) (format "#include %s" inc))
|
||||
(lambda (inc)
|
||||
;; :includes '(<foo> <bar>) gives us a list of
|
||||
;; symbols; convert those to strings.
|
||||
(when (symbolp inc) (setq inc (symbol-name inc)))
|
||||
(if (string-prefix-p "<" inc)
|
||||
(format "#include %s" inc)
|
||||
(format "#include \"%s\"" inc)))
|
||||
includes "\n")
|
||||
;; defines
|
||||
(mapconcat
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Oleh Krehel
|
||||
;; Maintainer: Joseph Novakovich <josephnovakovich@gmail.com>
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Homepage: https://orgmode.org
|
||||
|
||||
@@ -76,6 +77,8 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(message "executing J source code block")
|
||||
(let* ((processed-params (org-babel-process-params params))
|
||||
(sessionp (cdr (assq :session params)))
|
||||
(sit-time (let ((sit (assq :sit params)))
|
||||
(if sit (cdr sit) .1)))
|
||||
(full-body (org-babel-expand-body:J
|
||||
body params processed-params))
|
||||
(tmp-script-file (org-babel-temp-file "J-src")))
|
||||
@@ -86,9 +89,9 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(with-temp-file tmp-script-file
|
||||
(insert full-body))
|
||||
(org-babel-eval (format "%s < %s" org-babel-J-command tmp-script-file) ""))
|
||||
(org-babel-J-eval-string full-body)))))
|
||||
(org-babel-J-eval-string full-body sit-time)))))
|
||||
|
||||
(defun org-babel-J-eval-string (str)
|
||||
(defun org-babel-J-eval-string (str sit-time)
|
||||
"Sends STR to the `j-console-cmd' session and executes it."
|
||||
(let ((session (j-console-ensure-session)))
|
||||
(with-current-buffer (process-buffer session)
|
||||
@@ -96,7 +99,7 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(insert (format "\n%s\n" str))
|
||||
(let ((beg (point)))
|
||||
(comint-send-input)
|
||||
(sit-for .1)
|
||||
(sit-for sit-time)
|
||||
(buffer-substring-no-properties
|
||||
beg (point-max))))))
|
||||
|
||||
|
||||
@@ -193,7 +193,8 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(org-babel-comint-in-buffer session
|
||||
(mapc (lambda (var)
|
||||
(end-of-line 1) (insert var) (comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)) var-lines))
|
||||
(org-babel-comint-wait-for-output session))
|
||||
var-lines))
|
||||
session))
|
||||
|
||||
(defun org-babel-load-session:R (session body params)
|
||||
@@ -459,11 +460,11 @@ last statement in BODY, as elisp."
|
||||
"R-specific processing of return value.
|
||||
Insert hline if column names in output have been requested."
|
||||
(if column-names-p
|
||||
(cons (car result) (cons 'hline (cdr result)))
|
||||
(condition-case nil
|
||||
(cons (car result) (cons 'hline (cdr result)))
|
||||
(error "Could not parse R result"))
|
||||
result))
|
||||
|
||||
(provide 'ob-R)
|
||||
|
||||
|
||||
|
||||
;;; ob-R.el ends here
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
;; Author: William Waites
|
||||
;; Keywords: literate programming, music
|
||||
;; Homepage: http://www.tardis.ed.ac.uk/wwaites
|
||||
;; Version: 0.01
|
||||
;; Homepage: https://www.tardis.ed.ac.uk/~wwaites
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
@@ -87,4 +86,5 @@
|
||||
(error "ABC does not support sessions"))
|
||||
|
||||
(provide 'ob-abc)
|
||||
|
||||
;;; ob-abc.el ends here
|
||||
|
||||
@@ -134,6 +134,4 @@ Otherwise, it is either `real', if some elements are floats, or
|
||||
|
||||
(provide 'ob-asymptote)
|
||||
|
||||
|
||||
|
||||
;;; ob-asymptote.el ends here
|
||||
|
||||
@@ -106,6 +106,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-awk)
|
||||
|
||||
|
||||
|
||||
;;; ob-awk.el ends here
|
||||
|
||||
@@ -105,6 +105,4 @@
|
||||
|
||||
(provide 'ob-calc)
|
||||
|
||||
|
||||
|
||||
;;; ob-calc.el ends here
|
||||
|
||||
+150
-182
@@ -30,77 +30,65 @@
|
||||
|
||||
;; - clojure (at least 1.2.0)
|
||||
;; - clojure-mode
|
||||
;; - either cider or SLIME
|
||||
;; - inf-clojure, cider or SLIME
|
||||
|
||||
;; For Cider, see https://github.com/clojure-emacs/cider
|
||||
;; For clojure-mode, see https://github.com/clojure-emacs/clojure-mode
|
||||
;; For cider, see https://github.com/clojure-emacs/cider
|
||||
;; For inf-clojure, see https://github.com/clojure-emacs/cider
|
||||
|
||||
;; For SLIME, the best way to install these components is by following
|
||||
;; the directions as set out by Phil Hagelberg (Technomancy) on the
|
||||
;; web page: http://technomancy.us/126
|
||||
|
||||
;;; Code:
|
||||
(require 'cl-lib)
|
||||
(require 'ob)
|
||||
(require 'org-macs)
|
||||
|
||||
(declare-function cider-jack-in "ext:cider" (&optional prompt-project cljs-too))
|
||||
(declare-function cider-current-connection "ext:cider-client" (&optional type))
|
||||
(declare-function cider-current-ns "ext:cider-client" ())
|
||||
(declare-function cider-repls "ext:cider-connection" (&optional type ensure))
|
||||
(declare-function nrepl--merge "ext:nrepl-client" (dict1 dict2))
|
||||
(declare-function inf-clojure "ext:inf-clojure" (cmd))
|
||||
(declare-function inf-clojure-cmd "ext:inf-clojure" (project-type))
|
||||
(declare-function inf-clojure-eval-string "ext:inf-clojure" (code))
|
||||
(declare-function inf-clojure-project-type "ext:inf-clojure" ())
|
||||
(declare-function nrepl-dict-get "ext:nrepl-client" (dict key))
|
||||
(declare-function nrepl-dict-put "ext:nrepl-client" (dict key value))
|
||||
(declare-function nrepl-request:eval "ext:nrepl-client" (input callback connection &optional ns line column additional-params tooling))
|
||||
(declare-function nrepl-sync-request:eval "ext:nrepl-client" (input connection &optional ns tooling))
|
||||
(declare-function sesman-start-session "ext:sesman" (system))
|
||||
(declare-function slime-eval "ext:slime" (sexp &optional package))
|
||||
|
||||
(defvar nrepl-sync-request-timeout)
|
||||
(defvar cider-buffer-ns)
|
||||
(defvar sesman-system)
|
||||
(defvar cider-version)
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("clojurescript" . "cljs"))
|
||||
|
||||
(defvar org-babel-default-header-args:clojure '())
|
||||
(defvar org-babel-header-args:clojure '((ns . :any)
|
||||
(package . :any)))
|
||||
(defvar org-babel-header-args:clojure '((ns . :any) (package . :any)))
|
||||
(defvar org-babel-default-header-args:clojurescript '())
|
||||
(defvar org-babel-header-args:clojurescript '((package . :any)))
|
||||
|
||||
(defcustom org-babel-clojure-sync-nrepl-timeout 10
|
||||
"Timeout value, in seconds, of a Clojure sync call.
|
||||
If the value is nil, timeout is disabled."
|
||||
:group 'org-babel
|
||||
:type 'integer
|
||||
:version "26.1"
|
||||
:package-version '(Org . "9.1")
|
||||
:safe #'wholenump)
|
||||
|
||||
(defcustom org-babel-clojure-backend
|
||||
(cond ((featurep 'cider) 'cider)
|
||||
(t 'slime))
|
||||
(defcustom org-babel-clojure-backend nil
|
||||
"Backend used to evaluate Clojure code blocks."
|
||||
:group 'org-babel
|
||||
:type '(choice
|
||||
(const :tag "inf-clojure" inf-clojure)
|
||||
(const :tag "cider" cider)
|
||||
(const :tag "SLIME" slime)))
|
||||
(const :tag "slime" slime)
|
||||
(const :tag "Not configured yet" nil)))
|
||||
|
||||
(defcustom org-babel-clojure-default-ns "user"
|
||||
"Default Clojure namespace for source block when finding ns failed."
|
||||
:type 'string
|
||||
:group 'org-babel)
|
||||
|
||||
(defun org-babel-clojure-cider-current-ns ()
|
||||
"Like `cider-current-ns' except `cider-find-ns'."
|
||||
(or cider-buffer-ns
|
||||
(let ((repl-buf (cider-current-connection)))
|
||||
(and repl-buf (buffer-local-value 'cider-buffer-ns repl-buf)))
|
||||
org-babel-clojure-default-ns))
|
||||
|
||||
(defun org-babel-expand-body:clojure (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
(let* ((vars (org-babel--get-vars params))
|
||||
(ns (or (cdr (assq :ns params))
|
||||
(org-babel-clojure-cider-current-ns)))
|
||||
(if (eq org-babel-clojure-backend 'cider)
|
||||
(or cider-buffer-ns
|
||||
(let ((repl-buf (cider-current-connection)))
|
||||
(and repl-buf (buffer-local-value
|
||||
'cider-buffer-ns repl-buf))))
|
||||
org-babel-clojure-default-ns)))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
(print-level nil)
|
||||
(print-length nil)
|
||||
@@ -124,161 +112,141 @@ If the value is nil, timeout is disabled."
|
||||
(format "(clojure.pprint/pprint (do %s))" body)
|
||||
body)))
|
||||
|
||||
(defun org-babel-execute:clojure (body params)
|
||||
"Execute a block of Clojure code with Babel.
|
||||
The underlying process performed by the code block can be output
|
||||
using the :show-process parameter."
|
||||
(let* ((expanded (org-babel-expand-body:clojure body params))
|
||||
(response (list 'dict))
|
||||
result)
|
||||
(cl-case org-babel-clojure-backend
|
||||
(cider
|
||||
(require 'cider)
|
||||
(let ((result-params (cdr (assq :result-params params)))
|
||||
(show (cdr (assq :show-process params))))
|
||||
(if (member show '(nil "no"))
|
||||
;; Run code without showing the process.
|
||||
(progn
|
||||
(setq response
|
||||
(let ((nrepl-sync-request-timeout
|
||||
org-babel-clojure-sync-nrepl-timeout))
|
||||
(nrepl-sync-request:eval expanded
|
||||
(cider-current-connection))))
|
||||
(setq result
|
||||
(concat
|
||||
(nrepl-dict-get response
|
||||
(if (or (member "output" result-params)
|
||||
(member "pp" result-params))
|
||||
"out"
|
||||
"value"))
|
||||
(nrepl-dict-get response "ex")
|
||||
(nrepl-dict-get response "root-ex")
|
||||
(nrepl-dict-get response "err"))))
|
||||
;; Show the process in an output buffer/window.
|
||||
(let ((process-buffer (switch-to-buffer-other-window
|
||||
"*Clojure Show Process Sub Buffer*"))
|
||||
status)
|
||||
;; Run the Clojure code in nREPL.
|
||||
(nrepl-request:eval
|
||||
expanded
|
||||
(lambda (resp)
|
||||
(when (member "out" resp)
|
||||
;; Print the output of the nREPL in the output buffer.
|
||||
(princ (nrepl-dict-get resp "out") process-buffer))
|
||||
(when (member "ex" resp)
|
||||
;; In case there is an exception, then add it to the
|
||||
;; output buffer as well.
|
||||
(princ (nrepl-dict-get resp "ex") process-buffer)
|
||||
(princ (nrepl-dict-get resp "root-ex") process-buffer))
|
||||
(when (member "err" resp)
|
||||
;; In case there is an error, then add it to the
|
||||
;; output buffer as well.
|
||||
(princ (nrepl-dict-get resp "err") process-buffer))
|
||||
(nrepl--merge response resp)
|
||||
;; Update the status of the nREPL output session.
|
||||
(setq status (nrepl-dict-get response "status")))
|
||||
(cider-current-connection))
|
||||
(defvar ob-clojure-inf-clojure-filter-out)
|
||||
(defvar ob-clojure-inf-clojure-tmp-output)
|
||||
(defun ob-clojure-inf-clojure-output (s)
|
||||
"Store a trimmed version of S in a variable and return S."
|
||||
(let ((s0 (org-trim
|
||||
(replace-regexp-in-string
|
||||
ob-clojure-inf-clojure-filter-out "" s))))
|
||||
(push s0 ob-clojure-inf-clojure-tmp-output))
|
||||
s)
|
||||
|
||||
;; Wait until the nREPL code finished to be processed.
|
||||
(while (not (member "done" status))
|
||||
(nrepl-dict-put response "status" (remove "need-input" status))
|
||||
(accept-process-output nil 0.01)
|
||||
(redisplay))
|
||||
(defmacro ob-clojure-with-temp-expanded (expanded params &rest body)
|
||||
"Run BODY on EXPANDED code block with PARAMS."
|
||||
(declare (debug (body)) (indent 2))
|
||||
`(with-temp-buffer
|
||||
(insert ,expanded)
|
||||
(goto-char (point-min))
|
||||
(while (not (looking-at "\\s-*\\'"))
|
||||
(let* ((beg (point))
|
||||
(end (progn (forward-sexp) (point)))
|
||||
(exp (org-babel-expand-body:clojure
|
||||
(buffer-substring beg end) ,params)))
|
||||
(sit-for .1)
|
||||
,@body))))
|
||||
|
||||
;; Delete the show buffer & window when the processing is
|
||||
;; finalized.
|
||||
(mapc #'delete-window
|
||||
(get-buffer-window-list process-buffer nil t))
|
||||
(kill-buffer process-buffer)
|
||||
(defsubst ob-clojure-string-or-list (l)
|
||||
"Convert list L into a string or a list of list."
|
||||
(if (and (listp l) (= (length l) 1))
|
||||
(car l)
|
||||
(mapcar #'list l)))
|
||||
|
||||
;; Put the output or the value in the result section of
|
||||
;; the code block.
|
||||
(setq result
|
||||
(concat
|
||||
(nrepl-dict-get response
|
||||
(if (or (member "output" result-params)
|
||||
(member "pp" result-params))
|
||||
"out"
|
||||
"value"))
|
||||
(defvar inf-clojure-buffer)
|
||||
(defvar comint-prompt-regexp)
|
||||
(defvar inf-clojure-comint-prompt-regexp)
|
||||
(defun ob-clojure-eval-with-inf-clojure (expanded params)
|
||||
"Evaluate EXPANDED code block with PARAMS using inf-clojure."
|
||||
(condition-case nil (require 'inf-clojure)
|
||||
(user-error "inf-clojure not available"))
|
||||
;; Maybe initiate the inf-clojure session
|
||||
(unless (and inf-clojure-buffer
|
||||
(buffer-live-p (get-buffer inf-clojure-buffer)))
|
||||
(save-window-excursion
|
||||
(let* ((alias (cdr (assq :alias params)))
|
||||
(cmd0 (inf-clojure-cmd (inf-clojure-project-type)))
|
||||
(cmd (if alias (replace-regexp-in-string
|
||||
"clojure" (format "clojure -A%s" alias)
|
||||
cmd0)
|
||||
cmd0)))
|
||||
(setq comint-prompt-regexp inf-clojure-comint-prompt-regexp)
|
||||
(funcall-interactively #'inf-clojure cmd)
|
||||
(goto-char (point-max))))
|
||||
(sit-for 1))
|
||||
;; Now evaluate the code
|
||||
(setq ob-clojure-inf-clojure-filter-out
|
||||
(concat "^nil\\|nil$\\|\\s-*"
|
||||
(or (cdr (assq :ns params))
|
||||
org-babel-clojure-default-ns)
|
||||
"=>\\s-*"))
|
||||
(add-hook 'comint-preoutput-filter-functions
|
||||
#'ob-clojure-inf-clojure-output)
|
||||
(setq ob-clojure-inf-clojure-tmp-output nil)
|
||||
(ob-clojure-with-temp-expanded expanded nil
|
||||
(inf-clojure-eval-string exp))
|
||||
(sit-for .5)
|
||||
(remove-hook 'comint-preoutput-filter-functions
|
||||
#'ob-clojure-inf-clojure-output)
|
||||
;; And return the result
|
||||
(ob-clojure-string-or-list
|
||||
(delete nil
|
||||
(mapcar
|
||||
(lambda (s)
|
||||
(unless (or (equal "" s)
|
||||
(string-match-p "^Clojure" s))
|
||||
s))
|
||||
(reverse ob-clojure-inf-clojure-tmp-output)))))
|
||||
|
||||
(defun ob-clojure-eval-with-cider (expanded params)
|
||||
"Evaluate EXPANDED code block with PARAMS using cider."
|
||||
(condition-case nil (require 'cider)
|
||||
(user-error "cider not available"))
|
||||
(let ((connection (cider-current-connection (cdr (assq :target params))))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
result0)
|
||||
(unless connection (sesman-start-session 'CIDER))
|
||||
(if (not connection)
|
||||
;; Display in the result instead of using `user-error'
|
||||
(setq result0 "Please reevaluate when nREPL is connected")
|
||||
(ob-clojure-with-temp-expanded expanded params
|
||||
(let ((response (nrepl-sync-request:eval exp connection)))
|
||||
(push (or (nrepl-dict-get response "root-ex")
|
||||
(nrepl-dict-get response "ex")
|
||||
(nrepl-dict-get response "root-ex")
|
||||
(nrepl-dict-get response "err")))))))
|
||||
(slime
|
||||
(require 'slime)
|
||||
(with-temp-buffer
|
||||
(insert expanded)
|
||||
(setq result
|
||||
(slime-eval
|
||||
`(swank:eval-and-grab-output
|
||||
,(buffer-substring-no-properties (point-min) (point-max)))
|
||||
(cdr (assq :package params)))))))
|
||||
(org-babel-result-cond (cdr (assq :result-params params))
|
||||
(nrepl-dict-get
|
||||
response (if (or (member "output" result-params)
|
||||
(member "pp" result-params))
|
||||
"out"
|
||||
"value")))
|
||||
result0)))
|
||||
(ob-clojure-string-or-list
|
||||
(reverse (delete "" (mapcar (lambda (r)
|
||||
(replace-regexp-in-string "nil" "" r))
|
||||
result0)))))))
|
||||
|
||||
(defun ob-clojure-eval-with-slime (expanded params)
|
||||
"Evaluate EXPANDED code block with PARAMS using slime."
|
||||
(condition-case nil (require 'slime)
|
||||
(user-error "slime not available"))
|
||||
(with-temp-buffer
|
||||
(insert expanded)
|
||||
(slime-eval
|
||||
`(swank:eval-and-grab-output
|
||||
,(buffer-substring-no-properties (point-min) (point-max)))
|
||||
(cdr (assq :package params)))))
|
||||
|
||||
(defun org-babel-execute:clojure (body params)
|
||||
"Execute a block of Clojure code with Babel."
|
||||
(unless org-babel-clojure-backend
|
||||
(user-error "You need to customize org-babel-clojure-backend"))
|
||||
(let* ((expanded (org-babel-expand-body:clojure body params))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
result)
|
||||
(setq result
|
||||
(cond
|
||||
((eq org-babel-clojure-backend 'inf-clojure)
|
||||
(ob-clojure-eval-with-inf-clojure expanded params))
|
||||
((eq org-babel-clojure-backend 'cider)
|
||||
(ob-clojure-eval-with-cider expanded params))
|
||||
((eq org-babel-clojure-backend 'slime)
|
||||
(ob-clojure-eval-with-slime expanded params))))
|
||||
(org-babel-result-cond result-params
|
||||
result
|
||||
(condition-case nil (org-babel-script-escape result)
|
||||
(error result)))))
|
||||
|
||||
(defun org-babel-clojure-initiate-session (&optional session _params)
|
||||
"Initiate a session named SESSION according to PARAMS."
|
||||
(when (and session (not (string= session "none")))
|
||||
(save-window-excursion
|
||||
(cond
|
||||
((org-babel-comint-buffer-livep session) nil)
|
||||
;; CIDER jack-in to the Clojure project directory.
|
||||
((eq org-babel-clojure-backend 'cider)
|
||||
(require 'cider)
|
||||
(let ((session-buffer
|
||||
(save-window-excursion
|
||||
(if (version< cider-version "0.18.0")
|
||||
;; Older CIDER (without sesman) still need to use
|
||||
;; old way.
|
||||
(cider-jack-in nil) ;jack-in without project
|
||||
;; New CIDER (with sesman to manage sessions).
|
||||
(unless (cider-repls)
|
||||
(let ((sesman-system 'CIDER))
|
||||
(call-interactively 'sesman-link-with-directory))))
|
||||
(current-buffer))))
|
||||
(when (org-babel-comint-buffer-livep session-buffer)
|
||||
(sit-for .25)
|
||||
session-buffer)))
|
||||
((eq org-babel-clojure-backend 'slime)
|
||||
(error "Session evaluation with SLIME is not supported"))
|
||||
(t
|
||||
(error "Session initiate failed")))
|
||||
(get-buffer session))))
|
||||
|
||||
(defun org-babel-prep-session:clojure (session params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(let ((session (org-babel-clojure-initiate-session session))
|
||||
(var-lines (org-babel-variable-assignments:clojure params)))
|
||||
(when session
|
||||
(org-babel-comint-in-buffer session
|
||||
(dolist (var var-lines)
|
||||
(insert var)
|
||||
(comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)
|
||||
(sit-for .1)
|
||||
(goto-char (point-max)))))
|
||||
session))
|
||||
|
||||
(defun org-babel-clojure-var-to-clojure (var)
|
||||
"Convert src block's VAR to Clojure variable."
|
||||
(cond
|
||||
((listp var)
|
||||
(replace-regexp-in-string "(" "'(" var))
|
||||
((stringp var)
|
||||
;; Wrap Babel passed-in header argument value with quotes in Clojure.
|
||||
(format "\"%s\"" var))
|
||||
(t
|
||||
(format "%S" var))))
|
||||
|
||||
(defun org-babel-variable-assignments:clojure (params)
|
||||
"Return a list of Clojure statements assigning the block's variables in PARAMS."
|
||||
(mapcar
|
||||
(lambda (pair)
|
||||
(format "(def %s %s)"
|
||||
(car pair)
|
||||
(org-babel-clojure-var-to-clojure (cdr pair))))
|
||||
(org-babel--get-vars params)))
|
||||
(defun org-babel-execute:clojurescript (body params)
|
||||
"Evaluate BODY with PARAMS as ClojureScript code."
|
||||
(org-babel-execute:clojure body (cons '(:target . "cljs") params)))
|
||||
|
||||
(provide 'ob-clojure)
|
||||
|
||||
|
||||
@@ -151,6 +151,4 @@ FILE exists at end of evaluation."
|
||||
|
||||
(provide 'ob-comint)
|
||||
|
||||
|
||||
|
||||
;;; ob-comint.el ends here
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
;; session evaluation is supported. Requires both coq.el and
|
||||
;; coq-inferior.el, both of which are distributed with Coq.
|
||||
;;
|
||||
;; http://coq.inria.fr/
|
||||
;; https://coq.inria.fr/
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
@@ -76,3 +76,5 @@ create one. Return the initialized session."
|
||||
(get-buffer org-babel-coq-buffer))
|
||||
|
||||
(provide 'ob-coq)
|
||||
|
||||
;;; ob-coq.el ends here
|
||||
|
||||
+303
-231
@@ -38,6 +38,7 @@
|
||||
(defvar org-link-file-path-type)
|
||||
(defvar org-src-lang-modes)
|
||||
(defvar org-src-preserve-indentation)
|
||||
(defvar org-babel-tangle-uncomment-comments)
|
||||
|
||||
(declare-function org-at-item-p "org-list" ())
|
||||
(declare-function org-at-table-p "org" (&optional table-type))
|
||||
@@ -59,6 +60,7 @@
|
||||
(declare-function org-element-type "org-element" (element))
|
||||
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
|
||||
(declare-function org-escape-code-in-region "org-src" (beg end))
|
||||
(declare-function org-forward-heading-same-level "org" (arg &optional invisible-ok))
|
||||
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
||||
(declare-function org-indent-line "org" ())
|
||||
(declare-function org-list-get-list-end "org-list" (item struct prevs))
|
||||
@@ -67,7 +69,6 @@
|
||||
(declare-function org-list-to-generic "org-list" (LIST PARAMS))
|
||||
(declare-function org-list-to-lisp "org-list" (&optional delete))
|
||||
(declare-function org-macro-escape-arguments "org-macro" (&rest args))
|
||||
(declare-function org-make-options-regexp "org" (kwds &optional extra))
|
||||
(declare-function org-mark-ring-push "org" (&optional pos buffer))
|
||||
(declare-function org-narrow-to-subtree "org" ())
|
||||
(declare-function org-next-block "org" (arg &optional backward block-regexp))
|
||||
@@ -78,6 +79,7 @@
|
||||
(declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
|
||||
(declare-function org-src-get-lang-mode "org-src" (lang))
|
||||
(declare-function org-table-align "org-table" ())
|
||||
(declare-function org-table-convert-region "org-table" (beg0 end0 &optional separator))
|
||||
(declare-function org-table-end "org-table" (&optional table-type))
|
||||
(declare-function org-table-import "org-table" (file arg))
|
||||
(declare-function org-table-to-lisp "org-table" (&optional txt))
|
||||
@@ -164,7 +166,6 @@ This string must include a \"%s\" which will be replaced by the results."
|
||||
"Non-nil means show the time the code block was evaluated in the result hash."
|
||||
:group 'org-babel
|
||||
:type 'boolean
|
||||
:version "26.1"
|
||||
:package-version '(Org . "9.0")
|
||||
:safe #'booleanp)
|
||||
|
||||
@@ -238,7 +239,8 @@ should be asked whether to allow evaluation."
|
||||
(if (functionp org-confirm-babel-evaluate)
|
||||
(funcall org-confirm-babel-evaluate
|
||||
;; Language, code block body.
|
||||
(nth 0 info) (nth 1 info))
|
||||
(nth 0 info)
|
||||
(org-babel--expand-body info))
|
||||
org-confirm-babel-evaluate))))
|
||||
(cond
|
||||
(noeval nil)
|
||||
@@ -400,6 +402,7 @@ then run `org-babel-switch-to-session'."
|
||||
(file . :any)
|
||||
(file-desc . :any)
|
||||
(file-ext . :any)
|
||||
(file-mode . ((#o755 #o555 #o444 :any)))
|
||||
(hlines . ((no yes)))
|
||||
(mkdirp . ((yes no)))
|
||||
(no-expand)
|
||||
@@ -487,11 +490,21 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'."
|
||||
"Regexp matching a NAME keyword.")
|
||||
|
||||
(defconst org-babel-result-regexp
|
||||
(format "^[ \t]*#\\+%s\\(?:\\[\\(?:%s \\)?\\([[:alnum:]]+\\)\\]\\)?:[ \t]*"
|
||||
org-babel-results-keyword
|
||||
;; <%Y-%m-%d %H:%M:%S>
|
||||
"<\\(?:[0-9]\\{4\\}-[0-1][0-9]-[0-3][0-9] \
|
||||
[0-2][0-9]\\(?::[0-5][0-9]\\)\\{2\\}\\)>")
|
||||
(rx (seq bol
|
||||
(zero-or-more (any "\t "))
|
||||
"#+results"
|
||||
(opt "["
|
||||
;; Time stamp part.
|
||||
(opt "("
|
||||
(= 4 digit) (= 2 "-" (= 2 digit))
|
||||
" "
|
||||
(= 2 digit) (= 2 ":" (= 2 digit))
|
||||
") ")
|
||||
;; SHA1 hash.
|
||||
(group (one-or-more hex-digit))
|
||||
"]")
|
||||
":"
|
||||
(zero-or-more (any "\t "))))
|
||||
"Regular expression used to match result lines.
|
||||
If the results are associated with a hash key then the hash will
|
||||
be saved in match group 1.")
|
||||
@@ -622,6 +635,17 @@ a list with the following pattern:
|
||||
(setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
|
||||
info))))
|
||||
|
||||
(defun org-babel--expand-body (info)
|
||||
"Expand noweb references in body and remove any coderefs."
|
||||
(let ((coderef (nth 6 info))
|
||||
(expand
|
||||
(if (org-babel-noweb-p (nth 2 info) :eval)
|
||||
(org-babel-expand-noweb-references info)
|
||||
(nth 1 info))))
|
||||
(if (not coderef) expand
|
||||
(replace-regexp-in-string
|
||||
(org-src-coderef-regexp coderef) "" expand nil nil 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-execute-src-block (&optional arg info params)
|
||||
"Execute the current source code block.
|
||||
@@ -667,17 +691,7 @@ block."
|
||||
((org-babel-confirm-evaluate info)
|
||||
(let* ((lang (nth 0 info))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
;; Expand noweb references in BODY and remove any
|
||||
;; coderef.
|
||||
(body
|
||||
(let ((coderef (nth 6 info))
|
||||
(expand
|
||||
(if (org-babel-noweb-p params :eval)
|
||||
(org-babel-expand-noweb-references info)
|
||||
(nth 1 info))))
|
||||
(if (not coderef) expand
|
||||
(replace-regexp-in-string
|
||||
(org-src-coderef-regexp coderef) "" expand nil nil 1))))
|
||||
(body (org-babel--expand-body info))
|
||||
(dir (cdr (assq :dir params)))
|
||||
(mkdirp (cdr (assq :mkdirp params)))
|
||||
(default-directory
|
||||
@@ -721,7 +735,11 @@ block."
|
||||
(with-temp-file file
|
||||
(insert (org-babel-format-result
|
||||
result
|
||||
(cdr (assq :sep params))))))
|
||||
(cdr (assq :sep params)))))
|
||||
;; Set file permissions if header argument
|
||||
;; `:file-mode' is provided.
|
||||
(when (assq :file-mode params)
|
||||
(set-file-modes file (cdr (assq :file-mode params)))))
|
||||
(setq result file))
|
||||
;; Possibly perform post process provided its
|
||||
;; appropriate. Dynamically bind "*this*" to the
|
||||
@@ -1301,10 +1319,9 @@ CONTEXT specifies the context of evaluation. It can be `:eval',
|
||||
"Return the current in-buffer hash."
|
||||
(let ((result (org-babel-where-is-src-block-result nil info)))
|
||||
(when result
|
||||
(org-with-wide-buffer
|
||||
(goto-char result)
|
||||
(looking-at org-babel-result-regexp)
|
||||
(match-string-no-properties 1)))))
|
||||
(org-with-point-at result
|
||||
(let ((case-fold-search t)) (looking-at org-babel-result-regexp))
|
||||
(match-string-no-properties 1)))))
|
||||
|
||||
(defun org-babel-hide-hash ()
|
||||
"Hide the hash in the current results line.
|
||||
@@ -1312,7 +1329,8 @@ Only the initial `org-babel-hash-show' characters of the hash
|
||||
will remain visible."
|
||||
(add-to-invisibility-spec '(org-babel-hide-hash . t))
|
||||
(save-excursion
|
||||
(when (and (re-search-forward org-babel-result-regexp nil t)
|
||||
(when (and (let ((case-fold-search t))
|
||||
(re-search-forward org-babel-result-regexp nil t))
|
||||
(match-string 1))
|
||||
(let* ((start (match-beginning 1))
|
||||
(hide-start (+ org-babel-hash-show start))
|
||||
@@ -1330,11 +1348,12 @@ Only the initial `org-babel-hash-show' characters of each hash
|
||||
will remain visible. This function should be called as part of
|
||||
the `org-mode-hook'."
|
||||
(save-excursion
|
||||
(while (and (not org-babel-hash-show-time)
|
||||
(re-search-forward org-babel-result-regexp nil t))
|
||||
(goto-char (match-beginning 0))
|
||||
(org-babel-hide-hash)
|
||||
(goto-char (match-end 0)))))
|
||||
(let ((case-fold-search t))
|
||||
(while (and (not org-babel-hash-show-time)
|
||||
(re-search-forward org-babel-result-regexp nil t))
|
||||
(goto-char (match-beginning 0))
|
||||
(org-babel-hide-hash)
|
||||
(goto-char (match-end 0))))))
|
||||
(add-hook 'org-mode-hook 'org-babel-hide-all-hashes)
|
||||
|
||||
(defun org-babel-hash-at-point (&optional point)
|
||||
@@ -1363,9 +1382,10 @@ portions of results lines."
|
||||
(interactive)
|
||||
(org-babel-show-result-all)
|
||||
(save-excursion
|
||||
(while (re-search-forward org-babel-result-regexp nil t)
|
||||
(save-excursion (goto-char (match-beginning 0))
|
||||
(org-babel-hide-result-toggle-maybe)))))
|
||||
(let ((case-fold-search t))
|
||||
(while (re-search-forward org-babel-result-regexp nil t)
|
||||
(save-excursion (goto-char (match-beginning 0))
|
||||
(org-babel-hide-result-toggle-maybe))))))
|
||||
|
||||
(defun org-babel-show-result-all ()
|
||||
"Unfold all results in the current buffer."
|
||||
@@ -1377,52 +1397,50 @@ portions of results lines."
|
||||
"Toggle visibility of result at point."
|
||||
(interactive)
|
||||
(let ((case-fold-search t))
|
||||
(if (save-excursion
|
||||
(beginning-of-line 1)
|
||||
(looking-at org-babel-result-regexp))
|
||||
(progn (org-babel-hide-result-toggle)
|
||||
t) ;; to signal that we took action
|
||||
nil))) ;; to signal that we did not
|
||||
(and (org-match-line org-babel-result-regexp)
|
||||
(progn (org-babel-hide-result-toggle) t))))
|
||||
|
||||
(defun org-babel-hide-result-toggle (&optional force)
|
||||
"Toggle the visibility of the current result."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(if (re-search-forward org-babel-result-regexp nil t)
|
||||
(let ((start (progn (beginning-of-line 2) (- (point) 1)))
|
||||
(end (progn
|
||||
(while (looking-at org-babel-multi-line-header-regexp)
|
||||
(forward-line 1))
|
||||
(goto-char (- (org-babel-result-end) 1)) (point)))
|
||||
ov)
|
||||
(if (memq t (mapcar (lambda (overlay)
|
||||
(eq (overlay-get overlay 'invisible)
|
||||
'org-babel-hide-result))
|
||||
(overlays-at start)))
|
||||
(when (or (not force) (eq force 'off))
|
||||
(mapc (lambda (ov)
|
||||
(when (member ov org-babel-hide-result-overlays)
|
||||
(setq org-babel-hide-result-overlays
|
||||
(delq ov org-babel-hide-result-overlays)))
|
||||
(when (eq (overlay-get ov 'invisible)
|
||||
'org-babel-hide-result)
|
||||
(delete-overlay ov)))
|
||||
(overlays-at start)))
|
||||
(setq ov (make-overlay start end))
|
||||
(overlay-put ov 'invisible 'org-babel-hide-result)
|
||||
;; make the block accessible to isearch
|
||||
(overlay-put
|
||||
ov 'isearch-open-invisible
|
||||
(lambda (ov)
|
||||
(when (member ov org-babel-hide-result-overlays)
|
||||
(setq org-babel-hide-result-overlays
|
||||
(delq ov org-babel-hide-result-overlays)))
|
||||
(when (eq (overlay-get ov 'invisible)
|
||||
'org-babel-hide-result)
|
||||
(delete-overlay ov))))
|
||||
(push ov org-babel-hide-result-overlays)))
|
||||
(error "Not looking at a result line"))))
|
||||
(let ((case-fold-search t))
|
||||
(unless (re-search-forward org-babel-result-regexp nil t)
|
||||
(error "Not looking at a result line")))
|
||||
(let ((start (progn (beginning-of-line 2) (1- (point))))
|
||||
(end (progn
|
||||
(while (looking-at org-babel-multi-line-header-regexp)
|
||||
(forward-line 1))
|
||||
(goto-char (1- (org-babel-result-end)))
|
||||
(point)))
|
||||
ov)
|
||||
(if (memq t (mapcar (lambda (overlay)
|
||||
(eq (overlay-get overlay 'invisible)
|
||||
'org-babel-hide-result))
|
||||
(overlays-at start)))
|
||||
(when (or (not force) (eq force 'off))
|
||||
(mapc (lambda (ov)
|
||||
(when (member ov org-babel-hide-result-overlays)
|
||||
(setq org-babel-hide-result-overlays
|
||||
(delq ov org-babel-hide-result-overlays)))
|
||||
(when (eq (overlay-get ov 'invisible)
|
||||
'org-babel-hide-result)
|
||||
(delete-overlay ov)))
|
||||
(overlays-at start)))
|
||||
(setq ov (make-overlay start end))
|
||||
(overlay-put ov 'invisible 'org-babel-hide-result)
|
||||
;; make the block accessible to isearch
|
||||
(overlay-put
|
||||
ov 'isearch-open-invisible
|
||||
(lambda (ov)
|
||||
(when (member ov org-babel-hide-result-overlays)
|
||||
(setq org-babel-hide-result-overlays
|
||||
(delq ov org-babel-hide-result-overlays)))
|
||||
(when (eq (overlay-get ov 'invisible)
|
||||
'org-babel-hide-result)
|
||||
(delete-overlay ov))))
|
||||
(push ov org-babel-hide-result-overlays)))))
|
||||
|
||||
;; org-tab-after-check-for-cycling-hook
|
||||
(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe)
|
||||
@@ -1654,7 +1672,8 @@ Note: this function removes any hlines in TABLE."
|
||||
(mapcar (lambda (row)
|
||||
(if (listp row)
|
||||
(cons (or (pop rownames) "") row)
|
||||
row)) table)
|
||||
row))
|
||||
table)
|
||||
table))
|
||||
|
||||
(defun org-babel-pick-name (names selector)
|
||||
@@ -1879,9 +1898,9 @@ region is not active then the point is demarcated."
|
||||
(block (and start (match-string 0)))
|
||||
(headers (and start (match-string 4)))
|
||||
(stars (concat (make-string (or (org-current-level) 1) ?*) " "))
|
||||
(lower-case-p (and block
|
||||
(upper-case-p (and block
|
||||
(let (case-fold-search)
|
||||
(string-match-p "#\\+begin_src" block)))))
|
||||
(string-match-p "#\\+BEGIN_SRC" block)))))
|
||||
(if info
|
||||
(mapc
|
||||
(lambda (place)
|
||||
@@ -1895,9 +1914,9 @@ region is not active then the point is demarcated."
|
||||
(delete-region (point-at-bol) (point-at-eol)))
|
||||
(insert (concat
|
||||
(if (looking-at "^") "" "\n")
|
||||
indent (funcall (if lower-case-p 'downcase 'upcase) "#+end_src\n")
|
||||
indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
|
||||
(if arg stars indent) "\n"
|
||||
indent (funcall (if lower-case-p 'downcase 'upcase) "#+begin_src ")
|
||||
indent (if upper-case-p "#+BEGIN_SRC " "#+begin_src ")
|
||||
lang
|
||||
(if (> (length headers) 1)
|
||||
(concat " " headers) headers)
|
||||
@@ -1918,14 +1937,16 @@ region is not active then the point is demarcated."
|
||||
(if (org-region-active-p) (mark) (point)) (point))))
|
||||
(insert (concat (if (looking-at "^") "" "\n")
|
||||
(if arg (concat stars "\n") "")
|
||||
(funcall (if lower-case-p 'downcase 'upcase) "#+begin_src ")
|
||||
lang "\n"
|
||||
body
|
||||
(if upper-case-p "#+BEGIN_SRC " "#+begin_src ")
|
||||
lang "\n" body
|
||||
(if (or (= (length body) 0)
|
||||
(string-suffix-p "\r" body)
|
||||
(string-suffix-p "\n" body)) "" "\n")
|
||||
(funcall (if lower-case-p 'downcase 'upcase) "#+end_src\n")))
|
||||
(goto-char start) (move-end-of-line 1)))))
|
||||
(string-suffix-p "\n" body))
|
||||
""
|
||||
"\n")
|
||||
(if upper-case-p "#+END_SRC\n" "#+end_src\n")))
|
||||
(goto-char start)
|
||||
(move-end-of-line 1)))))
|
||||
|
||||
(defun org-babel--insert-results-keyword (name hash)
|
||||
"Insert RESULTS keyword with NAME value at point.
|
||||
@@ -1938,7 +1959,7 @@ the results hash, or nil. Leave point before the keyword."
|
||||
(cond ((not hash) nil)
|
||||
(org-babel-hash-show-time
|
||||
(format "[%s %s]"
|
||||
(format-time-string "<%F %T>")
|
||||
(format-time-string "(%F %T)")
|
||||
hash))
|
||||
(t (format "[%s]" hash)))
|
||||
":"
|
||||
@@ -1964,7 +1985,7 @@ point, along with related contents. Do nothing if HASH is nil.
|
||||
Return a non-nil value if results were cleared. In this case,
|
||||
leave point where new results should be inserted."
|
||||
(when hash
|
||||
(looking-at org-babel-result-regexp)
|
||||
(let ((case-fold-search t)) (looking-at org-babel-result-regexp))
|
||||
(unless (string= (match-string 1) hash)
|
||||
(let* ((e (org-element-at-point))
|
||||
(post (copy-marker (org-element-property :post-affiliated e))))
|
||||
@@ -2371,13 +2392,58 @@ INFO may provide the values of these header arguments (in the
|
||||
(org-babel-chomp result "\n"))))
|
||||
(t (goto-char beg) (insert result)))
|
||||
(setq end (copy-marker (point) t))
|
||||
;; possibly wrap result
|
||||
;; Possibly wrap result.
|
||||
(cond
|
||||
((assq :wrap (nth 2 info))
|
||||
(let ((name (or (cdr (assq :wrap (nth 2 info))) "results")))
|
||||
(funcall wrap (concat "#+begin_" name)
|
||||
(concat "#+end_" (car (split-string name)))
|
||||
nil nil (concat "{{{results(@@" name ":") "@@)}}}")))
|
||||
(let* ((full (or (cdr (assq :wrap (nth 2 info))) "results"))
|
||||
(split (split-string full))
|
||||
(type (car split))
|
||||
(opening-line (concat "#+begin_" full))
|
||||
(closing-line (concat "#+end_" type)))
|
||||
(cond
|
||||
;; Escape contents from "export" wrap. Wrap
|
||||
;; inline results within an export snippet with
|
||||
;; appropriate value.
|
||||
((eq t (compare-strings type nil nil "export" nil nil t))
|
||||
(let ((backend (pcase split
|
||||
(`(,_) "none")
|
||||
(`(,_ ,b . ,_) b))))
|
||||
(funcall wrap
|
||||
opening-line closing-line
|
||||
nil nil
|
||||
(format "{{{results(@@%s:"
|
||||
backend) "@@)}}}")))
|
||||
;; Escape contents from "example" wrap. Mark
|
||||
;; inline results as verbatim.
|
||||
((eq t (compare-strings type nil nil "example" nil nil t))
|
||||
(funcall wrap
|
||||
opening-line closing-line
|
||||
nil nil
|
||||
"{{{results(=" "=)}}}"))
|
||||
;; Escape contents from "src" wrap. Mark
|
||||
;; inline results as inline source code.
|
||||
((eq t (compare-strings type nil nil "src" nil nil t))
|
||||
(let ((inline-open
|
||||
(pcase split
|
||||
(`(,_)
|
||||
"{{{results(src_none{")
|
||||
(`(,_ ,language)
|
||||
(format "{{{results(src_%s{" language))
|
||||
(`(,_ ,language . ,rest)
|
||||
(let ((r (mapconcat #'identity rest " ")))
|
||||
(format "{{{results(src_%s[%s]{"
|
||||
language r))))))
|
||||
(funcall wrap
|
||||
opening-line closing-line
|
||||
nil nil
|
||||
inline-open "})}}}")))
|
||||
;; Do not escape contents in non-verbatim
|
||||
;; blocks. Return plain inline results.
|
||||
(t
|
||||
(funcall wrap
|
||||
opening-line closing-line
|
||||
t nil
|
||||
"{{{results(" ")}}}")))))
|
||||
((member "html" result-params)
|
||||
(funcall wrap "#+begin_export html" "#+end_export" nil nil
|
||||
"{{{results(@@html:" "@@)}}}"))
|
||||
@@ -2433,11 +2499,12 @@ INFO may provide the values of these header arguments (in the
|
||||
(defun org-babel-remove-result (&optional info keep-keyword)
|
||||
"Remove the result of the current source block."
|
||||
(interactive)
|
||||
(let ((location (org-babel-where-is-src-block-result nil info)))
|
||||
(let ((location (org-babel-where-is-src-block-result nil info))
|
||||
(case-fold-search t))
|
||||
(when location
|
||||
(save-excursion
|
||||
(goto-char location)
|
||||
(when (looking-at (concat org-babel-result-regexp ".*$"))
|
||||
(when (looking-at org-babel-result-regexp)
|
||||
(delete-region
|
||||
(if keep-keyword (line-beginning-position 2)
|
||||
(save-excursion
|
||||
@@ -2488,7 +2555,7 @@ in the buffer."
|
||||
(if (memq (org-element-type element)
|
||||
;; Possible results types.
|
||||
'(drawer example-block export-block fixed-width item
|
||||
plain-list src-block table))
|
||||
plain-list special-block src-block table))
|
||||
(save-excursion
|
||||
(goto-char (min (point-max) ;for narrowed buffers
|
||||
(org-element-property :end element)))
|
||||
@@ -2502,16 +2569,19 @@ If the `default-directory' is different from the containing
|
||||
file's directory then expand relative links."
|
||||
(when (stringp result)
|
||||
(let ((same-directory?
|
||||
(and buffer-file-name
|
||||
(and (buffer-file-name (buffer-base-buffer))
|
||||
(not (string= (expand-file-name default-directory)
|
||||
(expand-file-name
|
||||
(file-name-directory buffer-file-name)))))))
|
||||
(expand-file-name
|
||||
(file-name-directory
|
||||
(buffer-file-name (buffer-base-buffer)))))))))
|
||||
(format "[[file:%s]%s]"
|
||||
(if (and default-directory buffer-file-name same-directory?)
|
||||
(if (and default-directory
|
||||
(buffer-file-name (buffer-base-buffer)) same-directory?)
|
||||
(if (eq org-link-file-path-type 'adaptive)
|
||||
(file-relative-name
|
||||
(expand-file-name result default-directory)
|
||||
(file-name-directory (buffer-file-name)))
|
||||
(file-name-directory
|
||||
(buffer-file-name (buffer-base-buffer))))
|
||||
(expand-file-name result default-directory))
|
||||
result)
|
||||
(if description (concat "[" description "]") "")))))
|
||||
@@ -2707,118 +2777,110 @@ would set the value of argument \"a\" equal to \"9\". Note that
|
||||
these arguments are not evaluated in the current source-code
|
||||
block but are passed literally to the \"example-block\"."
|
||||
(let* ((parent-buffer (or parent-buffer (current-buffer)))
|
||||
(info (or info (org-babel-get-src-block-info 'light)))
|
||||
(info (or info (org-babel-get-src-block-info 'light)))
|
||||
(lang (nth 0 info))
|
||||
(body (nth 1 info))
|
||||
(ob-nww-start org-babel-noweb-wrap-start)
|
||||
(ob-nww-end org-babel-noweb-wrap-end)
|
||||
(new-body "")
|
||||
(nb-add (lambda (text) (setq new-body (concat new-body text))))
|
||||
index source-name evaluate prefix)
|
||||
(with-temp-buffer
|
||||
(setq-local org-babel-noweb-wrap-start ob-nww-start)
|
||||
(setq-local org-babel-noweb-wrap-end ob-nww-end)
|
||||
(insert body) (goto-char (point-min))
|
||||
(setq index (point))
|
||||
(while (and (re-search-forward (org-babel-noweb-wrap) nil t))
|
||||
(save-match-data (setf source-name (match-string 1)))
|
||||
(save-match-data (setq evaluate (string-match "(.*)" source-name)))
|
||||
(save-match-data
|
||||
(setq prefix
|
||||
(buffer-substring (match-beginning 0)
|
||||
(save-excursion
|
||||
(beginning-of-line 1) (point)))))
|
||||
;; add interval to new-body (removing noweb reference)
|
||||
(goto-char (match-beginning 0))
|
||||
(funcall nb-add (buffer-substring index (point)))
|
||||
(goto-char (match-end 0))
|
||||
(setq index (point))
|
||||
(funcall
|
||||
nb-add
|
||||
(with-current-buffer parent-buffer
|
||||
(save-restriction
|
||||
(widen)
|
||||
(mapconcat ;; Interpose PREFIX between every line.
|
||||
#'identity
|
||||
(split-string
|
||||
(if evaluate
|
||||
(let ((raw (org-babel-ref-resolve source-name)))
|
||||
(if (stringp raw) raw (format "%S" raw)))
|
||||
(or
|
||||
;; Retrieve from the Library of Babel.
|
||||
(nth 2 (assoc-string source-name org-babel-library-of-babel))
|
||||
;; Return the contents of headlines literally.
|
||||
(save-excursion
|
||||
(when (org-babel-ref-goto-headline-id source-name)
|
||||
(org-babel-ref-headline-body)))
|
||||
;; Find the expansion of reference in this buffer.
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let* ((name-regexp
|
||||
(org-babel-named-src-block-regexp-for-name
|
||||
source-name))
|
||||
(comment
|
||||
(string= "noweb"
|
||||
(cdr (assq :comments (nth 2 info)))))
|
||||
(c-wrap
|
||||
(lambda (s)
|
||||
;; Comment, according to LANG mode,
|
||||
;; string S. Return new string.
|
||||
(unless org-babel-tangle-uncomment-comments
|
||||
(with-temp-buffer
|
||||
(funcall (org-src-get-lang-mode lang))
|
||||
(comment-region (point)
|
||||
(progn (insert s) (point)))
|
||||
(org-trim (buffer-string))))))
|
||||
(expand-body
|
||||
(lambda (i)
|
||||
;; Expand body of code blocked
|
||||
;; represented by block info I.
|
||||
(let ((b (if (org-babel-noweb-p (nth 2 i) :eval)
|
||||
(org-babel-expand-noweb-references i)
|
||||
(nth 1 i))))
|
||||
(if (not comment) b
|
||||
(let ((cs (org-babel-tangle-comment-links i)))
|
||||
(concat (funcall c-wrap (car cs)) "\n"
|
||||
b "\n"
|
||||
(funcall c-wrap (cadr cs)))))))))
|
||||
(if (and (re-search-forward name-regexp nil t)
|
||||
(not (org-in-commented-heading-p)))
|
||||
;; Found a source block named SOURCE-NAME.
|
||||
;; Assume it is unique; do not look after
|
||||
;; `:noweb-ref' header argument.
|
||||
(funcall expand-body
|
||||
(org-babel-get-src-block-info 'light))
|
||||
;; Though luck. We go into the long process
|
||||
;; of checking each source block and expand
|
||||
;; those with a matching Noweb reference.
|
||||
(let ((expansion nil))
|
||||
(org-babel-map-src-blocks nil
|
||||
(unless (org-in-commented-heading-p)
|
||||
(let* ((info
|
||||
(org-babel-get-src-block-info 'light))
|
||||
(parameters (nth 2 info)))
|
||||
(when (equal source-name
|
||||
(cdr (assq :noweb-ref parameters)))
|
||||
(push (funcall expand-body info) expansion)
|
||||
(push (or (cdr (assq :noweb-sep parameters))
|
||||
"\n")
|
||||
expansion)))))
|
||||
(when expansion
|
||||
(mapconcat #'identity
|
||||
(nreverse (cdr expansion))
|
||||
""))))))
|
||||
;; Possibly raise an error if named block doesn't exist.
|
||||
(if (or org-babel-noweb-error-all-langs
|
||||
(member lang org-babel-noweb-error-langs))
|
||||
(error "%s could not be resolved (see \
|
||||
`org-babel-noweb-error-langs')"
|
||||
(org-babel-noweb-wrap source-name))
|
||||
"")))
|
||||
"[\n\r]")
|
||||
(concat "\n" prefix))))))
|
||||
(funcall nb-add (buffer-substring index (point-max))))
|
||||
new-body))
|
||||
(comment (string= "noweb" (cdr (assq :comments (nth 2 info)))))
|
||||
(noweb-re (format "\\(.*?\\)\\(%s\\)"
|
||||
(with-current-buffer parent-buffer
|
||||
(org-babel-noweb-wrap))))
|
||||
(cache nil)
|
||||
(c-wrap
|
||||
(lambda (s)
|
||||
;; Comment string S, according to LANG mode. Return new
|
||||
;; string.
|
||||
(unless org-babel-tangle-uncomment-comments
|
||||
(with-temp-buffer
|
||||
(funcall (org-src-get-lang-mode lang))
|
||||
(comment-region (point)
|
||||
(progn (insert s) (point)))
|
||||
(org-trim (buffer-string))))))
|
||||
(expand-body
|
||||
(lambda (i)
|
||||
;; Expand body of code represented by block info I.
|
||||
(let ((b (if (org-babel-noweb-p (nth 2 i) :eval)
|
||||
(org-babel-expand-noweb-references i)
|
||||
(nth 1 i))))
|
||||
(if (not comment) b
|
||||
(let ((cs (org-babel-tangle-comment-links i)))
|
||||
(concat (funcall c-wrap (car cs)) "\n"
|
||||
b "\n"
|
||||
(funcall c-wrap (cadr cs))))))))
|
||||
(expand-references
|
||||
(lambda (ref cache)
|
||||
(pcase (gethash ref cache)
|
||||
(`(,last . ,previous)
|
||||
;; Ignore separator for last block.
|
||||
(let ((strings (list (funcall expand-body last))))
|
||||
(dolist (i previous)
|
||||
(let ((parameters (nth 2 i)))
|
||||
;; Since we're operating in reverse order, first
|
||||
;; push separator, then body.
|
||||
(push (or (cdr (assq :noweb-sep parameters)) "\n")
|
||||
strings)
|
||||
(push (funcall expand-body i) strings)))
|
||||
(mapconcat #'identity strings "")))
|
||||
;; Raise an error about missing reference, or return the
|
||||
;; empty string.
|
||||
((guard (or org-babel-noweb-error-all-langs
|
||||
(member lang org-babel-noweb-error-langs)))
|
||||
(error "Cannot resolve %s (see `org-babel-noweb-error-langs')"
|
||||
(org-babel-noweb-wrap ref)))
|
||||
(_ "")))))
|
||||
(replace-regexp-in-string
|
||||
noweb-re
|
||||
(lambda (m)
|
||||
(with-current-buffer parent-buffer
|
||||
(save-match-data
|
||||
(let* ((prefix (match-string 1 m))
|
||||
(id (match-string 3 m))
|
||||
(evaluate (string-match-p "(.*)" id))
|
||||
(expansion
|
||||
(cond
|
||||
(evaluate
|
||||
;; Evaluation can potentially modify the buffer
|
||||
;; and invalidate the cache: reset it.
|
||||
(setq cache nil)
|
||||
(let ((raw (org-babel-ref-resolve id)))
|
||||
(if (stringp raw) raw (format "%S" raw))))
|
||||
;; Retrieve from the Library of Babel.
|
||||
((nth 2 (assoc-string id org-babel-library-of-babel)))
|
||||
;; Return the contents of headlines literally.
|
||||
((org-babel-ref-goto-headline-id id)
|
||||
(org-babel-ref-headline-body))
|
||||
;; Look for a source block named SOURCE-NAME. If
|
||||
;; found, assume it is unique; do not look after
|
||||
;; `:noweb-ref' header argument.
|
||||
((org-with-point-at 1
|
||||
(let ((r (org-babel-named-src-block-regexp-for-name id)))
|
||||
(and (re-search-forward r nil t)
|
||||
(not (org-in-commented-heading-p))
|
||||
(funcall expand-body
|
||||
(org-babel-get-src-block-info t))))))
|
||||
;; All Noweb references were cached in a previous
|
||||
;; run. Extract the information from the cache.
|
||||
((hash-table-p cache)
|
||||
(funcall expand-references id cache))
|
||||
;; Though luck. We go into the long process of
|
||||
;; checking each source block and expand those
|
||||
;; with a matching Noweb reference. Since we're
|
||||
;; going to visit all source blocks in the
|
||||
;; document, cache information about them as well.
|
||||
(t
|
||||
(setq cache (make-hash-table :test #'equal))
|
||||
(org-with-wide-buffer
|
||||
(org-babel-map-src-blocks nil
|
||||
(if (org-in-commented-heading-p)
|
||||
(org-forward-heading-same-level nil t)
|
||||
(let* ((info (org-babel-get-src-block-info t))
|
||||
(ref (cdr (assq :noweb-ref (nth 2 info)))))
|
||||
(push info (gethash ref cache))))))
|
||||
(funcall expand-references id cache)))))
|
||||
;; Interpose PREFIX between every line.
|
||||
(mapconcat #'identity
|
||||
(split-string expansion "[\n\r]")
|
||||
(concat "\n" prefix))))))
|
||||
body t t 2)))
|
||||
|
||||
(defun org-babel--script-escape-inner (str)
|
||||
(let (in-single in-double backslash out)
|
||||
@@ -2932,30 +2994,41 @@ situations in which is it not appropriate."
|
||||
(defun org-babel--string-to-number (string)
|
||||
"If STRING represents a number return its value.
|
||||
Otherwise return nil."
|
||||
(and (string-match-p "\\`-?\\([0-9]\\|\\([1-9]\\|[0-9]*\\.\\)[0-9]*\\)\\'" string)
|
||||
(string-to-number string)))
|
||||
(unless (or (string-match-p "\\s-" (org-trim string))
|
||||
(not (string-match-p "^[0-9-e.+ ]+$" string)))
|
||||
(let ((interned-string (ignore-errors (read string))))
|
||||
(when (numberp interned-string)
|
||||
interned-string))))
|
||||
|
||||
(defun org-babel-import-elisp-from-file (file-name &optional separator)
|
||||
"Read the results located at FILE-NAME into an elisp table.
|
||||
If the table is trivial, then return it as a scalar."
|
||||
(save-window-excursion
|
||||
(let ((result
|
||||
(with-temp-buffer
|
||||
(condition-case err
|
||||
(progn
|
||||
(org-table-import file-name separator)
|
||||
(delete-file file-name)
|
||||
(delq nil
|
||||
(mapcar (lambda (row)
|
||||
(and (not (eq row 'hline))
|
||||
(mapcar #'org-babel-string-read row)))
|
||||
(org-table-to-lisp))))
|
||||
(error (message "Error reading results: %s" err) nil)))))
|
||||
(pcase result
|
||||
(`((,scalar)) scalar)
|
||||
(`((,_ ,_ . ,_)) result)
|
||||
(`(,scalar) scalar)
|
||||
(_ result)))))
|
||||
(let ((result
|
||||
(with-temp-buffer
|
||||
(condition-case err
|
||||
(progn
|
||||
(insert-file-contents file-name)
|
||||
(delete-file file-name)
|
||||
(let ((pmax (point-max)))
|
||||
;; If the file was empty, don't bother trying to
|
||||
;; convert the table.
|
||||
(when (> pmax 1)
|
||||
(org-table-convert-region (point-min) pmax separator)
|
||||
(delq nil
|
||||
(mapcar (lambda (row)
|
||||
(and (not (eq row 'hline))
|
||||
(mapcar #'org-babel-string-read row)))
|
||||
(org-table-to-lisp))))))
|
||||
(error
|
||||
(display-warning 'org-babel
|
||||
(format "Error reading results: %S" err)
|
||||
:error)
|
||||
nil)))))
|
||||
(pcase result
|
||||
(`((,scalar)) scalar)
|
||||
(`((,_ ,_ . ,_)) result)
|
||||
(`(,scalar) scalar)
|
||||
(_ result))))
|
||||
|
||||
(defun org-babel-string-read (cell)
|
||||
"Strip nested \"s from around strings."
|
||||
@@ -3054,9 +3127,8 @@ of `org-babel-temporary-directory'."
|
||||
(if (eq t (car (file-attributes file)))
|
||||
(delete-directory file)
|
||||
(delete-file file)))
|
||||
;; We do not want to delete "." and "..".
|
||||
(directory-files org-babel-temporary-directory 'full
|
||||
"^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))
|
||||
directory-files-no-dot-files-regexp))
|
||||
(delete-directory org-babel-temporary-directory))
|
||||
(error
|
||||
(message "Failed to remove temporary Org-babel directory %s"
|
||||
|
||||
@@ -43,6 +43,4 @@ CSS does not support sessions."
|
||||
|
||||
(provide 'ob-css)
|
||||
|
||||
|
||||
|
||||
;;; ob-css.el ends here
|
||||
|
||||
@@ -119,6 +119,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-ditaa)
|
||||
|
||||
|
||||
|
||||
;;; ob-ditaa.el ends here
|
||||
|
||||
@@ -87,6 +87,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-dot)
|
||||
|
||||
|
||||
|
||||
;;; ob-dot.el ends here
|
||||
|
||||
+13
-13
@@ -5,7 +5,6 @@
|
||||
;; Author: Michael Gauland
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Homepage: https://orgmode.org
|
||||
;; Version: 1.00
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
@@ -24,18 +23,18 @@
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Org-Babel support for using ebnf2ps to generate encapsulated postscript
|
||||
;;; railroad diagrams. It recognizes these arguments:
|
||||
;;;
|
||||
;;; :file is required; it must include the extension '.eps.' All the rules
|
||||
;;; in the block will be drawn in the same file. This is done by
|
||||
;;; inserting a '[<file>' comment at the start of the block (see the
|
||||
;;; documentation for ebnf-eps-buffer for more information).
|
||||
;;;
|
||||
;;; :style specifies a value in ebnf-style-database. This provides the
|
||||
;;; ability to customize the output. The style can also specify the
|
||||
;;; grammar syntax (by setting ebnf-syntax); note that only ebnf,
|
||||
;;; iso-ebnf, and yacc are supported by this file.
|
||||
;; Org-Babel support for using ebnf2ps to generate encapsulated postscript
|
||||
;; railroad diagrams. It recognizes these arguments:
|
||||
;;
|
||||
;; :file is required; it must include the extension '.eps.' All the rules
|
||||
;; in the block will be drawn in the same file. This is done by
|
||||
;; inserting a '[<file>' comment at the start of the block (see the
|
||||
;; documentation for ebnf-eps-buffer for more information).
|
||||
;;
|
||||
;; :style specifies a value in ebnf-style-database. This provides the
|
||||
;; ability to customize the output. The style can also specify the
|
||||
;; grammar syntax (by setting ebnf-syntax); note that only ebnf,
|
||||
;; iso-ebnf, and yacc are supported by this file.
|
||||
|
||||
;;; Requirements:
|
||||
|
||||
@@ -78,4 +77,5 @@ This function is called by `org-babel-execute-src-block'."
|
||||
result)))
|
||||
|
||||
(provide 'ob-ebnf)
|
||||
|
||||
;;; ob-ebnf.el ends here
|
||||
|
||||
@@ -61,31 +61,30 @@ by `org-edit-src-code'.")
|
||||
|
||||
(defun org-babel-execute:emacs-lisp (body params)
|
||||
"Execute a block of emacs-lisp code with Babel."
|
||||
(save-window-excursion
|
||||
(let* ((lexical (cdr (assq :lexical params)))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
(body (format (if (member "output" result-params)
|
||||
"(with-output-to-string %s\n)"
|
||||
"(progn %s\n)")
|
||||
(org-babel-expand-body:emacs-lisp body params)))
|
||||
(result (eval (read (if (or (member "code" result-params)
|
||||
(member "pp" result-params))
|
||||
(concat "(pp " body ")")
|
||||
body))
|
||||
(org-babel-emacs-lisp-lexical lexical))))
|
||||
(org-babel-result-cond result-params
|
||||
(let ((print-level nil)
|
||||
(print-length nil))
|
||||
(if (or (member "scalar" result-params)
|
||||
(member "verbatim" result-params))
|
||||
(format "%S" result)
|
||||
(format "%s" result)))
|
||||
(org-babel-reassemble-table
|
||||
result
|
||||
(org-babel-pick-name (cdr (assq :colname-names params))
|
||||
(cdr (assq :colnames params)))
|
||||
(org-babel-pick-name (cdr (assq :rowname-names params))
|
||||
(cdr (assq :rownames params))))))))
|
||||
(let* ((lexical (cdr (assq :lexical params)))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
(body (format (if (member "output" result-params)
|
||||
"(with-output-to-string %s\n)"
|
||||
"(progn %s\n)")
|
||||
(org-babel-expand-body:emacs-lisp body params)))
|
||||
(result (eval (read (if (or (member "code" result-params)
|
||||
(member "pp" result-params))
|
||||
(concat "(pp " body ")")
|
||||
body))
|
||||
(org-babel-emacs-lisp-lexical lexical))))
|
||||
(org-babel-result-cond result-params
|
||||
(let ((print-level nil)
|
||||
(print-length nil))
|
||||
(if (or (member "scalar" result-params)
|
||||
(member "verbatim" result-params))
|
||||
(format "%S" result)
|
||||
(format "%s" result)))
|
||||
(org-babel-reassemble-table
|
||||
result
|
||||
(org-babel-pick-name (cdr (assq :colname-names params))
|
||||
(cdr (assq :colnames params)))
|
||||
(org-babel-pick-name (cdr (assq :rowname-names params))
|
||||
(cdr (assq :rownames params)))))))
|
||||
|
||||
(defun org-babel-emacs-lisp-lexical (lexical)
|
||||
"Interpret :lexical source block argument.
|
||||
@@ -108,6 +107,4 @@ corresponding :lexical source block argument."
|
||||
|
||||
(provide 'ob-emacs-lisp)
|
||||
|
||||
|
||||
|
||||
;;; ob-emacs-lisp.el ends here
|
||||
|
||||
@@ -144,6 +144,4 @@ This buffer is named by `org-babel-error-buffer-name'."
|
||||
|
||||
(provide 'ob-eval)
|
||||
|
||||
|
||||
|
||||
;;; ob-eval.el ends here
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
(declare-function org-escape-code-in-string "org-src" (s))
|
||||
(declare-function org-export-copy-buffer "ox" ())
|
||||
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
||||
(declare-function org-in-archived-heading-p "org" (&optional no-inheritance))
|
||||
|
||||
(defvar org-src-preserve-indentation)
|
||||
|
||||
@@ -157,7 +158,8 @@ this template."
|
||||
;; encountered.
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward regexp nil t)
|
||||
(unless (save-match-data (org-in-commented-heading-p))
|
||||
(unless (save-match-data (or (org-in-commented-heading-p)
|
||||
(org-in-archived-heading-p)))
|
||||
(let* ((object? (match-end 1))
|
||||
(element (save-match-data
|
||||
(if object? (org-element-context)
|
||||
@@ -403,9 +405,7 @@ inhibit insertion of results into the buffer."
|
||||
(`lob
|
||||
(save-excursion
|
||||
(goto-char (nth 5 info))
|
||||
(let (org-confirm-babel-evaluate)
|
||||
(org-babel-execute-src-block nil info)))))))))
|
||||
|
||||
(org-babel-execute-src-block nil info))))))))
|
||||
|
||||
(provide 'ob-exp)
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ This function is called by `org-babel-execute-src-block'."
|
||||
;; Report errors.
|
||||
(org-babel-eval-error-notify 1
|
||||
(buffer-substring
|
||||
(+ (match-beginning 0) 1) (point-max))) nil))))
|
||||
(+ (match-beginning 0) 1) (point-max)))
|
||||
nil))))
|
||||
(split-string (org-trim
|
||||
(org-babel-expand-body:generic body params))
|
||||
"\n"
|
||||
|
||||
@@ -101,12 +101,13 @@ its header arguments."
|
||||
(concat
|
||||
;; variables
|
||||
(mapconcat 'org-babel-fortran-var-to-fortran vars "\n")
|
||||
body) params)
|
||||
body)
|
||||
params)
|
||||
body) "\n") "\n")))
|
||||
|
||||
(defun org-babel-fortran-ensure-main-wrap (body params)
|
||||
"Wrap body in a \"program ... end program\" block if none exists."
|
||||
(if (string-match "^[ \t]*program[ \t]*.*" (capitalize body))
|
||||
(if (string-match "^[ \t]*program\\>" (capitalize body))
|
||||
(let ((vars (org-babel--get-vars params)))
|
||||
(when vars (error "Cannot use :vars if `program' statement is present"))
|
||||
body)
|
||||
|
||||
@@ -278,6 +278,4 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
|
||||
|
||||
(provide 'ob-gnuplot)
|
||||
|
||||
|
||||
|
||||
;;; ob-gnuplot.el ends here
|
||||
|
||||
@@ -65,7 +65,6 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))
|
||||
|
||||
(defvar org-babel-groovy-wrapper-method
|
||||
|
||||
"class Runner extends Script {
|
||||
def out = new PrintWriter(new ByteArrayOutputStream())
|
||||
def run() { %s }
|
||||
@@ -74,7 +73,6 @@ This function is called by `org-babel-execute-src-block'."
|
||||
println(new Runner().run())
|
||||
")
|
||||
|
||||
|
||||
(defun org-babel-groovy-evaluate
|
||||
(session body &optional result-type result-params)
|
||||
"Evaluate BODY in external Groovy process.
|
||||
@@ -111,6 +109,4 @@ supported in Groovy."
|
||||
|
||||
(provide 'ob-groovy)
|
||||
|
||||
|
||||
|
||||
;;; ob-groovy.el ends here
|
||||
|
||||
+73
-13
@@ -23,20 +23,19 @@
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Org-Babel support for evaluating haskell source code. This one will
|
||||
;; be sort of tricky because haskell programs must be compiled before
|
||||
;; Org Babel support for evaluating Haskell source code.
|
||||
;; Haskell programs must be compiled before
|
||||
;; they can be run, but haskell code can also be run through an
|
||||
;; interactive interpreter.
|
||||
;;
|
||||
;; For now lets only allow evaluation using the haskell interpreter.
|
||||
;; By default we evaluate using the Haskell interpreter.
|
||||
;; To use the compiler, specify :compile yes in the header.
|
||||
|
||||
;;; Requirements:
|
||||
|
||||
;; - haskell-mode :: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
|
||||
;;
|
||||
;; - inf-haskell :: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
|
||||
;;
|
||||
;; - (optionally) lhs2tex :: http://people.cs.uu.nl/andres/lhs2tex/
|
||||
;; - haskell-mode: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
|
||||
;; - inf-haskell: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
|
||||
;; - (optionally) lhs2tex: http://people.cs.uu.nl/andres/lhs2tex/
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
@@ -47,6 +46,7 @@
|
||||
(declare-function run-haskell "ext:inf-haskell" (&optional arg))
|
||||
(declare-function inferior-haskell-load-file
|
||||
"ext:inf-haskell" (&optional reload))
|
||||
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("haskell" . "hs"))
|
||||
@@ -60,8 +60,63 @@
|
||||
|
||||
(defvar haskell-prompt-regexp)
|
||||
|
||||
(defun org-babel-execute:haskell (body params)
|
||||
"Execute a block of Haskell code."
|
||||
(defcustom org-babel-haskell-compiler "ghc"
|
||||
"Command used to compile a Haskell source code file into an executable.
|
||||
May be either a command in the path, like \"ghc\" or an absolute
|
||||
path name, like \"/usr/local/bin/ghc\". The command can include
|
||||
a parameter, such as \"ghc -v\"."
|
||||
:group 'org-babel
|
||||
:package-version '(Org "9.4")
|
||||
:type 'string)
|
||||
|
||||
(defconst org-babel-header-args:haskell '(compile . :any)
|
||||
"Haskell-specific header arguments.")
|
||||
|
||||
(defun org-babel-haskell-execute (body params)
|
||||
"This function should only be called by `org-babel-execute:haskell'"
|
||||
(let* ((tmp-src-file (org-babel-temp-file "Haskell-src-" ".hs"))
|
||||
(tmp-bin-file
|
||||
(org-babel-process-file-name
|
||||
(org-babel-temp-file "Haskell-bin-" org-babel-exeext)))
|
||||
(cmdline (cdr (assq :cmdline params)))
|
||||
(cmdline (if cmdline (concat " " cmdline) ""))
|
||||
(flags (cdr (assq :flags params)))
|
||||
(flags (mapconcat #'identity
|
||||
(if (listp flags)
|
||||
flags
|
||||
(list flags))
|
||||
" "))
|
||||
(libs (org-babel-read
|
||||
(or (cdr (assq :libs params))
|
||||
(org-entry-get nil "libs" t))
|
||||
nil))
|
||||
(libs (mapconcat #'identity
|
||||
(if (listp libs) libs (list libs))
|
||||
" ")))
|
||||
(with-temp-file tmp-src-file (insert body))
|
||||
(org-babel-eval
|
||||
(format "%s -o %s %s %s %s"
|
||||
org-babel-haskell-compiler
|
||||
tmp-bin-file
|
||||
flags
|
||||
(org-babel-process-file-name tmp-src-file)
|
||||
libs)
|
||||
"")
|
||||
(let ((results (org-babel-eval (concat tmp-bin-file cmdline) "")))
|
||||
(when results
|
||||
(setq results (org-trim (org-remove-indentation results)))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assq :result-params params))
|
||||
(org-babel-read results t)
|
||||
(let ((tmp-file (org-babel-temp-file "Haskell-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assq :colname-names params)) (cdr (assq :colnames params)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))))
|
||||
|
||||
(defun org-babel-interpret-haskell (body params)
|
||||
(require 'inf-haskell)
|
||||
(add-hook 'inferior-haskell-hook
|
||||
(lambda ()
|
||||
@@ -87,7 +142,7 @@
|
||||
(org-babel-reassemble-table
|
||||
(let ((result
|
||||
(pcase result-type
|
||||
(`output (mapconcat #'identity (reverse (cdr results)) "\n"))
|
||||
(`output (mapconcat #'identity (reverse results) "\n"))
|
||||
(`value (car results)))))
|
||||
(org-babel-result-cond (cdr (assq :result-params params))
|
||||
result (org-babel-script-escape result)))
|
||||
@@ -96,6 +151,13 @@
|
||||
(org-babel-pick-name (cdr (assq :rowname-names params))
|
||||
(cdr (assq :rowname-names params))))))
|
||||
|
||||
(defun org-babel-execute:haskell (body params)
|
||||
"Execute a block of Haskell code."
|
||||
(let ((compile (string= "yes" (cdr (assq :compile params)))))
|
||||
(if (not compile)
|
||||
(org-babel-interpret-haskell body params)
|
||||
(org-babel-haskell-execute body params))))
|
||||
|
||||
(defun org-babel-haskell-initiate-session (&optional _session _params)
|
||||
"Initiate a haskell session.
|
||||
If there is not a current inferior-process-buffer in SESSION
|
||||
@@ -215,6 +277,4 @@ constructs (header arguments, no-web syntax etc...) are ignored."
|
||||
|
||||
(provide 'ob-haskell)
|
||||
|
||||
|
||||
|
||||
;;; ob-haskell.el ends here
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
;; probably ~/.hledger.journal (it may not notice your $LEDGER_FILE env var).
|
||||
;; So make ~/.hledger.journal a symbolic link to the real file if necessary.
|
||||
|
||||
;; TODO Unit tests are more than welcome, too.
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
|
||||
@@ -64,7 +66,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-hledger)
|
||||
|
||||
|
||||
|
||||
;;; ob-hledger.el ends here
|
||||
;; TODO Unit tests are more than welcome, too.
|
||||
|
||||
@@ -90,7 +90,6 @@ in BODY as elisp."
|
||||
raw
|
||||
(org-babel-script-escape raw)))))))
|
||||
|
||||
|
||||
(defun org-babel-prep-session:io (_session _params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(error "Sessions are not (yet) supported for Io"))
|
||||
@@ -103,6 +102,4 @@ supported in Io."
|
||||
|
||||
(provide 'ob-io)
|
||||
|
||||
|
||||
|
||||
;;; ob-io.el ends here
|
||||
|
||||
@@ -58,6 +58,7 @@ parameters may be used, like javac -verbose"
|
||||
(src-file (concat classname ".java"))
|
||||
(cmpflag (or (cdr (assq :cmpflag params)) ""))
|
||||
(cmdline (or (cdr (assq :cmdline params)) ""))
|
||||
(cmdargs (or (cdr (assq :cmdargs params)) ""))
|
||||
(full-body (org-babel-expand-body:generic body params)))
|
||||
(with-temp-file src-file (insert full-body))
|
||||
(org-babel-eval
|
||||
@@ -66,10 +67,10 @@ parameters may be used, like javac -verbose"
|
||||
(unless (or (not packagename) (file-exists-p packagename))
|
||||
(make-directory packagename 'parents))
|
||||
(let ((results (org-babel-eval (concat org-babel-java-command
|
||||
" " cmdline " " classname) "")))
|
||||
" " cmdline " " classname " " cmdargs) "")))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assq :result-params params))
|
||||
(org-babel-read results)
|
||||
(org-babel-read results t)
|
||||
(let ((tmp-file (org-babel-temp-file "c-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
@@ -80,6 +81,4 @@ parameters may be used, like javac -verbose"
|
||||
|
||||
(provide 'ob-java)
|
||||
|
||||
|
||||
|
||||
;;; ob-java.el ends here
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
;;; Requirements:
|
||||
|
||||
;; - a non-browser javascript engine such as node.js http://nodejs.org/
|
||||
;; or mozrepl http://wiki.github.com/bard/mozrepl/
|
||||
;; - a non-browser javascript engine such as node.js https://nodejs.org/
|
||||
;; or mozrepl https://wiki.github.com/bard/mozrepl/
|
||||
;;
|
||||
;; - for session based evaluation mozrepl and moz.el are required see
|
||||
;; http://wiki.github.com/bard/mozrepl/emacs-integration for
|
||||
;; https://wiki.github.com/bard/mozrepl/emacs-integration for
|
||||
;; configuration instructions
|
||||
|
||||
;;; Code:
|
||||
@@ -65,7 +65,7 @@
|
||||
:safe #'stringp)
|
||||
|
||||
(defvar org-babel-js-function-wrapper
|
||||
"require('sys').print(require('sys').inspect(function(){\n%s\n}()));"
|
||||
"require('process').stdout.write(require('util').inspect(function(){%s}()));"
|
||||
"Javascript code to print value of body.")
|
||||
|
||||
(defun org-babel-execute:js (body params)
|
||||
@@ -201,6 +201,4 @@ then create. Return the initialized session."
|
||||
|
||||
(provide 'ob-js)
|
||||
|
||||
|
||||
|
||||
;;; ob-js.el ends here
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
(regexp-quote (format "%S" (car pair)))
|
||||
(if (stringp (cdr pair))
|
||||
(cdr pair) (format "%S" (cdr pair)))
|
||||
body))) (org-babel--get-vars params))
|
||||
body)))
|
||||
(org-babel--get-vars params))
|
||||
(org-trim body))
|
||||
|
||||
(defun org-babel-execute:latex (body params)
|
||||
@@ -108,8 +109,11 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(append (cdr (assq :packages params)) org-latex-packages-alist)))
|
||||
(cond
|
||||
((and (string-suffix-p ".png" out-file) (not imagemagick))
|
||||
(org-create-formula-image
|
||||
body out-file org-format-latex-options in-buffer))
|
||||
(let ((org-format-latex-header
|
||||
(concat org-format-latex-header "\n"
|
||||
(mapconcat #'identity headers "\n"))))
|
||||
(org-create-formula-image
|
||||
body out-file org-format-latex-options in-buffer)))
|
||||
((string-suffix-p ".tikz" out-file)
|
||||
(when (file-exists-p out-file) (delete-file out-file))
|
||||
(with-temp-file out-file
|
||||
@@ -221,6 +225,6 @@ This function is called by `org-babel-execute-src-block'."
|
||||
"Return an error because LaTeX doesn't support sessions."
|
||||
(error "LaTeX does not support sessions"))
|
||||
|
||||
|
||||
(provide 'ob-latex)
|
||||
|
||||
;;; ob-latex.el ends here
|
||||
|
||||
@@ -65,6 +65,4 @@ called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-ledger)
|
||||
|
||||
|
||||
|
||||
;;; ob-ledger.el ends here
|
||||
|
||||
@@ -205,7 +205,7 @@ If error in compilation, attempt to mark the error in lilypond org file."
|
||||
(delete-file org-babel-lilypond-temp-file))
|
||||
(rename-file org-babel-lilypond-tangled-file
|
||||
org-babel-lilypond-temp-file))
|
||||
(switch-to-buffer-other-window "*lilypond*")
|
||||
(org-switch-to-buffer-other-window "*lilypond*")
|
||||
(erase-buffer)
|
||||
(org-babel-lilypond-compile-lilyfile org-babel-lilypond-temp-file)
|
||||
(goto-char (point-min))
|
||||
@@ -262,7 +262,7 @@ FILE-NAME is full path to lilypond file."
|
||||
"Mark the erroneous lines in the lilypond org buffer.
|
||||
FILE-NAME is full path to lilypond file.
|
||||
LINE is the erroneous line."
|
||||
(switch-to-buffer-other-window
|
||||
(org-switch-to-buffer-other-window
|
||||
(concat (file-name-nondirectory
|
||||
(org-babel-lilypond-switch-extension file-name ".org"))))
|
||||
(let ((temp (point)))
|
||||
@@ -391,7 +391,8 @@ If TEST is non-nil, the shell command is returned and is not run."
|
||||
(defun org-babel-lilypond-switch-extension (file-name ext)
|
||||
"Utility command to swap current FILE-NAME extension with EXT."
|
||||
(concat (file-name-sans-extension
|
||||
file-name) ext))
|
||||
file-name)
|
||||
ext))
|
||||
|
||||
(defun org-babel-lilypond-get-header-args (mode)
|
||||
"Default arguments to use when evaluating a lilypond source block.
|
||||
|
||||
@@ -122,6 +122,4 @@ a property list containing the parameters of the block."
|
||||
|
||||
(provide 'ob-lisp)
|
||||
|
||||
|
||||
|
||||
;;; ob-lisp.el ends here
|
||||
|
||||
@@ -107,7 +107,8 @@ VARS contains resolved variable references."
|
||||
(org-babel-comint-in-buffer session
|
||||
(mapc (lambda (var)
|
||||
(end-of-line 1) (insert var) (comint-send-input)
|
||||
(org-babel-comint-wait-for-output session)) var-lines))
|
||||
(org-babel-comint-wait-for-output session))
|
||||
var-lines))
|
||||
session))
|
||||
|
||||
(defun org-babel-load-session:lua (session body params)
|
||||
@@ -397,6 +398,4 @@ fd:close()"
|
||||
|
||||
(provide 'ob-lua)
|
||||
|
||||
|
||||
|
||||
;;; ob-lua.el ends here
|
||||
|
||||
@@ -43,6 +43,4 @@ does not support sessions."
|
||||
|
||||
(provide 'ob-makefile)
|
||||
|
||||
|
||||
|
||||
;;; ob-makefile.el ends here
|
||||
|
||||
@@ -42,6 +42,4 @@
|
||||
|
||||
(provide 'ob-matlab)
|
||||
|
||||
|
||||
|
||||
;;; ob-matlab.el ends here
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
;; Org-Babel support for evaluating maxima entries.
|
||||
;;
|
||||
;; This differs from most standard languages in that
|
||||
;;
|
||||
;; 1) there is no such thing as a "session" in maxima
|
||||
;;
|
||||
;; 2) we are adding the "cmdline" header argument
|
||||
|
||||
;;; Code:
|
||||
@@ -125,9 +123,6 @@ of the same value."
|
||||
(concat "[" (mapconcat #'org-babel-maxima-elisp-to-maxima val ", ") "]")
|
||||
(format "%s" val)))
|
||||
|
||||
|
||||
(provide 'ob-maxima)
|
||||
|
||||
|
||||
|
||||
;;; ob-maxima.el ends here
|
||||
|
||||
@@ -68,8 +68,7 @@ mscgen supported formats."
|
||||
(let* ((out-file (or (cdr (assq :file params)) "output.png" ))
|
||||
(filetype (or (cdr (assq :filetype params)) "png" )))
|
||||
(unless (cdr (assq :file params))
|
||||
(error "
|
||||
ERROR: no output file specified. Add \":file name.png\" to the src header"))
|
||||
(error "ERROR: no output file specified. Add \":file name.png\" to the src header"))
|
||||
(org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body)
|
||||
nil)) ;; signal that output has already been written to file
|
||||
|
||||
@@ -79,6 +78,4 @@ ERROR: no output file specified. Add \":file name.png\" to the src header"))
|
||||
|
||||
(provide 'ob-mscgen)
|
||||
|
||||
|
||||
|
||||
;;; ob-msc.el ends here
|
||||
|
||||
@@ -166,6 +166,4 @@ Emacs-lisp table, otherwise return the results as a string."
|
||||
|
||||
(provide 'ob-ocaml)
|
||||
|
||||
|
||||
|
||||
;;; ob-ocaml.el ends here
|
||||
|
||||
@@ -136,7 +136,8 @@ specifying a variable of the same value."
|
||||
(org-babel-comint-in-buffer session
|
||||
(mapc (lambda (var)
|
||||
(end-of-line 1) (insert var) (comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)) var-lines))
|
||||
(org-babel-comint-wait-for-output session))
|
||||
var-lines))
|
||||
session))
|
||||
|
||||
(defun org-babel-matlab-initiate-session (&optional session params)
|
||||
@@ -230,7 +231,8 @@ value of the last statement in BODY, as elisp."
|
||||
org-babel-octave-eoe-indicator
|
||||
org-babel-octave-eoe-output)
|
||||
t full-body)
|
||||
(insert full-body) (comint-send-input nil t)))) results)
|
||||
(insert full-body) (comint-send-input nil t))))
|
||||
results)
|
||||
(pcase result-type
|
||||
(`value
|
||||
(org-babel-octave-import-elisp-from-file tmp-file))
|
||||
@@ -259,6 +261,4 @@ This removes initial blank and comment lines and then calls
|
||||
|
||||
(provide 'ob-octave)
|
||||
|
||||
|
||||
|
||||
;;; ob-octave.el ends here
|
||||
|
||||
@@ -67,6 +67,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-org)
|
||||
|
||||
|
||||
|
||||
;;; ob-org.el ends here
|
||||
|
||||
@@ -152,6 +152,4 @@ return the value of the last statement in BODY, as elisp."
|
||||
|
||||
(provide 'ob-perl)
|
||||
|
||||
|
||||
|
||||
;;; ob-perl.el ends here
|
||||
|
||||
@@ -111,11 +111,11 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(cond
|
||||
((or (member "code" result-params)
|
||||
(member "pp" result-params))
|
||||
(format "(pretty (out \"/dev/null\" %s))" full-body))
|
||||
(format "(pretty (out \"%s\" %s))" null-device full-body))
|
||||
((and (member "value" result-params) (not session))
|
||||
(format "(print (out \"/dev/null\" %s))" full-body))
|
||||
(format "(print (out \"%s\" %s))" null-device full-body))
|
||||
((member "value" result-params)
|
||||
(format "(out \"/dev/null\" %s)" full-body))
|
||||
(format "(out \"%s\" %s)" null-device full-body))
|
||||
(t full-body)))
|
||||
(result
|
||||
(if (not (string= session-name "none"))
|
||||
@@ -182,6 +182,4 @@ then create. Return the initialized session."
|
||||
|
||||
(provide 'ob-picolisp)
|
||||
|
||||
|
||||
|
||||
;;; ob-picolisp.el ends here
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
;; Org-Babel support for evaluating plantuml script.
|
||||
;;
|
||||
;; Inspired by Ian Yang's org-export-blocks-format-plantuml
|
||||
;; http://www.emacswiki.org/emacs/org-export-blocks-format-plantuml.el
|
||||
;; https://www.emacswiki.org/emacs/org-export-blocks-format-plantuml.el
|
||||
|
||||
;;; Requirements:
|
||||
|
||||
;; plantuml | http://plantuml.sourceforge.net/
|
||||
;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file
|
||||
;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar')
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
@@ -46,6 +46,31 @@
|
||||
:version "24.1"
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-plantuml-exec-mode 'jar
|
||||
"Method to use for PlantUML diagram generation.
|
||||
`jar' means to use java together with the JAR.
|
||||
The JAR can be configured via `org-plantuml-jar-path'.
|
||||
|
||||
`plantuml' means to use the PlantUML executable.
|
||||
The executable can be configured via `org-plantuml-executable-path'.
|
||||
You can also configure extra arguments via `org-plantuml-executable-args'."
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.4")
|
||||
:type 'symbol
|
||||
:options '(jar plantuml))
|
||||
|
||||
(defcustom org-plantuml-executable-path "plantuml"
|
||||
"File name of the PlantUML executable."
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.4")
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-plantuml-executable-args (list "-headless")
|
||||
"The arguments passed to plantuml executable when executing PlantUML."
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.4")
|
||||
:type '(repeat string))
|
||||
|
||||
(defun org-babel-variable-assignments:plantuml (params)
|
||||
"Return a list of PlantUML statements assigning the block's variables.
|
||||
PARAMS is a property list of source block parameters, which may
|
||||
@@ -83,40 +108,41 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(cmdline (cdr (assq :cmdline params)))
|
||||
(in-file (org-babel-temp-file "plantuml-"))
|
||||
(java (or (cdr (assq :java params)) ""))
|
||||
(executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path)
|
||||
(t "java")))
|
||||
(executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args)
|
||||
((string= "" org-plantuml-jar-path)
|
||||
(error "`org-plantuml-jar-path' is not set"))
|
||||
((not (file-exists-p org-plantuml-jar-path))
|
||||
(error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
|
||||
(t (list java
|
||||
"-jar"
|
||||
(shell-quote-argument (expand-file-name org-plantuml-jar-path))))))
|
||||
(full-body (org-babel-plantuml-make-body body params))
|
||||
(cmd (if (string= "" org-plantuml-jar-path)
|
||||
(error "`org-plantuml-jar-path' is not set")
|
||||
(concat "java " java " -jar "
|
||||
(shell-quote-argument
|
||||
(expand-file-name org-plantuml-jar-path))
|
||||
(if (string= (file-name-extension out-file) "png")
|
||||
" -tpng" "")
|
||||
(if (string= (file-name-extension out-file) "svg")
|
||||
" -tsvg" "")
|
||||
(if (string= (file-name-extension out-file) "eps")
|
||||
" -teps" "")
|
||||
(if (string= (file-name-extension out-file) "pdf")
|
||||
" -tpdf" "")
|
||||
(if (string= (file-name-extension out-file) "tex")
|
||||
" -tlatex" "")
|
||||
(if (string= (file-name-extension out-file) "vdx")
|
||||
" -tvdx" "")
|
||||
(if (string= (file-name-extension out-file) "xmi")
|
||||
" -txmi" "")
|
||||
(if (string= (file-name-extension out-file) "scxml")
|
||||
" -tscxml" "")
|
||||
(if (string= (file-name-extension out-file) "html")
|
||||
" -thtml" "")
|
||||
(if (string= (file-name-extension out-file) "txt")
|
||||
" -ttxt" "")
|
||||
(if (string= (file-name-extension out-file) "utxt")
|
||||
" -utxt" "")
|
||||
" -p " cmdline " < "
|
||||
(org-babel-process-file-name in-file)
|
||||
" > "
|
||||
(org-babel-process-file-name out-file)))))
|
||||
(unless (file-exists-p org-plantuml-jar-path)
|
||||
(error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
|
||||
(cmd (mapconcat #'identity
|
||||
(append
|
||||
(list executable)
|
||||
executable-args
|
||||
(pcase (file-name-extension out-file)
|
||||
("png" '("-tpng"))
|
||||
("svg" '("-tsvg"))
|
||||
("eps" '("-teps"))
|
||||
("pdf" '("-tpdf"))
|
||||
("tex" '("-tlatex"))
|
||||
("vdx" '("-tvdx"))
|
||||
("xmi" '("-txmi"))
|
||||
("scxml" '("-tscxml"))
|
||||
("html" '("-thtml"))
|
||||
("txt" '("-ttxt"))
|
||||
("utxt" '("-utxt")))
|
||||
(list
|
||||
"-p"
|
||||
cmdline
|
||||
"<"
|
||||
(org-babel-process-file-name in-file)
|
||||
">"
|
||||
(org-babel-process-file-name out-file)))
|
||||
" ")))
|
||||
(with-temp-file in-file (insert full-body))
|
||||
(message "%s" cmd) (org-babel-eval cmd "")
|
||||
nil)) ;; signal that output has already been written to file
|
||||
@@ -127,6 +153,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-plantuml)
|
||||
|
||||
|
||||
|
||||
;;; ob-plantuml.el ends here
|
||||
|
||||
+119
-100
@@ -4,6 +4,7 @@
|
||||
|
||||
;; Authors: Eric Schulte
|
||||
;; Dan Davison
|
||||
;; Maintainer: Jack Kamm <jackkamm@gmail.com>
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Homepage: https://orgmode.org
|
||||
|
||||
@@ -29,10 +30,11 @@
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
(require 'org-macs)
|
||||
(require 'python)
|
||||
|
||||
(declare-function py-shell "ext:python-mode" (&optional argprompt))
|
||||
(declare-function py-shell "ext:python-mode" (&rest args))
|
||||
(declare-function py-toggle-shells "ext:python-mode" (arg))
|
||||
(declare-function run-python "ext:python" (&optional cmd dedicated show))
|
||||
(declare-function py-shell-send-string "ext:python-mode" (strg &optional process))
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("python" . "py"))
|
||||
@@ -104,7 +106,8 @@ VARS contains resolved variable references."
|
||||
(org-babel-comint-in-buffer session
|
||||
(mapc (lambda (var)
|
||||
(end-of-line 1) (insert var) (comint-send-input)
|
||||
(org-babel-comint-wait-for-output session)) var-lines))
|
||||
(org-babel-comint-wait-for-output session))
|
||||
var-lines))
|
||||
session))
|
||||
|
||||
(defun org-babel-load-session:python (session body params)
|
||||
@@ -177,42 +180,40 @@ Emacs-lisp table, otherwise return the results as a string."
|
||||
"Initiate a python session.
|
||||
If there is not a current inferior-process-buffer in SESSION
|
||||
then create. Return the initialized session."
|
||||
(require org-babel-python-mode)
|
||||
(save-window-excursion
|
||||
(let* ((session (if session (intern session) :default))
|
||||
(python-buffer (org-babel-python-session-buffer session))
|
||||
(py-buffer (org-babel-python-session-buffer session))
|
||||
(cmd (if (member system-type '(cygwin windows-nt ms-dos))
|
||||
(concat org-babel-python-command " -i")
|
||||
org-babel-python-command)))
|
||||
(cond
|
||||
((and (eq 'python org-babel-python-mode)
|
||||
(fboundp 'run-python)) ; python.el
|
||||
(if (not (version< "24.1" emacs-version))
|
||||
(run-python cmd)
|
||||
(unless python-buffer
|
||||
(setq python-buffer (org-babel-python-with-earmuffs session)))
|
||||
(let ((python-shell-buffer-name
|
||||
(org-babel-python-without-earmuffs python-buffer)))
|
||||
(run-python cmd))))
|
||||
((eq 'python org-babel-python-mode) ; python.el
|
||||
(unless py-buffer
|
||||
(setq py-buffer (org-babel-python-with-earmuffs session)))
|
||||
(let ((python-shell-buffer-name
|
||||
(org-babel-python-without-earmuffs py-buffer)))
|
||||
(run-python cmd)
|
||||
(sleep-for 0 10)))
|
||||
((and (eq 'python-mode org-babel-python-mode)
|
||||
(fboundp 'py-shell)) ; python-mode.el
|
||||
(require 'python-mode)
|
||||
;; Make sure that py-which-bufname is initialized, as otherwise
|
||||
;; it will be overwritten the first time a Python buffer is
|
||||
;; created.
|
||||
(py-toggle-shells py-default-interpreter)
|
||||
;; `py-shell' creates a buffer whose name is the value of
|
||||
;; `py-which-bufname' with '*'s at the beginning and end
|
||||
(let* ((bufname (if (and python-buffer (buffer-live-p python-buffer))
|
||||
(let* ((bufname (if (and py-buffer (buffer-live-p py-buffer))
|
||||
(replace-regexp-in-string ;; zap surrounding *
|
||||
"^\\*\\([^*]+\\)\\*$" "\\1" python-buffer)
|
||||
"^\\*\\([^*]+\\)\\*$" "\\1" py-buffer)
|
||||
(concat "Python-" (symbol-name session))))
|
||||
(py-which-bufname bufname))
|
||||
(py-shell)
|
||||
(setq python-buffer (org-babel-python-with-earmuffs bufname))))
|
||||
(setq py-buffer (org-babel-python-with-earmuffs bufname))
|
||||
(py-shell nil nil t org-babel-python-command py-buffer nil nil t nil)))
|
||||
(t
|
||||
(error "No function available for running an inferior Python")))
|
||||
(setq org-babel-python-buffers
|
||||
(cons (cons session python-buffer)
|
||||
(cons (cons session py-buffer)
|
||||
(assq-delete-all session org-babel-python-buffers)))
|
||||
session)))
|
||||
|
||||
@@ -222,8 +223,9 @@ then create. Return the initialized session."
|
||||
(org-babel-python-session-buffer
|
||||
(org-babel-python-initiate-session-by-key session))))
|
||||
|
||||
(defvar org-babel-python-eoe-indicator "'org_babel_python_eoe'"
|
||||
(defvar org-babel-python-eoe-indicator "org_babel_python_eoe"
|
||||
"A string to indicate that evaluation has completed.")
|
||||
|
||||
(defconst org-babel-python-wrapper-method
|
||||
"
|
||||
def main():
|
||||
@@ -238,14 +240,39 @@ def main():
|
||||
|
||||
open('%s', 'w').write( pprint.pformat(main()) )")
|
||||
|
||||
(defconst org-babel-python--exec-tmpfile
|
||||
(concat
|
||||
"__org_babel_python_fname = '%s'; "
|
||||
"__org_babel_python_fh = open(__org_babel_python_fname); "
|
||||
"exec(compile("
|
||||
"__org_babel_python_fh.read(), __org_babel_python_fname, 'exec'"
|
||||
")); "
|
||||
"__org_babel_python_fh.close()"))
|
||||
(defconst org-babel-python--exec-tmpfile "\
|
||||
with open('%s') as __org_babel_python_tmpfile:
|
||||
exec(compile(__org_babel_python_tmpfile.read(), __org_babel_python_tmpfile.name, 'exec'))"
|
||||
"Template for Python session command with output results.
|
||||
|
||||
Has a single %s escape, the tempfile containing the source code
|
||||
to evaluate.")
|
||||
|
||||
(defun org-babel-python-format-session-value
|
||||
(src-file result-file result-params)
|
||||
"Return Python code to evaluate SRC-FILE and write result to RESULT-FILE."
|
||||
(format "\
|
||||
import ast
|
||||
with open('%s') as __org_babel_python_tmpfile:
|
||||
__org_babel_python_ast = ast.parse(__org_babel_python_tmpfile.read())
|
||||
__org_babel_python_final = __org_babel_python_ast.body[-1]
|
||||
if isinstance(__org_babel_python_final, ast.Expr):
|
||||
__org_babel_python_ast.body = __org_babel_python_ast.body[:-1]
|
||||
exec(compile(__org_babel_python_ast, '<string>', 'exec'))
|
||||
__org_babel_python_final = eval(compile(ast.Expression(
|
||||
__org_babel_python_final.value), '<string>', 'eval'))
|
||||
with open('%s', 'w') as __org_babel_python_tmpfile:
|
||||
if %s:
|
||||
import pprint
|
||||
__org_babel_python_tmpfile.write(pprint.pformat(__org_babel_python_final))
|
||||
else:
|
||||
__org_babel_python_tmpfile.write(str(__org_babel_python_final))
|
||||
else:
|
||||
exec(compile(__org_babel_python_ast, '<string>', 'exec'))
|
||||
__org_babel_python_final = None"
|
||||
(org-babel-process-file-name src-file 'noquote)
|
||||
(org-babel-process-file-name result-file 'noquote)
|
||||
(if (member "pp" result-params) "True" "False")))
|
||||
|
||||
(defun org-babel-python-evaluate
|
||||
(session body &optional result-type result-params preamble)
|
||||
@@ -256,6 +283,19 @@ open('%s', 'w').write( pprint.pformat(main()) )")
|
||||
(org-babel-python-evaluate-external-process
|
||||
body result-type result-params preamble)))
|
||||
|
||||
(defun org-babel-python--shift-right (body &optional count)
|
||||
(with-temp-buffer
|
||||
(python-mode)
|
||||
(insert body)
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(unless (python-syntax-context 'string)
|
||||
(python-indent-shift-right (line-beginning-position)
|
||||
(line-end-position)
|
||||
count))
|
||||
(forward-line 1))
|
||||
(buffer-string)))
|
||||
|
||||
(defun org-babel-python-evaluate-external-process
|
||||
(body &optional result-type result-params preamble)
|
||||
"Evaluate BODY in external python process.
|
||||
@@ -276,89 +316,70 @@ last statement in BODY, as elisp."
|
||||
(if (member "pp" result-params)
|
||||
org-babel-python-pp-wrapper-method
|
||||
org-babel-python-wrapper-method)
|
||||
(mapconcat
|
||||
(lambda (line) (format "\t%s" line))
|
||||
(split-string (org-remove-indentation (org-trim body))
|
||||
"[\r\n]")
|
||||
"\n")
|
||||
(org-babel-python--shift-right body)
|
||||
(org-babel-process-file-name tmp-file 'noquote))))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-python-table-or-string (org-trim raw)))))
|
||||
|
||||
(defun org-babel-python--send-string (session body)
|
||||
"Pass BODY to the Python process in SESSION.
|
||||
Return output."
|
||||
(with-current-buffer session
|
||||
(let* ((string-buffer "")
|
||||
(comint-output-filter-functions
|
||||
(cons (lambda (text) (setq string-buffer
|
||||
(concat string-buffer text)))
|
||||
comint-output-filter-functions))
|
||||
(body (format "\
|
||||
try:
|
||||
%s
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
print('%s')"
|
||||
(org-babel-python--shift-right body 4)
|
||||
org-babel-python-eoe-indicator)))
|
||||
(if (not (eq 'python-mode org-babel-python-mode))
|
||||
(let ((python-shell-buffer-name
|
||||
(org-babel-python-without-earmuffs session)))
|
||||
(python-shell-send-string body))
|
||||
(require 'python-mode)
|
||||
(py-shell-send-string body (get-buffer-process session)))
|
||||
;; same as `python-shell-comint-end-of-output-p' in emacs-25.1+
|
||||
(while (not (string-match
|
||||
org-babel-python-eoe-indicator
|
||||
string-buffer))
|
||||
(accept-process-output (get-buffer-process (current-buffer))))
|
||||
(org-babel-chomp (substring string-buffer 0 (match-beginning 0))))))
|
||||
|
||||
(defun org-babel-python-evaluate-session
|
||||
(session body &optional result-type result-params)
|
||||
"Pass BODY to the Python process in SESSION.
|
||||
If RESULT-TYPE equals `output' then return standard output as a
|
||||
string. If RESULT-TYPE equals `value' then return the value of the
|
||||
last statement in BODY, as elisp."
|
||||
(let* ((send-wait (lambda () (comint-send-input nil t) (sleep-for 0 5)))
|
||||
(dump-last-value
|
||||
(lambda
|
||||
(tmp-file pp)
|
||||
(mapc
|
||||
(lambda (statement) (insert statement) (funcall send-wait))
|
||||
(if pp
|
||||
(list
|
||||
"import pprint"
|
||||
(format "open('%s', 'w').write(pprint.pformat(_))"
|
||||
(org-babel-process-file-name tmp-file 'noquote)))
|
||||
(list (format "open('%s', 'w').write(str(_))"
|
||||
(org-babel-process-file-name tmp-file
|
||||
'noquote)))))))
|
||||
(last-indent 0)
|
||||
(input-body (lambda (body)
|
||||
(dolist (line (split-string body "[\r\n]"))
|
||||
;; Insert a blank line to end an indent
|
||||
;; block.
|
||||
(let ((curr-indent (string-match "\\S-" line)))
|
||||
(if curr-indent
|
||||
(progn
|
||||
(when (< curr-indent last-indent)
|
||||
(insert "")
|
||||
(funcall send-wait))
|
||||
(setq last-indent curr-indent))
|
||||
(setq last-indent 0)))
|
||||
(insert line)
|
||||
(funcall send-wait))
|
||||
(funcall send-wait)))
|
||||
(let* ((tmp-src-file (org-babel-temp-file "python-"))
|
||||
(results
|
||||
(pcase result-type
|
||||
(`output
|
||||
(let ((body (if (string-match-p ".\n+." body) ; Multiline
|
||||
(let ((tmp-src-file (org-babel-temp-file
|
||||
"python-")))
|
||||
(with-temp-file tmp-src-file (insert body))
|
||||
(format org-babel-python--exec-tmpfile
|
||||
tmp-src-file))
|
||||
body)))
|
||||
(mapconcat
|
||||
#'org-trim
|
||||
(butlast
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-python-eoe-indicator t body)
|
||||
(funcall input-body body)
|
||||
(funcall send-wait) (funcall send-wait)
|
||||
(insert org-babel-python-eoe-indicator)
|
||||
(funcall send-wait))
|
||||
2) "\n")))
|
||||
(`value
|
||||
(let ((tmp-file (org-babel-temp-file "python-")))
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-python-eoe-indicator nil body)
|
||||
(let ((comint-process-echoes nil))
|
||||
(funcall input-body body)
|
||||
(funcall dump-last-value tmp-file
|
||||
(member "pp" result-params))
|
||||
(funcall send-wait) (funcall send-wait)
|
||||
(insert org-babel-python-eoe-indicator)
|
||||
(funcall send-wait)))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
(unless (string= (substring org-babel-python-eoe-indicator 1 -1) results)
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(org-babel-python-table-or-string results)))))
|
||||
(progn
|
||||
(with-temp-file tmp-src-file (insert body))
|
||||
(pcase result-type
|
||||
(`output
|
||||
(let ((body (format org-babel-python--exec-tmpfile
|
||||
(org-babel-process-file-name
|
||||
tmp-src-file 'noquote))))
|
||||
(org-babel-python--send-string session body)))
|
||||
(`value
|
||||
(let* ((tmp-results-file (org-babel-temp-file "python-"))
|
||||
(body (org-babel-python-format-session-value
|
||||
tmp-src-file tmp-results-file result-params)))
|
||||
(org-babel-python--send-string session body)
|
||||
(sleep-for 0 10)
|
||||
(org-babel-eval-read-file tmp-results-file)))))))
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(org-babel-python-table-or-string results))))
|
||||
|
||||
(defun org-babel-python-read-string (string)
|
||||
"Strip \\='s from around Python string."
|
||||
@@ -369,6 +390,4 @@ last statement in BODY, as elisp."
|
||||
|
||||
(provide 'ob-python)
|
||||
|
||||
|
||||
|
||||
;;; ob-python.el ends here
|
||||
|
||||
@@ -143,7 +143,8 @@ Emacs Lisp representation of the value of the variable."
|
||||
(org-babel-ref-split-args new-referent))))
|
||||
(when (> (length new-header-args) 0)
|
||||
(setq args (append (org-babel-parse-header-arguments
|
||||
new-header-args) args)))
|
||||
new-header-args)
|
||||
args)))
|
||||
(setq ref new-refere)))
|
||||
(when (string-match "^\\(.+\\):\\(.+\\)$" ref)
|
||||
(setq split-file (match-string 1 ref))
|
||||
@@ -240,7 +241,6 @@ to \"0:-1\"."
|
||||
"Split ARG-STRING into top-level arguments of balanced parenthesis."
|
||||
(mapcar #'org-trim (org-babel-balanced-split arg-string 44)))
|
||||
|
||||
|
||||
(provide 'ob-ref)
|
||||
|
||||
;;; ob-ref.el ends here
|
||||
|
||||
+23
-12
@@ -30,16 +30,17 @@
|
||||
;; - ruby and irb executables :: http://www.ruby-lang.org/
|
||||
;;
|
||||
;; - ruby-mode :: Can be installed through ELPA, or from
|
||||
;; http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el
|
||||
;; https://github.com/eschulte/rinari/raw/master/util/ruby-mode.el
|
||||
;;
|
||||
;; - inf-ruby mode :: Can be installed through ELPA, or from
|
||||
;; http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el
|
||||
;; https://github.com/eschulte/rinari/raw/master/util/inf-ruby.el
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
(require 'org-macs)
|
||||
|
||||
(declare-function run-ruby "ext:inf-ruby" (&optional command name))
|
||||
(declare-function run-ruby-or-pop-to-buffer "ext:inf-ruby" (command &optional name buffer))
|
||||
(declare-function inf-ruby-buffer "ext:inf-ruby" ())
|
||||
(declare-function xmp "ext:rcodetools" (&optional option))
|
||||
|
||||
(defvar inf-ruby-default-implementation)
|
||||
@@ -51,7 +52,8 @@
|
||||
(defvar org-babel-default-header-args:ruby '())
|
||||
|
||||
(defvar org-babel-ruby-command "ruby"
|
||||
"Name of command to use for executing ruby code.")
|
||||
"Name of command to use for executing ruby code.
|
||||
It's possible to override it by using a header argument `:ruby'")
|
||||
|
||||
(defcustom org-babel-ruby-hline-to "nil"
|
||||
"Replace hlines in incoming tables with this when translating to ruby."
|
||||
@@ -71,9 +73,12 @@
|
||||
"Execute a block of Ruby code with Babel.
|
||||
This function is called by `org-babel-execute-src-block'."
|
||||
(let* ((session (org-babel-ruby-initiate-session
|
||||
(cdr (assq :session params))))
|
||||
(cdr (assq :session params)) params))
|
||||
(result-params (cdr (assq :result-params params)))
|
||||
(result-type (cdr (assq :result-type params)))
|
||||
(org-babel-ruby-command
|
||||
(or (cdr (assq :ruby params))
|
||||
org-babel-ruby-command))
|
||||
(full-body (org-babel-expand-body:generic
|
||||
body params (org-babel-variable-assignments:ruby params)))
|
||||
(result (if (member "xmp" result-params)
|
||||
@@ -103,7 +108,8 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(mapc (lambda (var)
|
||||
(insert var) (comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)
|
||||
(sit-for .1) (goto-char (point-max))) var-lines))
|
||||
(sit-for .1) (goto-char (point-max)))
|
||||
var-lines))
|
||||
session))
|
||||
|
||||
(defun org-babel-load-session:ruby (session body params)
|
||||
@@ -147,17 +153,24 @@ Emacs-lisp table, otherwise return the results as a string."
|
||||
res)
|
||||
res)))
|
||||
|
||||
(defun org-babel-ruby-initiate-session (&optional session _params)
|
||||
(defun org-babel-ruby-initiate-session (&optional session params)
|
||||
"Initiate a ruby session.
|
||||
If there is not a current inferior-process-buffer in SESSION
|
||||
then create one. Return the initialized session."
|
||||
(unless (string= session "none")
|
||||
(require 'inf-ruby)
|
||||
(let* ((cmd (cdr (assoc inf-ruby-default-implementation
|
||||
inf-ruby-implementations)))
|
||||
(let* ((command (cdr (or (assq :ruby params)
|
||||
(assoc inf-ruby-default-implementation
|
||||
inf-ruby-implementations))))
|
||||
(buffer (get-buffer (format "*%s*" session)))
|
||||
(session-buffer (or buffer (save-window-excursion
|
||||
(run-ruby cmd session)
|
||||
(run-ruby-or-pop-to-buffer
|
||||
(if (functionp command)
|
||||
(funcall command)
|
||||
command)
|
||||
(or session "ruby")
|
||||
(unless session
|
||||
(inf-ruby-buffer)))
|
||||
(current-buffer)))))
|
||||
(if (org-babel-comint-buffer-livep session-buffer)
|
||||
(progn (sit-for .25) session-buffer)
|
||||
@@ -263,6 +276,4 @@ return the value of the last statement in BODY, as elisp."
|
||||
|
||||
(provide 'ob-ruby)
|
||||
|
||||
|
||||
|
||||
;;; ob-ruby.el ends here
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
;;; Requirements:
|
||||
|
||||
;; - sass-mode :: http://github.com/nex3/haml/blob/master/extra/sass-mode.el
|
||||
;; - sass-mode :: https://github.com/nex3/haml/blob/master/extra/sass-mode.el
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
@@ -65,6 +65,4 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(provide 'ob-sass)
|
||||
|
||||
|
||||
|
||||
;;; ob-sass.el ends here
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
(require 'geiser-impl nil t)
|
||||
(defvar geiser-repl--repl) ; Defined in geiser-repl.el
|
||||
(defvar geiser-impl--implementation) ; Defined in geiser-impl.el
|
||||
(defvar geiser-scheme-implementation) ; Defined in geiser-impl.el
|
||||
(defvar geiser-default-implementation) ; Defined in geiser-impl.el
|
||||
(defvar geiser-active-implementations) ; Defined in geiser-impl.el
|
||||
(defvar geiser-debug-show-debug-p) ; Defined in geiser-debug.el
|
||||
@@ -71,7 +72,8 @@
|
||||
(defun org-babel-expand-body:scheme (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
(let ((vars (org-babel--get-vars params))
|
||||
(prepends (cdr (assq :prologue params))))
|
||||
(prepends (cdr (assq :prologue params)))
|
||||
(postpends (cdr (assq :epilogue params))))
|
||||
(concat (and prepends (concat prepends "\n"))
|
||||
(if (null vars) body
|
||||
(format "(let (%s)\n%s\n)"
|
||||
@@ -80,7 +82,8 @@
|
||||
(format "%S" (print `(,(car var) ',(cdr var)))))
|
||||
vars
|
||||
"\n ")
|
||||
body)))))
|
||||
body))
|
||||
(and postpends (concat "\n" postpends)))))
|
||||
|
||||
|
||||
(defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
|
||||
@@ -175,7 +178,8 @@ is true; otherwise returns the last value."
|
||||
(geiser-debug-show-debug-p nil))
|
||||
(let ((ret (geiser-eval-region (point-min) (point-max))))
|
||||
(setq result (if output
|
||||
(geiser-eval--retort-output ret)
|
||||
(or (geiser-eval--retort-output ret)
|
||||
"Geiser Interpreter produced no output")
|
||||
(geiser-eval--retort-result-str ret "")))))
|
||||
(when (not repl)
|
||||
(save-current-buffer (set-buffer repl-buffer)
|
||||
@@ -208,6 +212,7 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(let* ((result-type (cdr (assq :result-type params)))
|
||||
(impl (or (when (cdr (assq :scheme params))
|
||||
(intern (cdr (assq :scheme params))))
|
||||
geiser-scheme-implementation
|
||||
geiser-default-implementation
|
||||
(car geiser-active-implementations)))
|
||||
(session (org-babel-scheme-make-session-name
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
In case you want to use a different screen than one selected by your $PATH")
|
||||
|
||||
(defvar org-babel-default-header-args:screen
|
||||
'((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm"))
|
||||
`((:results . "silent") (:session . "default") (:cmd . "sh")
|
||||
(:terminal . "xterm") (:screenrc . ,null-device))
|
||||
"Default arguments to use when running screen source blocks.")
|
||||
|
||||
(defun org-babel-execute:screen (body params)
|
||||
@@ -59,11 +60,11 @@ In case you want to use a different screen than one selected by your $PATH")
|
||||
(let* ((session (cdr (assq :session params)))
|
||||
(cmd (cdr (assq :cmd params)))
|
||||
(terminal (cdr (assq :terminal params)))
|
||||
(screenrc (cdr (assq :screenrc params)))
|
||||
(process-name (concat "org-babel: terminal (" session ")")))
|
||||
(apply 'start-process process-name "*Messages*"
|
||||
terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location
|
||||
"-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session)
|
||||
,cmd))
|
||||
"-c" ,screenrc "-mS" ,session ,cmd))
|
||||
;; XXX: Is there a better way than the following?
|
||||
(while (not (org-babel-screen-session-socketname session))
|
||||
;; wait until screen session is available before returning
|
||||
@@ -97,9 +98,8 @@ In case you want to use a different screen than one selected by your $PATH")
|
||||
nil
|
||||
(mapcar
|
||||
(lambda (x)
|
||||
(when (string-match
|
||||
(concat "org-babel-session-" session) x)
|
||||
x))
|
||||
(and (string-match-p (regexp-quote session) x)
|
||||
x))
|
||||
sockets)))))
|
||||
(when match-socket (car (split-string match-socket)))))
|
||||
|
||||
@@ -108,6 +108,7 @@ In case you want to use a different screen than one selected by your $PATH")
|
||||
(let ((tmpfile (org-babel-temp-file "screen-")))
|
||||
(with-temp-file tmpfile
|
||||
(insert body)
|
||||
(insert "\n")
|
||||
|
||||
;; org-babel has superfluous spaces
|
||||
(goto-char (point-min))
|
||||
@@ -138,6 +139,4 @@ The terminal should shortly flicker."
|
||||
|
||||
(provide 'ob-screen)
|
||||
|
||||
|
||||
|
||||
;;; ob-screen.el ends here
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
;; Author: Bjarte Johansen
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Version: 0.1.1
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
@@ -68,7 +67,8 @@ function is called by `org-babel-execute-src-block'."
|
||||
(in-file (cdr (assq :in-file params)))
|
||||
(code-file (let ((file (org-babel-temp-file "sed-")))
|
||||
(with-temp-file file
|
||||
(insert body)) file))
|
||||
(insert body))
|
||||
file))
|
||||
(stdin (let ((stdin (cdr (assq :stdin params))))
|
||||
(when stdin
|
||||
(let ((tmp (org-babel-temp-file "sed-stdin-"))
|
||||
@@ -102,4 +102,5 @@ function is called by `org-babel-execute-src-block'."
|
||||
(cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))
|
||||
|
||||
(provide 'ob-sed)
|
||||
|
||||
;;; ob-sed.el ends here
|
||||
|
||||
+43
-16
@@ -71,6 +71,19 @@ outside the Customize interface."
|
||||
(set-default symbol value)
|
||||
(org-babel-shell-initialize)))
|
||||
|
||||
(defcustom org-babel-shell-results-defaults-to-output t
|
||||
"Let shell execution defaults to \":results output\".
|
||||
|
||||
When set to t, use \":results output\" when no :results setting
|
||||
is set. This is especially useful for inline source blocks.
|
||||
|
||||
When set to nil, stick to the convention of using :results value
|
||||
as the default setting when no :results is set, the \"value\" of
|
||||
a shell execution being its exit code."
|
||||
:group 'org-babel
|
||||
:type 'boolean
|
||||
:package-version '(Org . "9.4"))
|
||||
|
||||
(defun org-babel-execute:shell (body params)
|
||||
"Execute a block of Shell commands with Babel.
|
||||
This function is called by `org-babel-execute-src-block'."
|
||||
@@ -79,9 +92,17 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(stdin (let ((stdin (cdr (assq :stdin params))))
|
||||
(when stdin (org-babel-sh-var-to-string
|
||||
(org-babel-ref-resolve stdin)))))
|
||||
(results-params (cdr (assq :result-params params)))
|
||||
(value-is-exit-status
|
||||
(or (and
|
||||
(equal '("replace") results-params)
|
||||
(not org-babel-shell-results-defaults-to-output))
|
||||
(member "value" results-params)))
|
||||
(cmdline (cdr (assq :cmdline params)))
|
||||
(full-body (org-babel-expand-body:generic
|
||||
body params (org-babel-variable-assignments:shell params))))
|
||||
(full-body (concat
|
||||
(org-babel-expand-body:generic
|
||||
body params (org-babel-variable-assignments:shell params))
|
||||
(when value-is-exit-status "\necho $?"))))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-sh-evaluate session full-body params stdin cmdline)
|
||||
(org-babel-pick-name
|
||||
@@ -96,7 +117,8 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(org-babel-comint-in-buffer session
|
||||
(mapc (lambda (var)
|
||||
(insert var) (comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)) var-lines))
|
||||
(org-babel-comint-wait-for-output session))
|
||||
var-lines))
|
||||
session))
|
||||
|
||||
(defun org-babel-load-session:shell (session body params)
|
||||
@@ -129,15 +151,15 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(varname values &optional sep hline)
|
||||
"Return a list of statements declaring the values as bash associative array."
|
||||
(format "unset %s\ndeclare -A %s\n%s"
|
||||
varname varname
|
||||
(mapconcat
|
||||
(lambda (items)
|
||||
(format "%s[%s]=%s"
|
||||
varname
|
||||
(org-babel-sh-var-to-sh (car items) sep hline)
|
||||
(org-babel-sh-var-to-sh (cdr items) sep hline)))
|
||||
values
|
||||
"\n")))
|
||||
varname varname
|
||||
(mapconcat
|
||||
(lambda (items)
|
||||
(format "%s[%s]=%s"
|
||||
varname
|
||||
(org-babel-sh-var-to-sh (car items) sep hline)
|
||||
(org-babel-sh-var-to-sh (cdr items) sep hline)))
|
||||
values
|
||||
"\n")))
|
||||
|
||||
(defun org-babel--variable-assignments:bash (varname values &optional sep hline)
|
||||
"Represent the parameters as useful Bash shell variables."
|
||||
@@ -208,6 +230,12 @@ If RESULT-TYPE equals `output' then return a list of the outputs
|
||||
of the statements in BODY, if RESULT-TYPE equals `value' then
|
||||
return the value of the last statement in BODY."
|
||||
(let* ((shebang (cdr (assq :shebang params)))
|
||||
(results-params (cdr (assq :result-params params)))
|
||||
(value-is-exit-status
|
||||
(or (and
|
||||
(equal '("replace") results-params)
|
||||
(not org-babel-shell-results-defaults-to-output))
|
||||
(member "value" results-params)))
|
||||
(results
|
||||
(cond
|
||||
((or stdin cmdline) ; external shell script w/STDIN
|
||||
@@ -259,8 +287,9 @@ return the value of the last statement in BODY."
|
||||
(insert body))
|
||||
(set-file-modes script-file #o755)
|
||||
(org-babel-eval script-file "")))
|
||||
(t
|
||||
(org-babel-eval shell-file-name (org-trim body))))))
|
||||
(t (org-babel-eval shell-file-name (org-trim body))))))
|
||||
(when value-is-exit-status
|
||||
(setq results (car (reverse (split-string results "\n" t)))))
|
||||
(when results
|
||||
(let ((result-params (cdr (assq :result-params params))))
|
||||
(org-babel-result-cond result-params
|
||||
@@ -277,6 +306,4 @@ return the value of the last statement in BODY."
|
||||
|
||||
(provide 'ob-shell)
|
||||
|
||||
|
||||
|
||||
;;; ob-shell.el ends here
|
||||
|
||||
@@ -75,4 +75,5 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(error results))))))
|
||||
|
||||
(provide 'ob-shen)
|
||||
|
||||
;;; ob-shen.el ends here
|
||||
|
||||
+62
-56
@@ -55,7 +55,7 @@
|
||||
;; - dbi
|
||||
;; - mssql
|
||||
;; - sqsh
|
||||
;; - postgresql
|
||||
;; - postgresql (postgres)
|
||||
;; - oracle
|
||||
;; - vertica
|
||||
;;
|
||||
@@ -73,6 +73,7 @@
|
||||
(declare-function orgtbl-to-csv "org-table" (table params))
|
||||
(declare-function org-table-to-lisp "org-table" (&optional txt))
|
||||
(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p))
|
||||
(declare-function sql-set-product "sql" (product))
|
||||
|
||||
(defvar sql-connection-alist)
|
||||
(defvar org-babel-default-header-args:sql '())
|
||||
@@ -92,6 +93,13 @@
|
||||
(org-babel-sql-expand-vars
|
||||
body (org-babel--get-vars params)))
|
||||
|
||||
(defun org-babel-edit-prep:sql (info)
|
||||
"Set `sql-product' in Org edit buffer.
|
||||
Set `sql-product' in Org edit buffer according to the
|
||||
corresponding :engine source block header argument."
|
||||
(let ((product (cdr (assq :engine (nth 2 info)))))
|
||||
(sql-set-product product)))
|
||||
|
||||
(defun org-babel-sql-dbstring-mysql (host port user password database)
|
||||
"Make MySQL cmd line args for database connection. Pass nil to omit that arg."
|
||||
(combine-and-quote-strings
|
||||
@@ -211,64 +219,64 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(out-file (or (cdr (assq :out-file params))
|
||||
(org-babel-temp-file "sql-out-")))
|
||||
(header-delim "")
|
||||
(command (pcase (intern engine)
|
||||
(`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"
|
||||
(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"
|
||||
(or cmdline "")
|
||||
(org-babel-sql-dbstring-mssql
|
||||
dbhost dbuser dbpassword database)
|
||||
(org-babel-sql-convert-standard-filename
|
||||
(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"
|
||||
(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
|
||||
"%spsql --set=\"ON_ERROR_STOP=1\" %s -A -P \
|
||||
footer=off -F \"\t\" %s -f %s -o %s %s"
|
||||
(if dbpassword
|
||||
(format "PGPASSWORD=%s " dbpassword)
|
||||
"")
|
||||
(if colnames-p "" "-t")
|
||||
(org-babel-sql-dbstring-postgresql
|
||||
dbhost dbport dbuser database)
|
||||
(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"
|
||||
(command (cl-case (intern engine)
|
||||
(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"
|
||||
(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"
|
||||
(or cmdline "")
|
||||
(org-babel-sql-dbstring-sqsh
|
||||
(org-babel-sql-dbstring-mssql
|
||||
dbhost dbuser dbpassword database)
|
||||
(org-babel-sql-convert-standard-filename
|
||||
(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
|
||||
"sqlplus -s %s < %s > %s"
|
||||
(org-babel-sql-dbstring-oracle
|
||||
dbhost dbport dbuser dbpassword database)
|
||||
(org-babel-process-file-name in-file)
|
||||
(org-babel-process-file-name out-file)))
|
||||
(_ (error "No support for the %s SQL engine" engine)))))
|
||||
(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 postgres) (format
|
||||
"%spsql --set=\"ON_ERROR_STOP=1\" %s -A -P \
|
||||
footer=off -F \"\t\" %s -f %s -o %s %s"
|
||||
(if dbpassword
|
||||
(format "PGPASSWORD=%s " dbpassword)
|
||||
"")
|
||||
(if colnames-p "" "-t")
|
||||
(org-babel-sql-dbstring-postgresql
|
||||
dbhost dbport dbuser database)
|
||||
(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"
|
||||
(or cmdline "")
|
||||
(org-babel-sql-dbstring-sqsh
|
||||
dbhost dbuser dbpassword database)
|
||||
(org-babel-sql-convert-standard-filename
|
||||
(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
|
||||
"sqlplus -s %s < %s > %s"
|
||||
(org-babel-sql-dbstring-oracle
|
||||
dbhost dbport dbuser dbpassword database)
|
||||
(org-babel-process-file-name in-file)
|
||||
(org-babel-process-file-name out-file)))
|
||||
(t (user-error "No support for the %s SQL engine" engine)))))
|
||||
(with-temp-file in-file
|
||||
(insert
|
||||
(pcase (intern engine)
|
||||
@@ -301,7 +309,7 @@ SET COLSEP '|'
|
||||
(progn (insert-file-contents-literally out-file) (buffer-string)))
|
||||
(with-temp-buffer
|
||||
(cond
|
||||
((memq (intern engine) '(dbi mysql postgresql sqsh vertica))
|
||||
((memq (intern engine) '(dbi mysql postgresql postgres sqsh vertica))
|
||||
;; Add header row delimiter after column-names header in first line
|
||||
(cond
|
||||
(colnames-p
|
||||
@@ -365,6 +373,4 @@ SET COLSEP '|'
|
||||
|
||||
(provide 'ob-sql)
|
||||
|
||||
|
||||
|
||||
;;; ob-sql.el ends here
|
||||
|
||||
@@ -133,11 +133,12 @@ This function is called by `org-babel-execute-src-block'."
|
||||
"If RESULT looks like a trivial table, then unwrap it."
|
||||
(if (and (equal 1 (length result))
|
||||
(equal 1 (length (car result))))
|
||||
(org-babel-read (caar result))
|
||||
(org-babel-read (caar result) t)
|
||||
(mapcar (lambda (row)
|
||||
(if (eq 'hline row)
|
||||
'hline
|
||||
(mapcar #'org-babel-string-read row))) result)))
|
||||
(mapcar #'org-babel-string-read row)))
|
||||
result)))
|
||||
|
||||
(defun org-babel-sqlite-offset-colnames (table headers-p)
|
||||
"If HEADERS-P is non-nil then offset the first row as column names."
|
||||
@@ -152,6 +153,4 @@ Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
|
||||
(provide 'ob-sqlite)
|
||||
|
||||
|
||||
|
||||
;;; ob-sqlite.el ends here
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
;; For more information and usage examples, visit
|
||||
;; https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-stan.html
|
||||
;;
|
||||
;; [1] http://mc-stan.org/
|
||||
;; [1] https://mc-stan.org/
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
@@ -82,4 +82,5 @@ Otherwise, write the Stan code directly to the named file."
|
||||
(user-error "Stan does not support sessions"))
|
||||
|
||||
(provide 'ob-stan)
|
||||
|
||||
;;; ob-stan.el ends here
|
||||
|
||||
@@ -62,7 +62,8 @@ If STRING ends in a newline character, then remove the newline
|
||||
character and replace it with ellipses."
|
||||
(if (and (stringp string) (string-match "[\n\r]\\(.\\)?" string))
|
||||
(concat (substring string 0 (match-beginning 0))
|
||||
(when (match-string 1 string) "...")) string))
|
||||
(when (match-string 1 string) "..."))
|
||||
string))
|
||||
|
||||
(defmacro org-sbe (source-block &rest variables)
|
||||
"Return the results of calling SOURCE-BLOCK with VARIABLES.
|
||||
@@ -147,6 +148,4 @@ as shown in the example below.
|
||||
|
||||
(provide 'ob-table)
|
||||
|
||||
|
||||
|
||||
;;; ob-table.el ends here
|
||||
|
||||
+34
-26
@@ -41,6 +41,7 @@
|
||||
(declare-function org-element-type "org-element" (element))
|
||||
(declare-function org-heading-components "org" ())
|
||||
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
||||
(declare-function org-in-archived-heading-p "org" (&optional no-inheritance))
|
||||
(declare-function outline-previous-heading "outline" ())
|
||||
|
||||
(defcustom org-babel-tangle-lang-exts
|
||||
@@ -166,13 +167,14 @@ evaluating BODY."
|
||||
(def-edebug-spec org-babel-with-temp-filebuffer (form body))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-tangle-file (file &optional target-file lang)
|
||||
(defun org-babel-tangle-file (file &optional target-file lang-re)
|
||||
"Extract the bodies of source code blocks in FILE.
|
||||
Source code blocks are extracted with `org-babel-tangle'.
|
||||
Optional argument TARGET-FILE can be used to specify a default
|
||||
export file for all source blocks. Optional argument LANG can be
|
||||
used to limit the exported source code blocks by language.
|
||||
Return a list whose CAR is the tangled file name."
|
||||
export file for all source blocks. Optional argument LANG-RE can
|
||||
be used to limit the exported source code blocks by languages
|
||||
matching a regular expression. Return a list whose CAR is the
|
||||
tangled file name."
|
||||
(interactive "fFile to tangle: \nP")
|
||||
(let ((visited-p (find-buffer-visiting (expand-file-name file)))
|
||||
to-be-removed)
|
||||
@@ -180,7 +182,7 @@ Return a list whose CAR is the tangled file name."
|
||||
(save-window-excursion
|
||||
(find-file file)
|
||||
(setq to-be-removed (current-buffer))
|
||||
(mapcar #'expand-file-name (org-babel-tangle nil target-file lang)))
|
||||
(mapcar #'expand-file-name (org-babel-tangle nil target-file lang-re)))
|
||||
(unless visited-p
|
||||
(kill-buffer to-be-removed)))))
|
||||
|
||||
@@ -192,7 +194,7 @@ Return a list whose CAR is the tangled file name."
|
||||
(mapc (lambda (el) (copy-file el pub-dir t)) (org-babel-tangle-file filename)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-tangle (&optional arg target-file lang)
|
||||
(defun org-babel-tangle (&optional arg target-file lang-re)
|
||||
"Write code blocks to source-specific files.
|
||||
Extract the bodies of all source code blocks from the current
|
||||
file into their own source-specific files.
|
||||
@@ -200,8 +202,9 @@ With one universal prefix argument, only tangle the block at point.
|
||||
When two universal prefix arguments, only tangle blocks for the
|
||||
tangle file of the block at point.
|
||||
Optional argument TARGET-FILE can be used to specify a default
|
||||
export file for all source blocks. Optional argument LANG can be
|
||||
used to limit the exported source code blocks by language."
|
||||
export file for all source blocks. Optional argument LANG-RE can
|
||||
be used to limit the exported source code blocks by languages
|
||||
matching a regular expression."
|
||||
(interactive "P")
|
||||
(run-hooks 'org-babel-pre-tangle-hook)
|
||||
;; Possibly Restrict the buffer to the current code block
|
||||
@@ -286,7 +289,7 @@ used to limit the exported source code blocks by language."
|
||||
specs)))
|
||||
(if (equal arg '(4))
|
||||
(org-babel-tangle-single-block 1 t)
|
||||
(org-babel-tangle-collect-blocks lang tangle-file)))
|
||||
(org-babel-tangle-collect-blocks lang-re tangle-file)))
|
||||
(message "Tangled %d code block%s from %s" block-counter
|
||||
(if (= block-counter 1) "" "s")
|
||||
(file-name-nondirectory
|
||||
@@ -364,13 +367,14 @@ that the appropriate major-mode is set. SPEC has the form:
|
||||
(org-fill-template
|
||||
org-babel-tangle-comment-format-end link-data)))))
|
||||
|
||||
(defun org-babel-tangle-collect-blocks (&optional language tangle-file)
|
||||
(defun org-babel-tangle-collect-blocks (&optional lang-re tangle-file)
|
||||
"Collect source blocks in the current Org file.
|
||||
Return an association list of source-code block specifications of
|
||||
the form used by `org-babel-spec-to-string' grouped by language.
|
||||
Optional argument LANGUAGE can be used to limit the collected
|
||||
source code blocks by language. Optional argument TANGLE-FILE
|
||||
can be used to limit the collected code blocks by target file."
|
||||
Optional argument LANG-RE can be used to limit the collected
|
||||
source code blocks by languages matching a regular expression.
|
||||
Optional argument TANGLE-FILE can be used to limit the collected
|
||||
code blocks by target file."
|
||||
(let ((counter 0) last-heading-pos blocks)
|
||||
(org-babel-map-src-blocks (buffer-file-name)
|
||||
(let ((current-heading-pos
|
||||
@@ -379,13 +383,14 @@ can be used to limit the collected code blocks by target file."
|
||||
(if (eq last-heading-pos current-heading-pos) (cl-incf counter)
|
||||
(setq counter 1)
|
||||
(setq last-heading-pos current-heading-pos)))
|
||||
(unless (org-in-commented-heading-p)
|
||||
(unless (or (org-in-commented-heading-p)
|
||||
(org-in-archived-heading-p))
|
||||
(let* ((info (org-babel-get-src-block-info 'light))
|
||||
(src-lang (nth 0 info))
|
||||
(src-tfile (cdr (assq :tangle (nth 2 info)))))
|
||||
(unless (or (string= src-tfile "no")
|
||||
(and tangle-file (not (equal tangle-file src-tfile)))
|
||||
(and language (not (string= language src-lang))))
|
||||
(and lang-re (not (string-match-p lang-re src-lang))))
|
||||
;; Add the spec for this block to blocks under its
|
||||
;; language.
|
||||
(let ((by-lang (assoc src-lang blocks))
|
||||
@@ -471,9 +476,9 @@ non-nil, return the full association list to be used by
|
||||
file)
|
||||
(if (and org-babel-tangle-use-relative-file-links
|
||||
(string-match org-link-types-re link)
|
||||
(string= (match-string 0 link) "file"))
|
||||
(string= (match-string 1 link) "file"))
|
||||
(concat "file:"
|
||||
(file-relative-name (match-string 1 link)
|
||||
(file-relative-name (substring link (match-end 0))
|
||||
(file-name-directory
|
||||
(cdr (assq :tangle params)))))
|
||||
link)
|
||||
@@ -513,14 +518,16 @@ which enable the original code blocks to be found."
|
||||
(goto-char (point-min))
|
||||
(let ((counter 0) new-body end)
|
||||
(while (re-search-forward org-link-bracket-re nil t)
|
||||
(when (re-search-forward
|
||||
(concat " " (regexp-quote (match-string 2)) " ends here"))
|
||||
(setq end (match-end 0))
|
||||
(forward-line -1)
|
||||
(save-excursion
|
||||
(when (setq new-body (org-babel-tangle-jump-to-org))
|
||||
(org-babel-update-block-body new-body)))
|
||||
(setq counter (+ 1 counter)))
|
||||
(if (and (match-string 2)
|
||||
(re-search-forward
|
||||
(concat " " (regexp-quote (match-string 2)) " ends here") nil t))
|
||||
(progn (setq end (match-end 0))
|
||||
(forward-line -1)
|
||||
(save-excursion
|
||||
(when (setq new-body (org-babel-tangle-jump-to-org))
|
||||
(org-babel-update-block-body new-body)))
|
||||
(setq counter (+ 1 counter)))
|
||||
(setq end (point)))
|
||||
(goto-char end))
|
||||
(prog1 counter (message "Detangled %d code blocks" counter)))))
|
||||
|
||||
@@ -541,7 +548,8 @@ which enable the original code blocks to be found."
|
||||
(save-match-data
|
||||
(re-search-forward
|
||||
(concat " " (regexp-quote block-name)
|
||||
" ends here") nil t)
|
||||
" ends here")
|
||||
nil t)
|
||||
(setq end (line-beginning-position))))))))
|
||||
(unless (and start (< start mid) (< mid end))
|
||||
(error "Not in tangled code"))
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
;;; Commentary:
|
||||
|
||||
;; ob-vala.el provides Babel support for the Vala language
|
||||
;; (see http://live.gnome.org/Vala for details)
|
||||
;; (see https://live.gnome.org/Vala for details)
|
||||
|
||||
;;; Requirements:
|
||||
|
||||
|
||||
+16
-13
@@ -98,7 +98,7 @@
|
||||
(require 'org-macs)
|
||||
(require 'ol)
|
||||
|
||||
;; Declare functions and variables
|
||||
;;; Declare functions and variables
|
||||
|
||||
(declare-function bbdb "ext:bbdb-com" (string elidep))
|
||||
(declare-function bbdb-company "ext:bbdb-com" (string elidep))
|
||||
@@ -126,9 +126,9 @@
|
||||
|
||||
(declare-function diary-ordinal-suffix "diary-lib" (n))
|
||||
|
||||
(with-no-warnings (defvar date)) ;unprefixed, from calendar.el
|
||||
(with-no-warnings (defvar date)) ; unprefixed, from calendar.el
|
||||
|
||||
;; Customization
|
||||
;;; Customization
|
||||
|
||||
(defgroup org-bbdb-anniversaries nil
|
||||
"Customizations for including anniversaries from BBDB into Agenda."
|
||||
@@ -221,7 +221,8 @@ date year)."
|
||||
:complete #'org-bbdb-complete-link
|
||||
:store #'org-bbdb-store-link)
|
||||
|
||||
;; Implementation
|
||||
;;; Implementation
|
||||
|
||||
(defun org-bbdb-store-link ()
|
||||
"Store a link to a BBDB database entry."
|
||||
(when (eq major-mode 'bbdb-mode)
|
||||
@@ -236,7 +237,7 @@ date year)."
|
||||
:link link :description name)
|
||||
link)))
|
||||
|
||||
(defun org-bbdb-export (path desc format)
|
||||
(defun org-bbdb-export (path desc format _)
|
||||
"Create the export version of a BBDB link specified by PATH or DESC.
|
||||
If exporting to either HTML or LaTeX FORMAT the link will be
|
||||
italicized, in all other cases it is left unchanged."
|
||||
@@ -249,7 +250,7 @@ italicized, in all other cases it is left unchanged."
|
||||
(format "<text:span text:style-name=\"Emphasis\">%s</text:span>" desc))
|
||||
(t desc)))
|
||||
|
||||
(defun org-bbdb-open (name)
|
||||
(defun org-bbdb-open (name _)
|
||||
"Follow a BBDB link to NAME."
|
||||
(require 'bbdb-com)
|
||||
(let ((inhibit-redisplay (not debug-on-error)))
|
||||
@@ -362,7 +363,9 @@ This is used by Org to re-create the anniversary hash table."
|
||||
|
||||
;;;###autoload
|
||||
(defun org-bbdb-anniversaries ()
|
||||
"Extract anniversaries from BBDB for display in the agenda."
|
||||
"Extract anniversaries from BBDB for display in the agenda.
|
||||
When called programmatically, this function expects the `date'
|
||||
variable to be globally bound."
|
||||
(require 'bbdb)
|
||||
(require 'diary-lib)
|
||||
(unless (hash-table-p org-bbdb-anniv-hash)
|
||||
@@ -380,7 +383,7 @@ This is used by Org to re-create the anniversary hash table."
|
||||
(text ())
|
||||
rec recs)
|
||||
|
||||
;; we don't want to miss people born on Feb. 29th
|
||||
;; We don't want to miss people born on Feb. 29th
|
||||
(when (and (= m 3) (= d 1)
|
||||
(not (null (gethash (list 2 29) org-bbdb-anniv-hash)))
|
||||
(not (calendar-leap-year-p y)))
|
||||
@@ -415,8 +418,9 @@ This is used by Org to re-create the anniversary hash table."
|
||||
))
|
||||
text))
|
||||
|
||||
;;; Return list of anniversaries for today and the next n-1 (default: n=7) days.
|
||||
;;; This is meant to be used in an org file instead of org-bbdb-anniversaries:
|
||||
;;; Return the list of anniversaries for today and the next n-1
|
||||
;;; (default: n=7) days. This is meant to be used in an org file
|
||||
;;; instead of org-bbdb-anniversaries:
|
||||
;;;
|
||||
;;; %%(org-bbdb-anniversaries-future)
|
||||
;;;
|
||||
@@ -442,15 +446,14 @@ for the same event depending on if it occurs in the next few days
|
||||
or far away in the future."
|
||||
(let ((delta (- (calendar-absolute-from-gregorian anniv-date)
|
||||
(calendar-absolute-from-gregorian agenda-date))))
|
||||
|
||||
(cond
|
||||
((= delta 0) " -- today\\&")
|
||||
((= delta 1) " -- tomorrow\\&")
|
||||
((< delta org-bbdb-general-anniversary-description-after) (format " -- in %d days\\&" delta))
|
||||
((< delta org-bbdb-general-anniversary-description-after)
|
||||
(format " -- in %d days\\&" delta))
|
||||
((pcase-let ((`(,month ,day ,year) anniv-date))
|
||||
(format " -- %d-%02d-%02d\\&" year month day))))))
|
||||
|
||||
|
||||
(defun org-bbdb-anniversaries-future (&optional n)
|
||||
"Return list of anniversaries for today and the next n-1 days (default n=7)."
|
||||
(let ((n (or n 7)))
|
||||
|
||||
+15
-12
@@ -95,7 +95,7 @@
|
||||
;; The link creation part has been part of Org for a long time.
|
||||
;;
|
||||
;; Creating better capture template information was inspired by a request
|
||||
;; of Austin Frank: http://article.gmane.org/gmane.emacs.orgmode/4112
|
||||
;; of Austin Frank: https://orgmode.org/list/m0myu03vbx.fsf@gmail.com
|
||||
;; and then implemented by Bastien Guerry.
|
||||
;;
|
||||
;; Eric Schulte eventually added the functions for translating between
|
||||
@@ -134,10 +134,11 @@
|
||||
(declare-function org-insert-heading "org" (&optional arg invisible-ok top))
|
||||
(declare-function org-map-entries "org" (func &optional match scope &rest skip))
|
||||
(declare-function org-narrow-to-subtree "org" ())
|
||||
(declare-function org-open-file "org" (path &optional in-emacs line search))
|
||||
(declare-function org-set-property "org" (property value))
|
||||
(declare-function org-toggle-tag "org" (tag &optional onoff))
|
||||
|
||||
(declare-function org-search-view "org-agenda" (&optional todo-only string edit-at))
|
||||
|
||||
|
||||
;;; Bibtex data
|
||||
(defvar org-bibtex-types
|
||||
@@ -318,7 +319,7 @@ is non-nil."
|
||||
"Controls whether inherited tags are converted to bibtex keywords.
|
||||
It is relevant only if `org-bibtex-tags-are-keywords' is non-nil.
|
||||
Tag inheritance itself is controlled by `org-use-tag-inheritance'
|
||||
and `org-exclude-tags-from-inheritance'."
|
||||
and `org-tags-exclude-from-inheritance'."
|
||||
:group 'org-bibtex
|
||||
:version "26.1"
|
||||
:package-version '(Org . "8.3")
|
||||
@@ -483,12 +484,11 @@ With optional argument OPTIONAL, also prompt for optional fields."
|
||||
:follow #'org-bibtex-open
|
||||
:store #'org-bibtex-store-link)
|
||||
|
||||
(defun org-bibtex-open (path)
|
||||
"Visit the bibliography entry on PATH."
|
||||
(let* ((search (when (string-match "::\\(.+\\)\\'" path)
|
||||
(match-string 1 path)))
|
||||
(path (substring path 0 (match-beginning 0))))
|
||||
(org-open-file path t nil search)))
|
||||
(defun org-bibtex-open (path arg)
|
||||
"Visit the bibliography entry on PATH.
|
||||
ARG, when non-nil, is a universal prefix argument. See
|
||||
`org-open-file' for details."
|
||||
(org-link-open-as-file path arg))
|
||||
|
||||
(defun org-bibtex-store-link ()
|
||||
"Store a link to a BibTeX entry."
|
||||
@@ -556,7 +556,8 @@ With optional argument OPTIONAL, also prompt for optional fields."
|
||||
;; We construct a regexp that searches for "@entrytype{" followed by the key
|
||||
(goto-char (point-min))
|
||||
(and (re-search-forward (concat "@[a-zA-Z]+[ \t\n]*{[ \t\n]*"
|
||||
(regexp-quote s) "[ \t\n]*,") nil t)
|
||||
(regexp-quote s) "[ \t\n]*,")
|
||||
nil t)
|
||||
(goto-char (match-beginning 0)))
|
||||
(if (and (match-beginning 0) (equal current-prefix-arg '(16)))
|
||||
;; Use double prefix to indicate that any web link should be browsed
|
||||
@@ -596,7 +597,8 @@ Headlines are exported using `org-bibtex-headline'."
|
||||
(with-temp-file filename
|
||||
(insert (mapconcat #'identity bibtex-entries "\n")))
|
||||
(message "Successfully exported %d BibTeX entries to %s"
|
||||
(length bibtex-entries) filename) nil))))
|
||||
(length bibtex-entries) filename)
|
||||
nil))))
|
||||
(when error-point
|
||||
(goto-char error-point)
|
||||
(message "Bibtex error at %S" (nth 4 (org-heading-components))))))
|
||||
@@ -661,7 +663,8 @@ This uses `bibtex-parse-entry'."
|
||||
(when (and (> (length str) 1)
|
||||
(= (aref str 0) (car pair))
|
||||
(= (aref str (1- (length str))) (cdr pair)))
|
||||
(setf str (substring str 1 (1- (length str)))))) str)))
|
||||
(setf str (substring str 1 (1- (length str))))))
|
||||
str)))
|
||||
(push (mapcar
|
||||
(lambda (pair)
|
||||
(cons (let ((field (funcall keyword (car pair))))
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
((eq format 'ascii) (format "%s (%s)" desc path))
|
||||
(t path)))))
|
||||
|
||||
(defun org-docview-open (link)
|
||||
(defun org-docview-open (link _)
|
||||
(string-match "\\(.*?\\)\\(?:::\\([0-9]+\\)\\)?$" link)
|
||||
(let ((path (match-string 1 link))
|
||||
(page (and (match-beginning 2)
|
||||
@@ -98,7 +98,6 @@ and append it."
|
||||
"::"
|
||||
(read-from-minibuffer "Page:" "1")))
|
||||
|
||||
|
||||
(provide 'ol-docview)
|
||||
|
||||
;;; ol-docview.el ends here
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
:follow #'org-eshell-open
|
||||
:store #'org-eshell-store-link)
|
||||
|
||||
(defun org-eshell-open (link)
|
||||
(defun org-eshell-open (link _)
|
||||
"Switch to an eshell buffer and execute a command line.
|
||||
The link can be just a command line (executed in the default
|
||||
eshell buffer) or a command line prefixed by a buffer name
|
||||
|
||||
+10
-5
@@ -46,17 +46,22 @@
|
||||
;;; Code:
|
||||
(require 'ol)
|
||||
(require 'cl-lib)
|
||||
(require 'eww)
|
||||
|
||||
;; For Emacsen < 25.
|
||||
(defvar eww-current-title)
|
||||
(defvar eww-current-url)
|
||||
(defvar eww-data)
|
||||
(defvar eww-mode-map)
|
||||
|
||||
(declare-function eww-current-url "eww")
|
||||
|
||||
|
||||
;; Store Org link in Eww mode buffer
|
||||
(org-link-set-parameters "eww" :follow #'eww :store #'org-eww-store-link)
|
||||
(org-link-set-parameters "eww"
|
||||
:follow #'org-eww-open
|
||||
:store #'org-eww-store-link)
|
||||
|
||||
(defun org-eww-open (url _)
|
||||
"Open URL with Eww in the current buffer."
|
||||
(eww url))
|
||||
|
||||
(defun org-eww-store-link ()
|
||||
"Store a link to the url of an EWW buffer."
|
||||
(when (eq major-mode 'eww-mode)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user