Re-align the table, move to the next field. Creates a new row if
necessary.
-- {{{kbd(C-c SPC)}}} (~org-table-blank-field~) ::
+- {{{kbd(M-x org-table-blank-field)}}} ::
- #+kindex: C-c SPC
#+findex: org-table-blank-field
Blank the field at point.
:END:
#+cindex: citation
-As of Org 9.5, a new library =oc.el= provides tooling to handle
-citations in Org via "citation processors" that offer some or all of
-the following capabilities:
+The =oc.el= library provides tooling to handle citations in Org via
+"citation processors" that offer some or all of the following
+capabilities:
-- "activate" :: Fontification, tooltip preview, etc.
-- "follow" :: At-point actions on citations via ~org-open-at-point~.
-- "insert" :: Add and edit citations via ~org-cite-insert~.
-- "export" :: Via different libraries for different target formats.
+- activate :: Fontification, tooltip preview, etc.
+- follow :: At-point actions on citations via ~org-open-at-point~.
+- insert :: Add and edit citations via ~org-cite-insert~.
+- export :: Via different libraries for different target formats.
-The user can configure these with ~org-cite-active-processor~,
+The user can configure these with ~org-cite-activate-processor~,
~org-cite-follow-processor~, ~org-cite-insert-processor~, and
~org-cite-export-processors~ respectively.
#+bibliography: "/some/file/with spaces/in its name.bib"
#+end_example
+#+kindex: C-c C-x @
+#+findex: org-cite-insert
One can then insert and edit citations using ~org-cite-insert~, called
-with {{{kbd(M-x org-cite-insert)}}}.
+with {{{kbd(C-c C-x @)}}}.
A /citation/ requires one or more citation /key(s)/, elements
identifying a reference in the bibliography.
- Each key starts with the character =@=.
-- Each key can be qualified by a /prefix/ (e.g. "see ") and/or a
- /suffix/ (e.g. "p. 123"), giving informations useful or necessary fo
- the comprehension of the citation but not included in the reference.
+- Each key can be qualified by a /prefix/ (e.g.\nbsp{}"see ") and/or
+ a /suffix/ (e.g.\nbsp{}"p.\nbsp{}123"), giving informations useful or necessary
+ fo the comprehension of the citation but not included in the
+ reference.
- A single citation can cite more than one reference ; the keys are
separated by semicolons ; the formatting of such citation groups is
- One can also specify a stylistic variation for the citations by
inserting a =/= and a style name between the =cite= keyword and the
- colon ; this usially makes sense only for the author-year styles.
+ colon; this usually makes sense only for the author-year styles.
-#+begin_example
-[cite/style:common prefix ;prefix @key suffix; ... ; common suffix]
-#+end_example
+: [cite/style:common prefix ;prefix @key suffix; ... ; common suffix]
The only mandatory elements are:
- Two processors can export to a variety of formats, including =latex=
(and therefore =pdf=), =html=, =odt= and plain (UTF8) text:
- - basic :: a basic export processors, well adapted to situations
+ - basic :: a basic export processor, well adapted to situations
where backward compatibility is not a requirement and formatting
needs are minimal;
- In contrast, two other processors target LaTeX and LaTeX-derived
formats exclusively:
- - natbib :: this export processor uses =bibtex=, the historical
+ - natbib :: this export processor uses BibTeX, the historical
bibliographic processor used with LaTeX, thus allowing the use of
- data and style files compatible with this processor (including a
- large number of publishers' styles). It uses citation commands
+ data and style files compatible with this processor (including
+ a large number of publishers' styles). It uses citation commands
implemented in the LaTeX package =natbib=, allowing more stylistic
variants that LaTeX's =\cite= command.
- biblatex :: this backend allows the use of data and formats
- prepared for =biblatex=, an alternate bibliographic processor used
- with LaTeX, which overcomes some serious =bibtex= limitations, but
- has not (yet?) been widely adopted by publishers.
+ prepared for BibLaTeX, an alternate bibliographic processor used
+ with LaTeX, which overcomes some serious BibTeX limitations, but
+ has not (yet?)\nbsp{}been widely adopted by publishers.
-The =#+cite_export:= keyword specifies the export processor and the
+The =CITE_EXPORT= keyword specifies the export processor and the
citation (and possibly reference) style(s); for example (all arguments
are optional)
-#+begin_example
-#+cite_export: basic author author-year
-#+end_example
+: #+cite_export: basic author author-year
+#+texinfo: @noindent
specifies the "basic" export processor with citations inserted as
author's name and references indexed by author's names and year;
-#+begin_example
-#+cite_export: csl /some/path/to/vancouver-brackets.csl
-#+end_example
+: #+cite_export: csl /some/path/to/vancouver-brackets.csl
+#+texinfo: @noindent
specifies the "csl" processor and CSL style, which in this case
defines numeric citations and numeric references according to the
=Vancouver= specification (as style used in many medical journals),
following a typesetting variation putting citations between brackets;
-#+begin_example
-#+cite_export: natbib kluwer
-#+end_example
+: #+cite_export: natbib kluwer
-specifies the "natbib" export processor with a label citation style
+#+texinfo: @noindent
+specifies the =natbib= export processor with a label citation style
conformant to the Harvard style and the specification of the
-Wolkers-Kluwer publisher; since it relies on the =bibtex= processor of
+Wolkers-Kluwer publisher; since it relies on the ~bibtex~ processor of
your LaTeX installation, it won't export to anything but PDF.
* Working with Source Code
(org-cite-biblatex--atomic-arguments (list r) info))
(org-cite-get-references citation)
"")
- ;; According to biblatex manual, left braces or brackets
+ ;; According to BibLaTeX manual, left braces or brackets
;; following a multicite command could be parsed as other
- ;; arguments. So we look ahead and insert a \relax if
- ;; needed.
- (and (let ((next (org-export-get-next-element citation info)))
- (and next
- (string-match (rx string-start (or "{" "["))
- (org-export-data next info))))
- "\\relax"))))
+ ;; arguments. So we stop any further parsing by inserting
+ ;; a \relax unconditionally.
+ "\\relax")))
(defun org-cite-biblatex--command (citation info base &optional multi no-opt)
"Return biblatex command using BASE name for CITATION object.
'((("author" "a") ("caps" "c") ("full" "f") ("caps-full" "cf"))
(("locators" "l") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
(("noauthor" "na"))
+ (("nocite" "n"))
(("text" "t") ("caps" "c"))
(("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))))
(declare-function org-element-type "org-element" (element))
(declare-function org-export-derived-backend-p "org-export" (backend &rest backends))
-(declare-function org-export-get-footnote-definition "org-export" (footnote-reference info))
(declare-function org-export-get-next-element "org-export" (blob info &optional n))
(declare-function org-export-get-previous-element "org-export" (blob info &optional n))
(declare-function org-export-raw-string "org-export" (s))
(NAME BIBLIOGRAPHY-STYLE CITATION-STYLE)
There, NAME is the name of a registered citation processor providing export
-functionality, as a symbol. BIBLIOGRAPHY-STYLE (resp. CITATION-STYLE) is the
-desired default style to use when printing a bibliography (resp. exporting a
-citation), as a string or nil. Both BIBLIOGRAPHY-STYLE and CITATION-STYLE are
-optional. NAME is mandatory.
+functionality, as a symbol. BIBLIOGRAPHY-STYLE (respectively CITATION-STYLE)
+is the desired default style to use when printing a bibliography (respectively
+exporting a citation), as a string or nil. Both BIBLIOGRAPHY-STYLE and
+CITATION-STYLE are optional. NAME is mandatory.
The export process selects the citation processor associated to the current
export back-end, or the most specific back-end the current one is derived from,
(defun org-cite--move-punct-before (punct citation s info)
"Move punctuation PUNCT before CITATION object.
-String S contains PUNCT. The function assumes S follows CITATION.
-Parse tree is modified by side-effect."
+String S contains PUNCT. INFO is the export state, as a property list.
+The function assumes S follows CITATION. Parse tree is modified by side-effect."
(if (equal s punct)
(org-element-extract-element s) ;it would be empty anyway
(org-element-set-element s (substring s (length punct))))
;; Do not force entering inline definitions, since
;; `org-element-map' is going to enter it anyway.
((guard (eq 'inline (org-element-property :type datum))))
+ ;; Find definition for current standard
+ ;; footnote reference. Unlike to
+ ;; `org-export-get-footnote-definition', do
+ ;; not cache results as they would contain
+ ;; un-processed citation objects.
(_
- (funcall search-cites
- (org-export-get-footnote-definition datum info)))))
+ (let ((label (org-element-property :label datum)))
+ (funcall
+ search-cites
+ (org-element-map data 'footnote-definition
+ (lambda (d)
+ (and
+ (equal label (org-element-property :label d))
+ (or (org-element-contents d) "")))))))))
info nil 'footnote-definition t))))
(funcall search-cites (plist-get info :parse-tree))
(let ((result (nreverse cites)))
INFO is the export state, as a property list.
+Optional argument RULE is the punctuation rule used, as a triplet. When nil,
+rule is determined according to `org-cite-note-rules', which see.
+
Optional argument PUNCT is a list of punctuation marks to be considered.
When nil, it defaults to `org-cite-punctuation-marks'.
Parse tree is modified by side-effect.
Note: when calling both `org-cite-adjust-note' and `org-cite-wrap-citation' on
-the same object, call `org-cite-adjust-punctuation' first."
+the same object, call `org-cite-adjust-note' first."
(when org-cite-adjust-note-numbers
(pcase-let* ((rule (or rule (org-cite--get-note-rule info)))
(punct-re (regexp-opt (or punct org-cite-punctuation-marks)))
;; Before removing the citation, transfer its `:post-blank'
;; property to the object before, if any.
(org-cite--set-previous-post-blank cite blanks info)
- ;; We want to be sure any non-note citation is preceded by
- ;; a space. This is particularly important when using
+ ;; Make sure there is a space between a quotation mark and
+ ;; a citation. This is particularly important when using
;; `adaptive' note rule. See `org-cite-note-rules'.
- (unless (org-cite-inside-footnote-p cite t)
- (org-cite--set-previous-post-blank cite 1 info))
+ (let ((previous (org-export-get-previous-element cite info)))
+ (when (and (org-string-nw-p previous)
+ (string-suffix-p "\"" previous))
+ (org-cite--set-previous-post-blank cite 1 info)))
(pcase replacement
;; String.
((pred stringp)
\f
;;; Meta-command for citation insertion (insert capability)
(defun org-cite--allowed-p (context)
- "Non-nil when a citation can be inserted at point."
+ "Non-nil when a citation can be inserted at point.
+CONTEXT is the element or object at point, as returned by `org-element-context'."
(let ((type (org-element-type context)))
(cond
;; No citation in attributes, except in parsed ones.
(skip-chars-backward " \r\t\n")
(if (eq (org-element-class context) 'object) (point)
(line-beginning-position 2)))))
- ;; At the start of a list item is fine, as long as the bullet is unaffected.
+ ;; At the beginning of a footnote definition, right after the
+ ;; label, is OK.
+ ((eq type 'footnote-definition) (looking-at (rx space)))
+ ;; At the start of a list item is fine, as long as the bullet is
+ ;; unaffected.
((eq type 'item)
(> (point) (+ (org-element-property :begin context)
(current-indentation)
--- /dev/null
+;;; ol-man.el --- Links to man pages -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Author: Carsten Dominik <carsten.dominik@gmail.com>
+;; Maintainer: Bastien Guerry <bzg@gnu.org>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: https://orgmode.org
+;;
+;; This file is part of GNU Emacs.
+;;
+;; 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
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+(require 'ol)
+
+(org-link-set-parameters "man"
+ :follow #'org-man-open
+ :export #'org-man-export
+ :store #'org-man-store-link)
+
+(defcustom org-man-command 'man
+ "The Emacs command to be used to display a man page."
+ :group 'org-link
+ :type '(choice (const man) (const woman)))
+
+(defun org-man-open (path _)
+ "Visit the manpage on 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."
+ (when (memq major-mode '(Man-mode woman-mode))
+ ;; This is a man page, we do make this link
+ (let* ((page (org-man-get-page-name))
+ (link (concat "man:" page))
+ (description (format "Manpage for %s" page)))
+ (org-link-store-props
+ :type "man"
+ :link link
+ :description description))))
+
+(defun org-man-get-page-name ()
+ "Extract the page name from the buffer name."
+ ;; This works for both `Man-mode' and `woman-mode'.
+ (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
+ (match-string 1 (buffer-name))
+ (error "Cannot create link to this man page")))
+
+(defun org-man-export (link description format)
+ "Export a man page link from Org files."
+ (let ((path (format "http://man.he.net/?topic=%s§ion=all" link))
+ (desc (or description link)))
+ (cond
+ ((eq format 'html) (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
+ ((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)
+
+;;; ol-man.el ends here
(save-excursion (goto-char (org-element-property :end context))
(skip-chars-backward " \r\t\n")
(if (eq (org-element-class context) 'object) (point)
- (1+ (line-beginning-position 2))))))
+ (line-beginning-position 2)))))
+ ;; At the beginning of a footnote definition, right after the
+ ;; label, is OK.
+ ((eq type 'footnote-definition) (looking-at (rx space)))
;; Other elements are invalid.
((eq (org-element-class context) 'element) nil)
;; Just before object is fine.
(lambda (datum name)
(goto-char (org-element-property :begin datum))
(re-search-forward
- (format "^[ \t]*#\\+[A-Za-z]+: +%s *$" (regexp-quote name)))
+ (format "^[ \t]*#\\+[A-Za-z]+:[ \t]*%s[ \t]*$" (regexp-quote name)))
(match-beginning 0))
(lambda (key) (format "Duplicate NAME \"%s\"" key))))
(defun org-git-version ()
"The Git version of Org mode.
Inserted by installing Org or when a release is made."
- (let ((org-git-version "release_9.5-30-g10dc9d"))
+ (let ((org-git-version "release_9.5-46-gb71474"))
org-git-version))
\f
(provide 'org-version)
"Save all Org buffers without user confirmation."
(interactive)
(message "Saving all Org buffers...")
- (save-some-buffers t (lambda () (derived-mode-p 'org-mode)))
+ (save-some-buffers t (lambda () (and (derived-mode-p 'org-mode) t)))
(when (featurep 'org-id) (org-id-locations-save))
(message "Saving all Org buffers... done"))