Compare commits

..

No commits in common. "8a6071f20ea3f8428446d18a30d150b45ee622bd" and "a371e6c9ae41e04a2ecf45c1984dcf117cd1693b" have entirely different histories.

View File

@ -2015,8 +2015,11 @@ of the [[info:org#Top][Org (info)]] manual.
I have split the initial [[https://orgmode.org/][Org-mode]] setup over several listings. Here, follows a I have split the initial [[https://orgmode.org/][Org-mode]] setup over several listings. Here, follows a
list detailing and motivating each listing: list detailing and motivating each listing:
1. Listing [[lst:set-org-options]] handles basic [[https://orgmode.org/][Org-mode]] options. 1. Listing [[lst:set-org-options]] handles basic [[https://orgmode.org/][Org-mode]] options.
2. Listing [[lst:setup-org-babel]] handles basic [[https://orgmode.org/][Org-mode]] options specific to 2. Listing [[lst:set-org-babel-options]] handles basic [[https://orgmode.org/][Org-mode]] options specific to
[[info:org#Working with Source Code][work with source code (info)]]. [[info:org#Working with Source Code][work with source code (info)]] and it
selects the Python interpreter by means of
src_emacs-lisp{(choose-common-python-interpreter)} defined in listing
[[lst:choose-common-python-interpreter]].
3. Listing [[lst:set-org-link-options]] handles [[https://orgmode.org/][Org-mode]] options specific to 3. Listing [[lst:set-org-link-options]] handles [[https://orgmode.org/][Org-mode]] options specific to
[[info:org#Hyperlinks][hyperlinks (info)]]. [[info:org#Hyperlinks][hyperlinks (info)]].
4. Listing [[lst:setup-org-mode-map]] extends the =org-mode-map= with useful 4. Listing [[lst:setup-org-mode-map]] extends the =org-mode-map= with useful
@ -2047,18 +2050,19 @@ list detailing and motivating each listing:
(calc . t) (calc . t)
(dot . ,(fboundp 'grapviz-dot-mode)) (dot . ,(fboundp 'grapviz-dot-mode))
(emacs-lisp . t) (emacs-lisp . t)
;; (eshell . t) ; bug
(fortran . t) (fortran . t)
(gnuplot . ,(fboundp 'gnuplot-mode)) (gnuplot . ,(fboundp 'gnuplot-mode))
(js . t) (js . t)
(latex . t) (latex . t)
(lisp . t) (lisp . t)
;; (lua . ,(fboundp 'lua-mode)) ; bug (lua . ,(fboundp 'lua-mode))
(maxima . ,(fboundp 'maxima-mode)) (maxima . ,(fboundp 'maxima-mode))
(org . t) (org . t)
(perl . t) (perl . t)
;; Postpone Python activation to prevent calling still unbound functions. ;; The Python setup uses the two functions below.
(python . nil) ;; Those functions are not yet bound during bootstrap.
(python . ,(and (fboundp 'choose-common-python-interpreter)
(fboundp 'choose-common-python-linter)))
(shell . t)) (shell . t))
org-export-backends '(ascii beamer html icalendar latex odt texinfo) org-export-backends '(ascii beamer html icalendar latex odt texinfo)
org-file-apps '((auto-mode . emacs) org-file-apps '((auto-mode . emacs)
@ -2106,38 +2110,8 @@ list detailing and motivating each listing:
(with-eval-after-load 'sly (with-eval-after-load 'sly
(setopt org-babel-lisp-eval-fn #'sly-eval))) (setopt org-babel-lisp-eval-fn #'sly-eval)))
(with-eval-after-load 'emacs (with-eval-after-load 'ob-python
(defun set-org-babel-language-activity (lang active) (choose-common-python-interpreter 'python))
"Set the `org-babel' activity of language LANG to ACTIVE.
Let `org-babel-do-load-languages' load ob-LANG when ACTIVE is t or
unbind the `org-babel' interface functions when ACTIVE is nil."
(if (locate-library (format "ob-%s" lang))
(or (org-babel-do-load-languages
'org-babel-load-languages
(cons (cons lang active)
(assq-delete-all
lang (default-toplevel-value 'org-babel-load-languages))))
org-babel-load-languages)
(warn "Can't locate `ob-%s', hence don't set `%s' activity" lang lang)))
(defun activate-org-babel-language (lang)
"Activate LANG for `org-babel'."
(interactive "SActivate language: ")
(if (set-org-babel-language-activity lang t)
(message "Did activate `%s' for `org-babel'" lang)
(message "Can't activate `%s' for `org-babel'" lang)))
(defun deactivate-org-babel-language (lang)
"Activate LANG for `org-babel'."
(interactive "SDeactivate language: ")
(if (set-org-babel-language-activity lang nil)
(message "Did deactivate `%s' for `org-babel'" lang)
(message "Can't deactivate `%s' for `org-babel'" lang)))
;; Work around a "(defcustom org-babel-load-languages)" call bug.
(set-org-babel-language-activity 'eshell t)
(set-org-babel-language-activity 'ruby (fboundp 'lua-mode)))
#+end_src #+end_src
#+caption[Set =org-link= options]: #+caption[Set =org-link= options]:
@ -2186,7 +2160,6 @@ When called twice, replace the previously inserted \\(\\) by one $."
stamp))) stamp)))
(with-eval-after-load 'org (with-eval-after-load 'org
(setopt org-return-follows-link t)
(define-key org-mode-map (define-key org-mode-map
(kbd "C-c <SPC>") #'org-inactive-current-time-stamp) (kbd "C-c <SPC>") #'org-inactive-current-time-stamp)
(define-key org-mode-map (define-key org-mode-map
@ -4299,7 +4272,7 @@ install and use [[https://gitlab.com/andreyorst/ob-fennel][ob-fennel]] with the
(unless (package-installed-p 'ob-fennel) (unless (package-installed-p 'ob-fennel)
(quelpa '(ob-fennel :repo "andreyorst/ob-fennel" :fetcher gitlab))) (quelpa '(ob-fennel :repo "andreyorst/ob-fennel" :fetcher gitlab)))
(when (ensure-package-selection 'ob-fennel) (when (ensure-package-selection 'ob-fennel)
(set-org-babel-language-activity 'fennel (fboundp 'fennel-mode)))) (org-babel-do-load-languages 'fennel (fboundp 'fennel-mode))))
#+end_src #+end_src
#+caption[Fennel example]: #+caption[Fennel example]:
@ -4452,8 +4425,6 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][
(defun choose-common-python-interpreter (&optional interpreter) (defun choose-common-python-interpreter (&optional interpreter)
"Let `ob-python' and `python-mode' use the same Python INTERPRETER." "Let `ob-python' and `python-mode' use the same Python INTERPRETER."
(interactive) (interactive)
(unless (featurep 'ob-python)
(set-org-babel-language-activity 'python (fboundp 'python-mode)))
(let* ((prompt (format "Choose Python (%s): " (let* ((prompt (format "Choose Python (%s): "
(bound-and-true-p python-shell-interpreter))) (bound-and-true-p python-shell-interpreter)))
(choices '(ipython python)) (choices '(ipython python))