Backport commit 05f9ffd53 from Emacs

* doc/org.texi (Batch execution): Simplify example script so that it
does not need expand-file-name and thus will not mishandle file names
with leading ~.

Improve expand-file-name doc
05f9ffd53c65699e8de6cca4817b1f2dc2f63a79
Paul Eggert
Fri Aug 25 21:14:06 2017 -0700

(cherry picked from commit ca7d3bd77c)
This commit is contained in:
Paul Eggert 2017-08-25 21:12:37 -07:00 committed by Kyle Meyer
parent ba0281e3f9
commit 88e3570b21
1 changed files with 12 additions and 19 deletions

View File

@ -1047,8 +1047,8 @@ shown below.
debug-on-quit nil)
;; add latest org-mode to load path
(add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
(add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
(add-to-list 'load-path "/path/to/org-mode/lisp")
(add-to-list 'load-path "/path/to/org-mode/contrib/lisp" t)
@end lisp
If an error occurs, a backtrace can be very useful (see below on how to
@ -17196,25 +17196,18 @@ The sample script shows batch processing of multiple files using
@example
#!/bin/sh
# -*- mode: shell-script -*-
#
# tangle files with org-mode
#
DIR=`pwd`
FILES=""
# wrap each argument in the code required to call tangle on it
for i in $@@; do
FILES="$FILES \"$i\""
done
emacs -Q --batch \
--eval "(progn
(require 'org)(require 'ob)(require 'ob-tangle)
(mapc (lambda (file)
(find-file (expand-file-name file \"$DIR\"))
(org-babel-tangle)
(kill-buffer)) '($FILES)))" 2>&1 |grep -i tangled
emacs -Q --batch --eval "
(progn
(require 'ob-tangle)
(mapc (lambda (file)
(save-current-buffer
(find-file file)
(org-babel-tangle)
(kill-buffer)))
command-line-args-left))
" "$@@"
@end example
@node Miscellaneous