pkg update and first config fix

org-brain not working, add org-roam
This commit is contained in:
2022-12-19 23:02:34 +01:00
parent 02b3e07185
commit 82f05baffe
885 changed files with 356098 additions and 36993 deletions

View File

@@ -1,10 +1,10 @@
;;; org-table.el --- The Table Editor for Org -*- lexical-binding: t; -*-
;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: https://orgmode.org
;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -34,6 +34,9 @@
;;; Code:
(require 'org-macs)
(org-assert-version)
(require 'cl-lib)
(require 'org-macs)
(require 'org-compat)
@@ -47,7 +50,7 @@
(declare-function org-mode "org" ())
(declare-function org-duration-p "org-duration" (duration &optional canonical))
(declare-function org-duration-to-minutes "org-duration" (duration &optional canonical))
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-contents "org-element" (element))
(declare-function org-element-extract-element "org-element" (element))
(declare-function org-element-interpret-data "org-element" (data))
@@ -56,6 +59,7 @@
(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
(declare-function org-element-cache-reset "org-element" (&optional all no-persistence))
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
(declare-function org-export-create-backend "ox" (&rest rest) t)
(declare-function org-export-data-with-backend "ox" (data backend info))
@@ -462,14 +466,14 @@ This may be useful when columns have been shrunk."
(when pos (goto-char pos))
(goto-char (line-beginning-position))
(let ((end (line-end-position)) str)
(backward-char)
(goto-char (1- pos))
(while (progn (forward-char 1) (< (point) end))
(let ((ov (car (overlays-at (point)))))
(if (not ov)
(push (char-to-string (char-after)) str)
(push (overlay-get ov 'display) str)
(goto-char (1- (overlay-end ov))))))
(format "%s" (mapconcat #'identity (reverse str) "")))))
(format "|%s" (mapconcat #'identity (reverse str) "")))))
(defvar-local org-table-header-overlay nil)
(defun org-table-header-set-header ()
@@ -486,7 +490,7 @@ This may be useful when columns have been shrunk."
(looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>"))
(move-beginning-of-line 2))
(line-beginning-position)))
(end (save-excursion (goto-char beg) (point-at-eol))))
(end (save-excursion (goto-char beg) (line-end-position))))
(if (pos-visible-in-window-p beg)
(when (overlayp org-table-header-overlay)
(delete-overlay org-table-header-overlay))
@@ -566,11 +570,23 @@ This works for both table types.")
(concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
"Match a reference that needs translation, for reference display.")
(defconst org-table-separator-space
(defconst org-table--separator-space-pre
(propertize " " 'display '(space :relative-width 1))
"Space used around fields when aligning the table.
"Space used in front of fields when aligning the table.
This space serves as a segment separator for the purposes of the
bidirectional reordering.")
bidirectional reordering.
Note that `org-table--separator-space-pre' is not `eq' to
`org-table--separator-space-post'. This is done to prevent Emacs from
visually merging spaces in an empty table cell. See bug#45915.")
(defconst org-table--separator-space-post
(propertize " " 'display '(space :relative-width 1.001))
"Space used after fields when aligning the table.
This space serves as a segment separator for the purposes of the
bidirectional reordering.
Note that `org-table--separator-space-pre' is not `eq' to
`org-table--separator-space-post'. This is done to prevent Emacs from
visually merging spaces in an empty table cell. See bug#45915.")
;;; Internal Variables
@@ -825,7 +841,7 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
(line (concat (apply 'concat indent "|" (make-list columns " |"))
"\n")))
(if (string-match "^[ \t]*$" (buffer-substring-no-properties
(point-at-bol) (point)))
(line-beginning-position) (point)))
(beginning-of-line 1)
(newline))
;; (mapcar (lambda (x) (insert line)) (make-list rows t))
@@ -843,7 +859,11 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
"Convert region to a table.
The region goes from BEG0 to END0, but these borders will be moved
slightly, to make sure a beginning of line in the first line is included.
slightly, to make sure a beginning of line in the first line is
included.
Throw an error when the region has more than
`org-table-convert-region-max-lines' lines.
SEPARATOR specifies the field separator in the lines. It can have the
following values:
@@ -1087,7 +1107,7 @@ With numeric argument N, move N-1 fields backward first."
(while (> n 1)
(setq n (1- n))
(org-table-previous-field))
(if (not (re-search-backward "|" (point-at-bol 0) t))
(if (not (re-search-backward "|" (line-beginning-position 0) t))
(user-error "No more table fields before the current")
(goto-char (match-end 0))
(and (looking-at " ") (forward-char 1)))
@@ -1102,7 +1122,7 @@ With numeric argument N, move N-1 fields forward first."
(while (> n 1)
(setq n (1- n))
(org-table-next-field))
(when (re-search-forward "|" (point-at-eol 1) t)
(when (re-search-forward "|" (line-end-position 1) t)
(backward-char 1)
(skip-chars-backward " ")
(when (and (equal (char-before (point)) ?|) (equal (char-after (point)) ?\s))
@@ -1159,7 +1179,7 @@ When ALIGN is set, also realign the table."
(goto-char (org-table-begin))
(while (and (re-search-forward org-table-dataline-regexp end t)
(setq cnt (1+ cnt))
(< (point-at-eol) pos))))
(< (line-end-position) pos))))
cnt))
(defun org-table-current-column ()
@@ -1322,7 +1342,7 @@ However, when FORCE is non-nil, create new columns if necessary."
(beginning-of-line 1)
(when (> n 0)
(while (and (> (setq n (1- n)) -1)
(or (search-forward "|" (point-at-eol) t)
(or (search-forward "|" (line-end-position) t)
(and force
(progn (end-of-line 1)
(skip-chars-backward "^|")
@@ -1339,6 +1359,9 @@ However, when FORCE is non-nil, create new columns if necessary."
"Insert a new column into the table."
(interactive)
(unless (org-at-table-p) (user-error "Not at a table"))
(when (eobp) (save-excursion (insert "\n")))
(unless (string-match-p "|[ \t]*$" (org-current-line-string))
(org-table-align))
(org-table-find-dataline)
(let ((col (max 1 (org-table-current-column)))
(beg (org-table-begin))
@@ -1633,6 +1656,9 @@ Swap with anything in target cell."
With prefix ARG, insert below the current line."
(interactive "P")
(unless (org-at-table-p) (user-error "Not at a table"))
(when (eobp) (save-excursion (insert "\n")))
(unless (string-match-p "|[ \t]*$" (org-current-line-string))
(org-table-align))
(org-table-with-shrunk-columns
(let* ((line (buffer-substring (line-beginning-position) (line-end-position)))
(new (org-table-clean-line line)))
@@ -1663,7 +1689,7 @@ With prefix ABOVE, insert above the current line."
(org-table-align))
(org-table-with-shrunk-columns
(let ((line (org-table-clean-line
(buffer-substring (point-at-bol) (point-at-eol))))
(buffer-substring (line-beginning-position) (line-end-position))))
(col (current-column)))
(while (string-match "|\\( +\\)|" line)
(setq line (replace-match
@@ -1712,7 +1738,8 @@ In particular, this does handle wide and invisible characters."
(dline (and (not (org-match-line org-table-hline-regexp))
(org-table-current-dline))))
(org-table-with-shrunk-columns
(kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
(kill-region (line-beginning-position)
(min (1+ (line-end-position)) (point-max)))
(if (not (org-at-table-p)) (beginning-of-line 0))
(org-move-to-column col)
(when (and dline
@@ -2253,14 +2280,15 @@ For all numbers larger than LIMIT, shift them by DELTA."
(format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
s n a)
(when remove
(while (re-search-forward re2 (point-at-eol) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)"))
(if (equal (char-before (match-beginning 0)) ?.)
(user-error
"Change makes TBLFM term %s invalid, use undo to recover"
(match-string 0))
(replace-match "")))))
(while (re-search-forward re (point-at-eol) t)
(save-excursion
(while (re-search-forward re2 (line-end-position) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)"))
(if (equal (char-before (match-beginning 0)) ?.)
(user-error
"Change makes TBLFM term %s invalid, use undo to recover"
(match-string 0))
(replace-match ""))))))
(while (re-search-forward re (line-end-position) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)"))
(setq s (match-string 1) n (string-to-number s))
(cond
@@ -2606,8 +2634,7 @@ location of point."
(format-time-string
(org-time-stamp-format
(string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))
(apply #'encode-time
(save-match-data (org-parse-time-string ts))))))
(save-match-data (org-time-string-to-time ts)))))
form t t))
(setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
@@ -2868,7 +2895,7 @@ ARGS are passed as arguments to the `message' function. Returns
current time if a message is printed, otherwise returns T1. If
T1 is nil, always messages."
(let ((curtime (current-time)))
(if (or (not t1) (org-time-less-p 1 (org-time-subtract curtime t1)))
(if (or (not t1) (time-less-p 1 (time-subtract curtime t1)))
(progn (apply 'message args)
curtime)
t1)))
@@ -3414,7 +3441,9 @@ full TBLFM line."
(defun org-table-convert-refs-to-an (s)
"Convert spreadsheet references from to @7$28 to AB7.
Works for single references, but also for entire formulas and even the
full TBLFM line."
full TBLFM line.
Leave the relative references unchanged."
(while (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" s)
(setq s (replace-match
(format "%s%d"
@@ -3422,7 +3451,7 @@ full TBLFM line."
(string-to-number (match-string 2 s)))
(string-to-number (match-string 1 s)))
t t s)))
(while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([0-9]+\\)" s)
(while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([1-9][0-9]*\\)" s)
(setq s (replace-match (concat "\\1"
(org-number-to-letters
(string-to-number (match-string 2 s))) "&")
@@ -3666,8 +3695,6 @@ With prefix ARG, apply the new formulas to the table."
(goto-char pos)
(call-interactively 'lisp-indent-line))
((looking-at "[$&@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos))
((not (fboundp 'pp-buffer))
(user-error "Cannot pretty-print. Command `pp-buffer' is not available"))
((looking-at "[$&@0-9a-zA-Z]+ *= *'(")
(goto-char (- (match-end 0) 2))
(setq beg (point))
@@ -3789,8 +3816,9 @@ FACE, when non-nil, for the highlight."
(let ((id 0) (ih 0) hline eol str ov)
(goto-char (org-table-begin))
(while (org-at-table-p)
(setq eol (point-at-eol))
(setq ov (make-overlay (point-at-bol) (1+ (point-at-bol))))
(setq eol (line-end-position))
(setq ov (make-overlay (line-beginning-position)
(1+ (line-beginning-position))))
(push ov org-table-coordinate-overlays)
(setq hline (looking-at org-table-hline-regexp))
(setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))
@@ -3888,7 +3916,7 @@ mouse onto the overlay.
When optional argument PRE is non-nil, assume the overlay is
located at the beginning of the field, and prepend
`org-table-separator-space' to it. Otherwise, concatenate
`org-table--separator-space-pre' to it. Otherwise, concatenate
`org-table-shrunk-column-indicator' at its end.
Return the overlay."
@@ -3907,7 +3935,7 @@ Return the overlay."
;; Make sure overlays stays on top of table coordinates overlays.
;; See `org-table-overlay-coordinates'.
(overlay-put o 'priority 1)
(let ((d (if pre (concat org-table-separator-space display)
(let ((d (if pre (concat org-table--separator-space-pre display)
(concat display org-table-shrunk-column-indicator))))
(org-overlay-display o d 'org-table t))
o))
@@ -4080,7 +4108,7 @@ COLUMNS is a sorted list of column numbers. BEG and END are,
respectively, the beginning position and the end position of the
table."
(org-with-wide-buffer
(org-font-lock-ensure beg end)
(font-lock-ensure beg end)
(dolist (c columns)
(goto-char beg)
(let ((align nil)
@@ -4202,7 +4230,7 @@ beginning and end position of the current table."
(org-table-expand begin end)
;; Make sure invisible characters in the table are at the right
;; place since column widths take them into account.
(org-font-lock-ensure begin end)
(font-lock-ensure begin end)
(org-table--shrink-columns (sort columns #'<) begin end))))
;;;###autoload
@@ -4320,11 +4348,11 @@ FIELD is a string. WIDTH is a number. ALIGN is either \"c\",
("r" (make-string spaces ?\s))
("c" (make-string (/ spaces 2) ?\s))))
(suffix (make-string (- spaces (length prefix)) ?\s)))
(concat org-table-separator-space
(concat org-table--separator-space-pre
prefix
field
suffix
org-table-separator-space)))
org-table--separator-space-post)))
(defun org-table-align ()
"Align the table at point by aligning all vertical bars."
@@ -4334,7 +4362,7 @@ FIELD is a string. WIDTH is a number. ALIGN is either \"c\",
(org-table-save-field
;; Make sure invisible characters in the table are at the right
;; place since column widths take them into account.
(org-font-lock-ensure beg end)
(font-lock-ensure beg end)
(move-marker org-table-aligned-begin-marker beg)
(move-marker org-table-aligned-end-marker end)
(goto-char beg)
@@ -4562,8 +4590,8 @@ function is being called interactively."
(predicate
(cl-case sorting-type
((?n ?N ?t ?T) #'<)
((?a ?A) (if with-case #'org-string-collate-lessp
(lambda (s1 s2) (org-string-collate-lessp s1 s2 nil t))))
((?a ?A) (if with-case #'string-collate-lessp
(lambda (s1 s2) (string-collate-lessp s1 s2 nil t))))
((?f ?F)
(or compare-func
(and interactive?
@@ -4923,7 +4951,7 @@ When LOCAL is non-nil, show references for the table at point."
((not local) nil)
(t (user-error "No reference at point")))
match (and what (or match (match-string 0))))
(when (and match (not (equal (match-beginning 0) (point-at-bol))))
(when (and match (not (equal (match-beginning 0) (line-beginning-position))))
(org-table-add-rectangle-overlay (match-beginning 0) (match-end 0)
'secondary-selection))
(add-hook 'before-change-functions
@@ -5166,15 +5194,13 @@ When LOCAL is non-nil, show references for the table at point."
(concat orgtbl-line-start-regexp "\\|"
auto-fill-inhibit-regexp)
orgtbl-line-start-regexp))
(when (fboundp 'font-lock-add-keywords)
(font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
(org-restart-font-lock)))
(font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
(org-restart-font-lock))
(t
(setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
(remove-hook 'before-change-functions 'org-before-change-function t)
(when (fboundp 'font-lock-remove-keywords)
(font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
(org-restart-font-lock))
(font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
(org-restart-font-lock)
(force-mode-line-update 'all))))
(defun orgtbl-make-binding (fun n &rest keys)
@@ -5289,6 +5315,7 @@ to execute outside of tables."
(org-remap orgtbl-mode-map
'self-insert-command 'orgtbl-self-insert-command
'delete-char 'org-delete-char
'delete-forward-char 'org-delete-char
'delete-backward-char 'org-delete-backward-char)
(org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
t))
@@ -5465,7 +5492,7 @@ The table is taken from the parameter TXT, or from the buffer at point."
(nreverse table)))))
(defun org-table-collapse-header (table &optional separator max-header-lines)
"Collapse the lines before 'hline into a single header.
"Collapse the lines before `hline' into a single header.
The given TABLE is a list of lists as returned by `org-table-to-lisp'.
The leading lines before the first `hline' symbol are considered
@@ -5542,10 +5569,14 @@ First element has index 0, or I0 if given."
beg end)
(save-excursion
(beginning-of-line 1)
(while (looking-at re) (beginning-of-line 0))
(beginning-of-line 2)
(while (and (not (eq (point) (point-min)))
(looking-at re))
(beginning-of-line 0))
(unless (eq (point) (point-min)) (beginning-of-line 2))
(setq beg (point))
(while (looking-at re) (beginning-of-line 2))
(while (and (not (eq (point) (point-max)))
(looking-at re))
(beginning-of-line 2))
(setq end (point)))
(comment-region beg end (if commented '(4) nil))))
@@ -5649,6 +5680,9 @@ strings, or the current cell) returning a string:
(:fmt (2 \"$%s$\" 4 (lambda (c) (format \"$%s$\" c))))
The format is ignored for empty fields. Use :raw t with non-nil
:backend option to force formatting empty fields.
:hlstart :hllstart :hlend :hllend :hsep :hlfmt :hllfmt :hfmt
Same as above, specific for the header lines in the table.
@@ -5694,6 +5728,7 @@ This may be either a string or a function of two arguments:
((consp e)
(princ "| ") (dolist (c e) (princ c) (princ " |"))
(princ "\n")))))
(org-element-cache-reset)
;; Add back-end specific filters, but not user-defined ones. In
;; particular, make sure to call parse-tree filters on the
;; table.