Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
0461d55c41
|
@ -2,7 +2,7 @@
|
||||||
;;; org-drill.el - Self-testing using spaced repetition
|
;;; org-drill.el - Self-testing using spaced repetition
|
||||||
;;;
|
;;;
|
||||||
;;; Author: Paul Sexton <eeeickythump@gmail.com>
|
;;; Author: Paul Sexton <eeeickythump@gmail.com>
|
||||||
;;; Version: 2.3.3
|
;;; Version: 2.3.5
|
||||||
;;; Repository at http://bitbucket.org/eeeickythump/org-drill/
|
;;; Repository at http://bitbucket.org/eeeickythump/org-drill/
|
||||||
;;;
|
;;;
|
||||||
;;;
|
;;;
|
||||||
|
@ -307,6 +307,15 @@ pace of learning."
|
||||||
:type 'sexp)
|
:type 'sexp)
|
||||||
|
|
||||||
|
|
||||||
|
(defcustom org-drill-sm5-initial-interval
|
||||||
|
4.0
|
||||||
|
"In the SM5 algorithm, the initial interval after the first
|
||||||
|
successful presentation of an item is always 4 days. If you wish to change
|
||||||
|
this, you can do so here."
|
||||||
|
:group 'org-drill
|
||||||
|
:type 'float)
|
||||||
|
|
||||||
|
|
||||||
(defcustom org-drill-add-random-noise-to-intervals-p
|
(defcustom org-drill-add-random-noise-to-intervals-p
|
||||||
nil
|
nil
|
||||||
"If true, the number of days until an item's next repetition
|
"If true, the number of days until an item's next repetition
|
||||||
|
@ -334,6 +343,27 @@ is used."
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
|
||||||
|
(defcustom org-drill-cloze-text-weight
|
||||||
|
4
|
||||||
|
"For card types 'hide1_firstmore', 'show1_lastmore' and 'show1_firstless',
|
||||||
|
this number determines how often the 'less favoured' situation
|
||||||
|
should arise. It will occur 1 in every N trials, where N is the
|
||||||
|
value of the variable.
|
||||||
|
|
||||||
|
For example, with the hide1_firstmore card type, the first piece
|
||||||
|
of clozed text should be hidden more often than the other
|
||||||
|
pieces. If this variable is set to 4 (default), the first item
|
||||||
|
will only be shown 25% of the time (1 in 4 trials). Similarly for
|
||||||
|
show1_lastmore, the last item will be shown 75% of the time, and
|
||||||
|
for show1_firstless, the first item would only be shown 25% of the
|
||||||
|
time.
|
||||||
|
|
||||||
|
If the value of this variable is NIL, then weighting is disabled, and
|
||||||
|
all weighted card types are treated as their unweighted equivalents."
|
||||||
|
:group 'org-drill
|
||||||
|
:type '(choice integer (const nil)))
|
||||||
|
|
||||||
|
|
||||||
(defcustom org-drill-cram-hours
|
(defcustom org-drill-cram-hours
|
||||||
12
|
12
|
||||||
"When in cram mode, items are considered due for review if
|
"When in cram mode, items are considered due for review if
|
||||||
|
@ -436,6 +466,7 @@ for review unless they were already reviewed in the recent past?")
|
||||||
(put 'org-drill-hide-item-headings-p 'safe-local-variable 'booleanp)
|
(put 'org-drill-hide-item-headings-p 'safe-local-variable 'booleanp)
|
||||||
(put 'org-drill-spaced-repetition-algorithm 'safe-local-variable
|
(put 'org-drill-spaced-repetition-algorithm 'safe-local-variable
|
||||||
'(lambda (val) (memq val '(simple8 sm5 sm2))))
|
'(lambda (val) (memq val '(simple8 sm5 sm2))))
|
||||||
|
(put 'org-drill-sm5-initial-interval 'safe-local-variable 'floatp)
|
||||||
(put 'org-drill-add-random-noise-to-intervals-p 'safe-local-variable 'booleanp)
|
(put 'org-drill-add-random-noise-to-intervals-p 'safe-local-variable 'booleanp)
|
||||||
(put 'org-drill-adjust-intervals-for-early-and-late-repetitions-p
|
(put 'org-drill-adjust-intervals-for-early-and-late-repetitions-p
|
||||||
'safe-local-variable 'booleanp)
|
'safe-local-variable 'booleanp)
|
||||||
|
@ -446,6 +477,8 @@ for review unless they were already reviewed in the recent past?")
|
||||||
(put 'org-drill-scope 'safe-local-variable
|
(put 'org-drill-scope 'safe-local-variable
|
||||||
'(lambda (val) (or (symbolp val) (listp val))))
|
'(lambda (val) (or (symbolp val) (listp val))))
|
||||||
(put 'org-drill-save-buffers-after-drill-sessions-p 'safe-local-variable 'booleanp)
|
(put 'org-drill-save-buffers-after-drill-sessions-p 'safe-local-variable 'booleanp)
|
||||||
|
(put 'org-drill-cloze-text-weight 'safe-local-variable
|
||||||
|
'(lambda (val) (or (null val) (integerp val))))
|
||||||
|
|
||||||
|
|
||||||
;;;; Utilities ================================================================
|
;;;; Utilities ================================================================
|
||||||
|
@ -891,8 +924,22 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN TOTAL-REPEATS OFMATRIX), wher
|
||||||
;;; SM5 Algorithm =============================================================
|
;;; SM5 Algorithm =============================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defun initial-optimal-factor-sm5 (n ef)
|
||||||
|
(if (= 1 n)
|
||||||
|
org-drill-sm5-initial-interval
|
||||||
|
ef))
|
||||||
|
|
||||||
|
(defun get-optimal-factor-sm5 (n ef of-matrix)
|
||||||
|
(let ((factors (assoc n of-matrix)))
|
||||||
|
(or (and factors
|
||||||
|
(let ((ef-of (assoc ef (cdr factors))))
|
||||||
|
(and ef-of (cdr ef-of))))
|
||||||
|
(initial-optimal-factor-sm5 n ef))))
|
||||||
|
|
||||||
|
|
||||||
(defun inter-repetition-interval-sm5 (last-interval n ef &optional of-matrix)
|
(defun inter-repetition-interval-sm5 (last-interval n ef &optional of-matrix)
|
||||||
(let ((of (get-optimal-factor n ef (or of-matrix
|
(let ((of (get-optimal-factor-sm5 n ef (or of-matrix
|
||||||
org-drill-optimal-factor-matrix))))
|
org-drill-optimal-factor-matrix))))
|
||||||
(if (= 1 n)
|
(if (= 1 n)
|
||||||
of
|
of
|
||||||
|
@ -917,13 +964,13 @@ Returns a list: (INTERVAL REPEATS EF FAILURES MEAN TOTAL-REPEATS OFMATRIX), wher
|
||||||
|
|
||||||
(let ((next-ef (modify-e-factor ef quality))
|
(let ((next-ef (modify-e-factor ef quality))
|
||||||
(old-ef ef)
|
(old-ef ef)
|
||||||
(new-of (modify-of (get-optimal-factor n ef of-matrix)
|
(new-of (modify-of (get-optimal-factor-sm5 n ef of-matrix)
|
||||||
quality org-drill-learn-fraction))
|
quality org-drill-learn-fraction))
|
||||||
(interval nil))
|
(interval nil))
|
||||||
(when (and org-drill-adjust-intervals-for-early-and-late-repetitions-p
|
(when (and org-drill-adjust-intervals-for-early-and-late-repetitions-p
|
||||||
delta-days (minusp delta-days))
|
delta-days (minusp delta-days))
|
||||||
(setq new-of (org-drill-early-interval-factor
|
(setq new-of (org-drill-early-interval-factor
|
||||||
(get-optimal-factor n ef of-matrix)
|
(get-optimal-factor-sm5 n ef of-matrix)
|
||||||
(inter-repetition-interval-sm5
|
(inter-repetition-interval-sm5
|
||||||
last-interval n ef of-matrix)
|
last-interval n ef of-matrix)
|
||||||
delta-days)))
|
delta-days)))
|
||||||
|
@ -1101,12 +1148,15 @@ item will be scheduled exactly this many days into the future."
|
||||||
(if (numberp days-ahead)
|
(if (numberp days-ahead)
|
||||||
(setq next-interval days-ahead))
|
(setq next-interval days-ahead))
|
||||||
|
|
||||||
(org-drill-store-item-data next-interval repetitions failures
|
|
||||||
total-repeats meanq ease)
|
|
||||||
(if (and (null days-ahead)
|
(if (and (null days-ahead)
|
||||||
(numberp weight) (plusp weight)
|
(numberp weight) (plusp weight)
|
||||||
(not (minusp next-interval)))
|
(not (minusp next-interval)))
|
||||||
(setq next-interval (max 1.0 (/ next-interval weight))))
|
(setq next-interval
|
||||||
|
(max 1.0 (+ last-interval
|
||||||
|
(/ (- next-interval last-interval) weight)))))
|
||||||
|
|
||||||
|
(org-drill-store-item-data next-interval repetitions failures
|
||||||
|
total-repeats meanq ease)
|
||||||
|
|
||||||
(if (eql 'sm5 org-drill-spaced-repetition-algorithm)
|
(if (eql 'sm5 org-drill-spaced-repetition-algorithm)
|
||||||
(setq org-drill-optimal-factor-matrix new-ofmatrix))
|
(setq org-drill-optimal-factor-matrix new-ofmatrix))
|
||||||
|
@ -1150,7 +1200,8 @@ of QUALITY."
|
||||||
((not (plusp next-interval))
|
((not (plusp next-interval))
|
||||||
0)
|
0)
|
||||||
((and (numberp weight) (plusp weight))
|
((and (numberp weight) (plusp weight))
|
||||||
(max 1.0 (/ next-interval weight)))
|
(+ last-interval
|
||||||
|
(max 1.0 (/ (- next-interval last-interval) weight))))
|
||||||
(t
|
(t
|
||||||
next-interval))))))
|
next-interval))))))
|
||||||
|
|
||||||
|
@ -1722,46 +1773,84 @@ chosen at random."
|
||||||
|
|
||||||
|
|
||||||
(defun org-drill-present-multicloze-hide1-firstmore ()
|
(defun org-drill-present-multicloze-hide1-firstmore ()
|
||||||
"Three out of every four repetitions, hides the FIRST piece of
|
"Commonly, hides the FIRST piece of text that is marked for
|
||||||
text that is marked for cloze deletion. One out of every four
|
cloze deletion. Uncommonly, hide one of the other pieces of text,
|
||||||
repetitions, hide one of the other pieces of text, chosen at
|
chosen at random.
|
||||||
random."
|
|
||||||
|
The definitions of 'commonly' and 'uncommonly' are determined by
|
||||||
|
the value of `org-drill-cloze-text-weight'."
|
||||||
;; The 'firstmore' and 'lastmore' functions used to randomly choose whether
|
;; The 'firstmore' and 'lastmore' functions used to randomly choose whether
|
||||||
;; to hide the 'favoured' piece of text. However even when the chance of
|
;; to hide the 'favoured' piece of text. However even when the chance of
|
||||||
;; hiding it was set quite high (80%), the outcome was too unpredictable over
|
;; hiding it was set quite high (80%), the outcome was too unpredictable over
|
||||||
;; the small number of repetitions where most learning takes place for each
|
;; the small number of repetitions where most learning takes place for each
|
||||||
;; item. In other words, the actual frequency during the first 10 repetitions
|
;; item. In other words, the actual frequency during the first 10 repetitions
|
||||||
;; was often very different from 80%. Hence we use modulo instead.
|
;; was often very different from 80%. Hence we use modulo instead.
|
||||||
(if (zerop (mod (1+ (org-drill-entry-total-repeats 0)) 4))
|
(cond
|
||||||
;; 25% of time, hide any item except the first
|
((null org-drill-cloze-text-weight)
|
||||||
(org-drill-present-multicloze-hide-n 1 t)
|
;; Behave as hide1cloze
|
||||||
;; 75% of time, hide first item
|
(org-drill-present-multicloze-hide1))
|
||||||
(org-drill-present-multicloze-hide-first)))
|
((not (and (integerp org-drill-cloze-text-weight)
|
||||||
|
(plusp org-drill-cloze-text-weight)))
|
||||||
|
(error "Illegal value for org-drill-cloze-text-weight: %S"
|
||||||
|
org-drill-cloze-text-weight))
|
||||||
|
((zerop (mod (1+ (org-drill-entry-total-repeats 0))
|
||||||
|
org-drill-cloze-text-weight))
|
||||||
|
;; Uncommonly, hide any item except the first
|
||||||
|
(org-drill-present-multicloze-hide-n 1 t))
|
||||||
|
(t
|
||||||
|
;; Commonly, hide first item
|
||||||
|
(org-drill-present-multicloze-hide-first))))
|
||||||
|
|
||||||
|
|
||||||
(defun org-drill-present-multicloze-show1-lastmore ()
|
(defun org-drill-present-multicloze-show1-lastmore ()
|
||||||
"Three out of every four repetitions, hides all pieces except
|
"Commonly, hides all pieces except the last. Uncommonly, shows
|
||||||
the last. One out of every four repetitions, shows any random
|
any random piece. The effect is similar to 'show1cloze' except
|
||||||
piece. The effect is similar to 'show1cloze' except that the last
|
that the last item is much less likely to be the item that is
|
||||||
item is much less likely to be the item that is visible."
|
visible.
|
||||||
(if (zerop (mod (1+ (org-drill-entry-total-repeats 0)) 4))
|
|
||||||
;; 25% of time, show any item except the last
|
The definitions of 'commonly' and 'uncommonly' are determined by
|
||||||
(org-drill-present-multicloze-hide-n -1 nil nil t)
|
the value of `org-drill-cloze-text-weight'."
|
||||||
;; 75% of time, show the LAST item
|
(cond
|
||||||
(org-drill-present-multicloze-hide-n -1 nil t)))
|
((null org-drill-cloze-text-weight)
|
||||||
|
;; Behave as show1cloze
|
||||||
|
(org-drill-present-multicloze-show1))
|
||||||
|
((not (and (integerp org-drill-cloze-text-weight)
|
||||||
|
(plusp org-drill-cloze-text-weight)))
|
||||||
|
(error "Illegal value for org-drill-cloze-text-weight: %S"
|
||||||
|
org-drill-cloze-text-weight))
|
||||||
|
((zerop (mod (1+ (org-drill-entry-total-repeats 0))
|
||||||
|
org-drill-cloze-text-weight))
|
||||||
|
;; Uncommonly, show any item except the last
|
||||||
|
(org-drill-present-multicloze-hide-n -1 nil nil t))
|
||||||
|
(t
|
||||||
|
;; Commonly, show the LAST item
|
||||||
|
(org-drill-present-multicloze-hide-n -1 nil t))))
|
||||||
|
|
||||||
|
|
||||||
(defun org-drill-present-multicloze-show1-firstless ()
|
(defun org-drill-present-multicloze-show1-firstless ()
|
||||||
"Three out of every four repetitions, hides all pieces except
|
"Commonly, hides all pieces except one, where the shown piece
|
||||||
one, where the shown piece is guaranteed NOT to be the first
|
is guaranteed NOT to be the first piece. Uncommonly, shows any
|
||||||
piece. One out of every four repetitions, shows any random
|
random piece. The effect is similar to 'show1cloze' except that
|
||||||
piece. The effect is similar to 'show1cloze' except that the
|
the first item is much less likely to be the item that is
|
||||||
first item is much less likely to be the item that is visible."
|
visible.
|
||||||
(if (zerop (mod (1+ (org-drill-entry-total-repeats 0)) 4))
|
|
||||||
;; 25% of time, show the first item
|
The definitions of 'commonly' and 'uncommonly' are determined by
|
||||||
(org-drill-present-multicloze-hide-n -1 t)
|
the value of `org-drill-cloze-text-weight'."
|
||||||
;; 75% of time, show any item, except the first
|
(cond
|
||||||
(org-drill-present-multicloze-hide-n -1 nil nil t)))
|
((null org-drill-cloze-text-weight)
|
||||||
|
;; Behave as show1cloze
|
||||||
|
(org-drill-present-multicloze-show1))
|
||||||
|
((not (and (integerp org-drill-cloze-text-weight)
|
||||||
|
(plusp org-drill-cloze-text-weight)))
|
||||||
|
(error "Illegal value for org-drill-cloze-text-weight: %S"
|
||||||
|
org-drill-cloze-text-weight))
|
||||||
|
((zerop (mod (1+ (org-drill-entry-total-repeats 0))
|
||||||
|
org-drill-cloze-text-weight))
|
||||||
|
;; Uncommonly, show the first item
|
||||||
|
(org-drill-present-multicloze-hide-n -1 t))
|
||||||
|
(t
|
||||||
|
;; Commonly, show any item, except the first
|
||||||
|
(org-drill-present-multicloze-hide-n -1 nil nil t))))
|
||||||
|
|
||||||
|
|
||||||
(defun org-drill-present-multicloze-show1 ()
|
(defun org-drill-present-multicloze-show1 ()
|
||||||
|
@ -2195,6 +2284,19 @@ one of the following values:
|
||||||
due))))
|
due))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun org-drill-progress-message (collected scanned)
|
||||||
|
(when (zerop (% scanned 50))
|
||||||
|
(let* ((meter-width 40)
|
||||||
|
(sym1 (if (oddp (floor scanned (* 50 meter-width))) ?| ?.))
|
||||||
|
(sym2 (if (eql sym1 ?.) ?| ?.)))
|
||||||
|
(message "Collecting due drill items:%4d %s%s"
|
||||||
|
collected
|
||||||
|
(make-string (% (ceiling scanned 50) meter-width)
|
||||||
|
sym2)
|
||||||
|
(make-string (- meter-width (% (ceiling scanned 50) meter-width))
|
||||||
|
sym1)))))
|
||||||
|
|
||||||
|
|
||||||
(defun org-drill (&optional scope resume-p)
|
(defun org-drill (&optional scope resume-p)
|
||||||
"Begin an interactive 'drill session'. The user is asked to
|
"Begin an interactive 'drill session'. The user is asked to
|
||||||
review a series of topics (headers). Each topic is initially
|
review a series of topics (headers). Each topic is initially
|
||||||
|
@ -2255,14 +2357,13 @@ than starting a new one."
|
||||||
(warned-about-id-creation nil))
|
(warned-about-id-creation nil))
|
||||||
(org-map-drill-entries
|
(org-map-drill-entries
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(when (zerop (% (incf cnt) 50))
|
(org-drill-progress-message
|
||||||
(message "Processing drill items: %4d%s"
|
|
||||||
(+ (length *org-drill-new-entries*)
|
(+ (length *org-drill-new-entries*)
|
||||||
(length *org-drill-overdue-entries*)
|
(length *org-drill-overdue-entries*)
|
||||||
(length *org-drill-young-mature-entries*)
|
(length *org-drill-young-mature-entries*)
|
||||||
(length *org-drill-old-mature-entries*)
|
(length *org-drill-old-mature-entries*)
|
||||||
(length *org-drill-failed-entries*))
|
(length *org-drill-failed-entries*))
|
||||||
(make-string (ceiling cnt 50) ?.)))
|
(incf cnt))
|
||||||
(cond
|
(cond
|
||||||
((not (org-drill-entry-p))
|
((not (org-drill-entry-p))
|
||||||
nil) ; skip
|
nil) ; skip
|
||||||
|
@ -2361,6 +2462,7 @@ than starting a new one."
|
||||||
(org-drill-save-optimal-factor-matrix))
|
(org-drill-save-optimal-factor-matrix))
|
||||||
(if org-drill-save-buffers-after-drill-sessions-p
|
(if org-drill-save-buffers-after-drill-sessions-p
|
||||||
(save-some-buffers))
|
(save-some-buffers))
|
||||||
|
(message "Drill session finished!")
|
||||||
))))
|
))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,39 @@
|
||||||
;;; ob-lilypond.el --- org-babel functions for lilypond evaluation
|
;;; ob-lilypond.el --- org-babel functions for lilypond evaluation
|
||||||
|
|
||||||
;; Copyright (C) Shelagh Manton, Martyn Jago
|
;; Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;; Authors: Shelagh Manton, Martyn Jago
|
;; Author: Martyn Jago
|
||||||
;; Keywords: literate programming, weaving markup
|
;; Keywords: babel language, literate programming
|
||||||
;; Homepage: https://github.com/sshelagh/ob-lilypond
|
;; Homepage: https://github.com/mjago/ob-lilypond
|
||||||
;; Version: 0.1
|
;; Version: 0.2
|
||||||
|
|
||||||
;;; License:
|
;; This file is part of GNU Emacs.
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||||
;; it under the terms of the GNU General Public License as published by
|
;; it under the terms of the GNU General Public License as published by
|
||||||
;; the Free Software Foundation; either version 3, or (at your option)
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
;; any later version.
|
;; (at your option) any later version.
|
||||||
;;
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
;; GNU General Public License for more details.
|
;; GNU General Public License for more details.
|
||||||
;;
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
;; You should have received a copy of the GNU General Public License
|
||||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||||
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
;; Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
;; see http://github.com/mjago/ob-lilypond
|
;; Installation / usage info, and examples are available at
|
||||||
|
;; https://github.com/mjago/ob-lilypond
|
||||||
;;; Requirements:
|
|
||||||
|
|
||||||
;; You need to have a copy of LilyPond
|
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'ob)
|
(require 'ob)
|
||||||
(require 'ob-eval)
|
(require 'ob-eval)
|
||||||
(defalias 'lilypond-mode 'LilyPond-mode)
|
(defalias 'lilypond-mode 'LilyPond-mode)
|
||||||
(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
|
(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
|
||||||
|
|
||||||
(defconst ly-version "0.1"
|
(defconst ly-version "0.2"
|
||||||
"The version number of the file ob-lilypond.el.")
|
"The version number of the file ob-lilypond.el.")
|
||||||
|
|
||||||
(defvar ly-compile-post-tangle t
|
(defvar ly-compile-post-tangle t
|
||||||
|
@ -373,4 +369,6 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes"
|
||||||
|
|
||||||
(provide 'ob-lilypond)
|
(provide 'ob-lilypond)
|
||||||
|
|
||||||
|
;; arch-tag: ac449eea-2cf2-4dc5-ae33-426f57ba4894
|
||||||
|
|
||||||
;;; ob-lilypond.el ends here
|
;;; ob-lilypond.el ends here
|
|
@ -40,11 +40,19 @@
|
||||||
"#+TITLE: default empty header\n"
|
"#+TITLE: default empty header\n"
|
||||||
"Default header inserted during export of org blocks.")
|
"Default header inserted during export of org blocks.")
|
||||||
|
|
||||||
|
(defun org-babel-expand-body:org (body params)
|
||||||
|
(dolist (var (mapcar #'cdr (org-babel-get-header params :var)))
|
||||||
|
(setq body (replace-regexp-in-string
|
||||||
|
(regexp-quote (format "$%s" (car var))) (cdr var) body
|
||||||
|
nil 'literal)))
|
||||||
|
body)
|
||||||
|
|
||||||
(defun org-babel-execute:org (body params)
|
(defun org-babel-execute:org (body params)
|
||||||
"Execute a block of Org code with.
|
"Execute a block of Org code with.
|
||||||
This function is called by `org-babel-execute-src-block'."
|
This function is called by `org-babel-execute-src-block'."
|
||||||
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(body (replace-regexp-in-string "^," "" body)))
|
(body (org-babel-expand-body:org
|
||||||
|
(replace-regexp-in-string "^," "" body) params)))
|
||||||
(cond
|
(cond
|
||||||
((member "latex" result-params) (org-export-string
|
((member "latex" result-params) (org-export-string
|
||||||
(concat "#+Title: \n" body) "latex"))
|
(concat "#+Title: \n" body) "latex"))
|
||||||
|
|
|
@ -1398,7 +1398,7 @@ the alist of previous items."
|
||||||
;; At an item: insert appropriate tags in export buffer.
|
;; At an item: insert appropriate tags in export buffer.
|
||||||
((assq pos struct)
|
((assq pos struct)
|
||||||
(string-match (concat "[ \t]*\\(\\S-+[ \t]*\\)"
|
(string-match (concat "[ \t]*\\(\\S-+[ \t]*\\)"
|
||||||
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\]\\)?"
|
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\][ \t]*\\)?"
|
||||||
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
|
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
|
||||||
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"
|
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"
|
||||||
"\\(.*\\)")
|
"\\(.*\\)")
|
||||||
|
|
|
@ -161,7 +161,8 @@ If so, return an list containing its label, beginning and ending
|
||||||
positions, and the definition, if local."
|
positions, and the definition, if local."
|
||||||
(when (and (not (or (org-in-commented-line)
|
(when (and (not (or (org-in-commented-line)
|
||||||
(org-in-verbatim-emphasis)))
|
(org-in-verbatim-emphasis)))
|
||||||
(or (org-in-regexp org-footnote-re)
|
(or (looking-at org-footnote-re)
|
||||||
|
(org-in-regexp org-footnote-re)
|
||||||
(save-excursion (re-search-backward org-footnote-re nil t)))
|
(save-excursion (re-search-backward org-footnote-re nil t)))
|
||||||
;; A footnote reference cannot start at bol.
|
;; A footnote reference cannot start at bol.
|
||||||
(/= (match-beginning 0) (point-at-bol)))
|
(/= (match-beginning 0) (point-at-bol)))
|
||||||
|
|
|
@ -2531,7 +2531,7 @@ the alist of previous items."
|
||||||
((assq pos struct)
|
((assq pos struct)
|
||||||
(string-match
|
(string-match
|
||||||
(concat "[ \t]*\\(\\S-+[ \t]*\\)"
|
(concat "[ \t]*\\(\\S-+[ \t]*\\)"
|
||||||
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?"
|
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?"
|
||||||
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
|
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
|
||||||
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"
|
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"
|
||||||
"\\(.*\\)") line)
|
"\\(.*\\)") line)
|
||||||
|
|
|
@ -370,8 +370,8 @@ specifically, type `block' is determined by the variable
|
||||||
It depends on `org-empty-line-terminates-plain-lists'.")
|
It depends on `org-empty-line-terminates-plain-lists'.")
|
||||||
|
|
||||||
(defconst org-list-full-item-re
|
(defconst org-list-full-item-re
|
||||||
(concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]*\\)"
|
(concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\\)"
|
||||||
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?"
|
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?"
|
||||||
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
|
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
|
||||||
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?")
|
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?")
|
||||||
"Matches a list item and puts everything into groups:
|
"Matches a list item and puts everything into groups:
|
||||||
|
@ -1156,7 +1156,7 @@ This function modifies STRUCT."
|
||||||
;; functions, position of point with regards to item start
|
;; functions, position of point with regards to item start
|
||||||
;; (BEFOREP), blank lines number separating items (BLANK-NB),
|
;; (BEFOREP), blank lines number separating items (BLANK-NB),
|
||||||
;; position of split (POS) if we're allowed to (SPLIT-LINE-P).
|
;; position of split (POS) if we're allowed to (SPLIT-LINE-P).
|
||||||
(let* ((item (goto-char (org-list-get-item-begin)))
|
(let* ((item (progn (goto-char pos) (goto-char (org-list-get-item-begin))))
|
||||||
(item-end (org-list-get-item-end item struct))
|
(item-end (org-list-get-item-end item struct))
|
||||||
(item-end-no-blank (org-list-get-item-end-before-blank item struct))
|
(item-end-no-blank (org-list-get-item-end-before-blank item struct))
|
||||||
(beforep (and (looking-at org-list-full-item-re)
|
(beforep (and (looking-at org-list-full-item-re)
|
||||||
|
@ -1647,11 +1647,13 @@ Initial position of cursor is restored after the changes."
|
||||||
((and (match-string 3) new-box)
|
((and (match-string 3) new-box)
|
||||||
(replace-match new-box nil nil nil 3))
|
(replace-match new-box nil nil nil 3))
|
||||||
((match-string 3)
|
((match-string 3)
|
||||||
(goto-char (or (match-end 2) (match-end 1)))
|
;; (goto-char (or (match-end 2) (match-end 1)))
|
||||||
(looking-at "\\[[ X-]\\][ \t]+")
|
;; (skip-chars-backward " \t")
|
||||||
(replace-match ""))
|
(looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)")
|
||||||
(t (goto-char (or (match-end 2) (match-end 1)))
|
(replace-match "" nil nil nil 1))
|
||||||
(insert (concat new-box " "))))
|
(t (let ((counterp (match-end 2)))
|
||||||
|
(goto-char (if counterp (1+ counterp) (match-end 1)))
|
||||||
|
(insert (concat new-box (unless counterp " "))))))
|
||||||
;; c. Indent item to appropriate column.
|
;; c. Indent item to appropriate column.
|
||||||
(unless (= new-ind old-ind)
|
(unless (= new-ind old-ind)
|
||||||
(delete-region (goto-char (point-at-bol))
|
(delete-region (goto-char (point-at-bol))
|
||||||
|
|
14
lisp/org.el
14
lisp/org.el
|
@ -165,6 +165,7 @@ requirements) is loaded."
|
||||||
(const :tag "Javascript" js)
|
(const :tag "Javascript" js)
|
||||||
(const :tag "Latex" latex)
|
(const :tag "Latex" latex)
|
||||||
(const :tag "Ledger" ledger)
|
(const :tag "Ledger" ledger)
|
||||||
|
(const :tag "Lilypond" lilypond)
|
||||||
(const :tag "Maxima" maxima)
|
(const :tag "Maxima" maxima)
|
||||||
(const :tag "Matlab" matlab)
|
(const :tag "Matlab" matlab)
|
||||||
(const :tag "Mscgen" mscgen)
|
(const :tag "Mscgen" mscgen)
|
||||||
|
@ -5271,7 +5272,7 @@ will be prompted for."
|
||||||
t)))
|
t)))
|
||||||
|
|
||||||
(defun org-activate-footnote-links (limit)
|
(defun org-activate-footnote-links (limit)
|
||||||
"Run through the buffer and add overlays to links."
|
"Run through the buffer and add overlays to footnotes."
|
||||||
(let ((fn (org-footnote-next-reference-or-definition limit)))
|
(let ((fn (org-footnote-next-reference-or-definition limit)))
|
||||||
(when fn
|
(when fn
|
||||||
(let ((beg (nth 1 fn)) (end (nth 2 fn)))
|
(let ((beg (nth 1 fn)) (end (nth 2 fn)))
|
||||||
|
@ -5282,10 +5283,10 @@ will be prompted for."
|
||||||
'help-echo
|
'help-echo
|
||||||
(if (= (point-at-bol) beg)
|
(if (= (point-at-bol) beg)
|
||||||
"Footnote definition"
|
"Footnote definition"
|
||||||
"Footnote reference")))
|
"Footnote reference")
|
||||||
(save-excursion
|
'font-lock-fontified t
|
||||||
(goto-char beg)
|
'font-lock-multiline t
|
||||||
(looking-at (regexp-quote (buffer-substring beg end))))))))
|
'face 'org-footnote))))))
|
||||||
|
|
||||||
(defun org-activate-bracket-links (limit)
|
(defun org-activate-bracket-links (limit)
|
||||||
"Run through the buffer and add overlays to bracketed links."
|
"Run through the buffer and add overlays to bracketed links."
|
||||||
|
@ -5580,8 +5581,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
|
||||||
(if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
|
(if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
|
||||||
(if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
|
(if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
|
||||||
(if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
|
(if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
|
||||||
(if (memq 'footnote lk) '(org-activate-footnote-links
|
(if (memq 'footnote lk) '(org-activate-footnote-links))
|
||||||
(0 'org-footnote t)))
|
|
||||||
'("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
|
'("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
|
||||||
'(org-hide-wide-columns (0 nil append))
|
'(org-hide-wide-columns (0 nil append))
|
||||||
;; TODO lines
|
;; TODO lines
|
||||||
|
|
Loading…
Reference in New Issue