org id link to arbitrary place in an org file

2023-09-19 Thread Samuel Wales
i know we talked about something like this recently, perhaps related
to inline tasks, perhaps not.  apologies redundancy.

i'd like to have an org-id link to a place in a different file.  a
paragraph or even more arbitrary.

is this possible with current org technology?  [i think recent
discussion did not mention id markers.]



Re: Fixed width areas not allowing tab after leading colon.

2023-09-19 Thread Tom Alexander
Thanks!

-- 
Tom Alexander

On Sun, Sep 17, 2023, at 5:48 AM, Ihor Radchenko wrote:
> "Tom Alexander"  writes:
>
>> The documentation for fixed width areas states: A “fixed-width line” starts 
>> with a colon character (:) and either a whitespace character or the 
>> immediate end of the line. 
>> ...
>> Fixed-width area documentation: 
>> https://orgmode.org/worg/org-syntax.html#Fixed_Width_Areas
>
> org-syntax.html is not accurate here. The parser only allows ": " (colon
> followed by space) and no other variant.
>
> Fixed, on master.
> https://git.sr.ht/~bzg/worg/commit/a42f57ac
>
>> This happens in a document in worg: 
>> https://git.sr.ht/~bzg/worg/tree/74e80b0f7600801b1d1594542602394c085cc2f9/item/org-contrib/org-bom.org#L499
>
> Fixed, on master.
> https://git.sr.ht/~bzg/worg/commit/0c8d5679
>
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



Re: [PATCH] Re: Description list with " :: " in the tag.

2023-09-19 Thread Tom Alexander
Sorry for the delay, I've been busy in the IRLs. I've updated the patch to 
reflect that the parser grabs the text before the last " :: " and then parses 
it as objects. The new patch is attached.

-- 
Tom Alexander

On Thu, Sep 14, 2023, at 7:24 AM, Ihor Radchenko wrote:
> "Tom Alexander"  writes:
>
>> I've written a patch (attached) with my proposed wording changes to
>> the documentation, should I be starting another thread or does
>> dropping it here work best?
>
> You can just modify subject with [PATCH], as I did.
>
>> ... I do not have commit access so I'd need
>> someone with such authority to do the last bit.
>
> Sure.
>
>> +  =TAG-TEXT= is one of more objects from the standard set so long as
>> +  they do not contain a newline character, until the last occurrence
>> +  of the substring =" :: "= (two colons surrounded by whitespace,
>> +  without the quotes).
>
> It does not fully represent what is going on - Org parser is top-down
> and does not parse objects before it is done parsing the descriptive
> list item. So,
>
> - *foo :: bar* does not actually contain bold markup
>
> Rather it is "* foo" tag + "bar* does not actually contain bold markup" 
> description.
>
> What happens is that the parser splits the first line of the item by the
> last " :: " and only then proceeds with parsing the tag and description
> using standard set of objects:
>
> - <> :: 
>
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at From c8812bf7d81dc824d8ecf2c03368f58884773ddf Mon Sep 17 00:00:00 2001
From: Tom Alexander 
Date: Wed, 13 Sep 2023 18:19:05 -0400
Subject: [PATCH] org-syntax.org: Fix definition of description list tags.

Description lists support objects in their tags and they support the substring " :: ".
---
 org-syntax.org | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/org-syntax.org b/org-syntax.org
index 123fc232..fc5e9a37 100644
--- a/org-syntax.org
+++ b/org-syntax.org
@@ -470,9 +470,10 @@ BULLET COUNTER-SET CHECK-BOX TAG CONTENTS
 + CHECK-BOX (optional) :: A single whitespace character, an =X=
   character, or a hyphen enclosed by square brackets (i.e. =[ ]=, =[X]=, or =[-]=).
 + TAG (optional) :: An instance of the pattern =TAG-TEXT ::= where
-  =TAG-TEXT= represents a string consisting of non-newline characters
-  that does not contain the substring =" :: "= (two colons surrounded by
-  whitespace, without the quotes).
+  =TAG-TEXT= is the text up until the last occurrence of of the
+  substring =" :: "= (two colons surrounded by whitespace, without the
+  quotes) on that line. =TAG-TEXT= is then parsed with the standard
+  set of objects.
 + CONTENTS (optional) :: A collection of zero or more elements, ending
   at the first instance of one of the following:
   - The next item.
-- 
2.42.0



Re: [PATCH] ob-maxima.el, etc. (was Re: [MAINTENANCE] On how much we can expose internals into defcustom)

2023-09-19 Thread Leo Butler
On Sat, Sep 16 2023, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
>>> Also, non-standard arguments should be defined in 
>>> `org-babel-header-args:maxima'.
>>>
>>
>> Ok. I see that some packages (e.g. ob-gnuplot.el) use a `defvar' form,
>> while others (e.g. ob-R.el) use a `defconst' form. Is there a preference?
>
> defconst I think. The value is not supposed to be changed.

Done.

>
 I have also moved two defaults, that were embedded in the code, to
 `defvar' forms.
>>>
>>> This is fine, although I would prefer to keep these variables private for
>>> now.

Done.

 -  (format "batchload(%S)$" in-file))
 +  (format "(linenum:0, %s(%S))$" batch/load 
 in-file))
>>>
>>> May you clarify the purpose of "linenum"?
> Do I understand correctly that the above will simply affect debug output
> when maxima references where a problematic line is located in the source?

No, it affects how output labels are printed. With this value, the
"first" line in the source block receives the line number 1; without it,
it would get 2.

>
(unless (or (string-match "batch" line)
(string-match "^rat: replaced 
 .*$" line)
(string-match "^;;; Loading #P" 
 line)
 +  (string-match "^read and 
 interpret" line)
 +  (string-match 
 "^(%\\([io]-?[0-9]+\\))[ ]+$" line)
>>>
>>> May you explain why you added these two conditions?
>>



>
> May empty lines be intentional in some maxima code?

A blank line is simply skipped by the maxima reader; an empty input line
is a syntax error.

However, "empty" output may appear, so I have modified that filter. I
have included a number of test cases in the testsuite to make sure that
such corner cases are being handled correctly.

Please see the attached patch.

Thank you for your time and patience.

Leo

From d2934b38a28a8593554af69622be5b11bc13406d Mon Sep 17 00:00:00 2001
From: Leo Butler 
Date: Tue, 19 Sep 2023 13:36:06 -0500
Subject: [PATCH] * lisp/ob-maxima.el: enable use of `batch' loader and `draw'

* (org-babel-header-args:maxima): document the two
new header arguments, specific to ob-maxima.
* (org-babel-maxima--command-arguments-default):
move the default command-line argument into this variable, from
`org-babel-maxima:execute'.
* (org-babel-maxima--graphic-package-options): an alist of Maxima
graphics packages and the Maxima code to set up that package.
* (org-babel-maxima--default-epilogue): an alist of the clean-up code
that is run at end of a `graphical-output' or `non-graphical-output'
source block.
* (org-babel-maxima-expand): prepare the source block for
execution.
* (org-babel-execute:maxima): use the :batch header argument and
`org-babel-maxima--command-arguments-default' to execute the source
block.  Add a couple extra regexps to filter the output of a batch-ed
source block.

* testing/examples/ob-maxima-test.org: add a draw test

Provide an example of the `:graphics-pkg' header argument with the
`draw' package.

* testing/lisp/test-ob-maxima.el: add batch-related tests

* testing/lisp/test-ob-maxima.el: introduce six new tests.  Each test
exercises the :batch header argument.  The response to unusual inputs
is tested (empty strings, strings with just whitespace, input with the
`:lisp' reader, and two syntax-related errors).
* testing/examples/ob-maxima-test.org: include examples of the
batch-related tests from testing/lisp/test-ob-maxima.el.
---
 lisp/ob-maxima.el   |  88 +--
 testing/examples/ob-maxima-test.org |  54 ++
 testing/lisp/test-ob-maxima.el  | 107 
 3 files changed, 227 insertions(+), 22 deletions(-)

diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index d1d7c7424..3814049ca 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -37,6 +37,11 @@
 
 (require 'ob)
 
+(defconst org-babel-header-args:maxima
+  '((batch   . :any)
+(graphics-pkg. :any))
+  "Maxima-specific header arguments.")
+
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("maxima" . "max"))
 
@@ -48,29 +53,59 @@
   :group 'org-babel
   :type 'string)
 
+(defvar org-babel-maxima--command-arguments-default
+  "--very-quiet"
+  "Command-line arguments sent to Maxima by default.  If the
+`:batch' header argument is set to `batchload' or unset, then the
+`:cmdline' header argument is appended to this default;
+otherwise, if the `:cmdline' argument is set, it over-rides this
+default.  See `org-babel-maxima-command' and
+`org-babel-execute:maxima'.")
+
+(defvar org-babel-maxima--graphic-package-options
+  '((plot . "(set_plot_option ('[gnuplot_term, %s]), set_plot_option ('[gnuplot_out_file, %S]))$")
+(draw . "(load(draw), 

[BUG] Warning (org-element-cache): org-element--cache: Org parser error in google.org::263. Resetting. The error was: (wrong-type-argument listp 6990) [9.7 (9.7-??-e90a8a69a @ /Users/buter/.emacs.d/.l

2023-09-19 Thread Renald Buter



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Offending line is 263:
261 * Some headline
262 :PROPERTIES:
263 :DATE: [2023-08-16 Wed]
264 :END:
265





Emacs  : GNU Emacs 29.1 (build 1, aarch64-apple-darwin22.6.0, Carbon 
Version 169 AppKit 2299.7)

 of 2023-08-12
Package: Org mode version 9.7 (9.7-??-e90a8a69a @ 
/Users/buter/.emacs.d/.local/straight/build-29.1/org/)


current state:
==
(setq
 org-link-elisp-confirm-function nil
 org-directory "/Users/buter/org/"
 org-after-refile-insert-hook '(save-buffer)
 org-indirect-buffer-display 'current-window
 org-roam-db-gc-threshold 2305843009213693951
 org-crypt-key nil
 org-bibtex-headline-format-function 
'org-bibtex-headline-format-default
 org-roam-mode-hook '(+org-roam-detach-magit-section-mode-map-h 
turn-on-visual-line-mode)
 org-load-hook '(+org-init-org-directory-h +org-init-appearance-h 
+org-init-agenda-h +org-init-attachments-h +org-init-babel-h 
+org-init-babel-lazy-loader-h
 +org-init-capture-defaults-h +org-init-capture-frame-h 
+org-init-custom-links-h +org-init-export-h +org-init-habit-h 
+org-init-hacks-h
 +org-init-keybinds-h +org-init-popup-rules-h 
+org-init-smartparens-h +org-init-roam-h)

 org-startup-folded nil
 org-babel-after-execute-hook 
'(+org-redisplay-inline-images-in-babel-result-h)
 org-link-abbrev-alist '(("doomdir" . "/Users/buter/.doom.d/%s") 
("emacsdir" . "/Users/buter/.emacs.d/%s")
 ("doom-repo" . 
"https://github.com/doomemacs/doomemacs/%s;) ("wolfram" . 
"https://wolframalpha.com/input/?i=%s;)
 ("wikipedia" . 
"https://en.wikipedia.org/wiki/%s;) ("duckduckgo" . 
"https://duckduckgo.com/?q=%s;)
 ("gmap" . "https://maps.google.com/maps?q=%s;) 
("gimages" . "https://google.com/images?q=%s;)
 ("google" . "https://google.com/search?q=;) 
("youtube" . "https://youtube.com/watch?v=%s;) ("github" . 
"https://github.com/%s;))
 org-agenda-files '("/Users/buter/org/1-projects/cloud-delivery" 
"/Users/buter/org/1-projects/dynamics-implementation" 
"/Users/buter/org/1-projects/eqom"
"/Users/buter/org/1-projects/google-alliance" 
"/Users/buter/org/1-projects/van-oord" 
"/Users/buter/org/2-areas/cloud-operations"
"/Users/buter/org/2-areas/computer" 
"/Users/buter/org/2-areas/data" "/Users/buter/org/2-areas/emacs" 
"/Users/buter/org/2-areas/japanese"

"/Users/buter/org/2-areas/project-management")
 org-replace-disputed-keys t
 org-capture-templates '(("n" "Enter note in INBOX" entry (file 
rk/notes-file) "* %?\n:PROPERTIES:\n:CREATED: %u\n:END:")
 ("p" "Enter a note in a project." entry 
#'rk/create-org-note-in-project "* %?\n:PROPERTIES:\n:CREATED: 
%u\n:END:" :unnarrowed t

  :jump-to-captured t :empty-lines-before 1)
 ("a" "Enter a note in an area." entry 
#'rk/create-org-note-in-area "* %?\n:PROPERTIES:\n:CREATED: %u\n:END:" 
:unnarrowed t

  :jump-to-captured t :empty-lines-before 1)
 ("j" "Enter a note in japanese.org." entry 
(file rk/japanese-file) "* %u\n:PROPERTIES:\n:CREATED: %u\n:END:\n\n%?" 
:unnarrowed t

  :jump-to-captured t :empty-lines-before 1)
 )
 org-roam-node-display-template #("${doom-hierarchy:*} ${doom-type:12} 
${doom-tags:42}" 20 35 (face font-lock-keyword-face) 36 51 (face 
(:inherit org-tag :box nil)))

 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 
3))

 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(+org-yas-expand-maybe-h +org-indent-maybe-h 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand
+org-clear-babel-results-h 
+org-cycle-only-current-subtree-h)

 org-default-notes-file "/Users/buter/org/0-inbox/inbox.org"
 org-roam-find-file-hook 
'(doom--setq-org-id-link-to-org-use-id-for-org-roam-find-file-h 
org-roam-buffer--setup-redisplay-h
   org-roam--register-completion-functions-h 
org-roam--replace-roam-links-on-save-h 
org-roam-db-autosync--setup-update-on-save-h

   +org-roam-enable-auto-backlinks-buffer-h)
 org-refile-use-outline-path 'file
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-file-apps '((remote . emacs) (auto-mode . emacs) (directory . 
emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . 
default))
 org-cycle-hook '(org-cycle-hide-archived-subtrees 
org-cycle-show-empty-lines 

Re: Exporting elisp: and shell: links

2023-09-19 Thread Max Nikulin

On 19/09/2023 07:10, Rudolf Adamkovič wrote:

Max Nikulin  writes:


Do you think a label specifying language should be added to code
snippets, e.g. (identity "a") or it is
useless and may cause undesired noise for screen reader users? What
about LaTeX?


As a user, I would expect

   [[elisp:(identity "a")]]

to be export-equivalent to

   src_elisp[:exports code]{(identity "a")}

across all backends.


(defun org-link-export-eval-link-no-descr
(type path descr backend info)
  (unless descr
(let ((element
   (org-element-create
'inline-src-block
(list :language type
  :value path
  :parameters ":exports code :noweb no :eval never"
  (org-export-data element info

(defun org-link-make-export-eval-link-no-descr (type)
  (lambda (path descr backend info)
   (org-link-export-eval-link-no-descr
type path descr backend info)))

(dolist (type '("elisp" "shell"))
  (org-link-set-parameters
   type
   :export (org-link-make-export-eval-link-no-descr type)))


What is your expectation for links having description?

[[elisp:(identity "a")][Run it]]


Good point!  Perhaps we just need to find a
good symbol that would work well between the
Elisp code and the description?

For example

   /Run it/ \to src_elisp[:exports code]{(identity "a")}

exports to ASCII as

   /Run it/ -> `(identity "a")'

Of course, \to could be something else...


I have another example:

   [[elisp:(server-start)][=M-x server-start RET=]]

suitable for a printed document.

From my point of view, it is better either to drop link path completely 
or to add a button to copy the code to clipboard. Repetition is undesired.


So I am unsure if it is possible to choose unambiguous rules for export 
of elisp and shell links.





Re: Bug: org-timestamp-{down,up} with numeric argument on time range modifies length [9.4.6 (9.4.6-gab9f2a @ /gnu/store/yg6kjzigqyfzbkzj99xmwmv3nssvhvnq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6

2023-09-19 Thread Ihor Radchenko
Tim Cross  writes:

> [2021-08-22 Sun 10:00-11:00] with C-u 42 S- gives
> [2021-08-22 Sun 10:42-11:05]

Fixed, on main.
That code is a headache to read...
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6c917e890

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Ihor Radchenko
Carlo Tambuatco  writes:

> Okay. It does indeed work.

Closing.
Fixed.

> ... When will it be available in general release?

In the next bugfix release (few weeks-ish from now).

For manual pre-release installation, check out options described in
https://orgmode.org/manual/Installation.html or
https://protesilaos.com/codelog/2022-05-13-emacs-elpa-devel/

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: bbb:OrgMeetup for Asia-Pacific time zones (was: #2 [[bbb:OrgMeetup]] on Wed, Sep 13, 19:00 UTC+3)

2023-09-19 Thread Ihor Radchenko
Tshiung Han See  writes:

>> Tshiung, what time and weekday would work best for your schedule?
>
> Mondays at 8pm (UTC/GMT+8) might be a good start.

In multiple time zones, this will look like

;; 0500 America/Vancouver
;; 0700 America/Chicago
;; 0800 America/Toronto
;; 1200 Etc/GMT
;; 1400 Europe/Berlin
;; 1730 Asia/Kolkata
;; 2000 Asia/Singapore

vs. the timing we use in UTC+3:

;; 0900 America/Vancouver
;; 1100 America/Chicago
;; 1200 America/Toronto
;; 1600 Etc/GMT
;; 1800 Europe/Berlin
;; 2130 Asia/Kolkata
;; +1d  Asia/Singapore

At least, Singapore/Tokyo/Beijing/Sydney time zones appear have a better
timing for 8pm UTC+8.

If anyone reading this would be more interested to have an alternative
meetup track at 8-10pm Asia/Singapore time, please reply here, so that
we can see if there are people who will be willing to join.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Carlo Tambuatco
Okay. It does indeed work. When will it be available in general release?

On Tue, Sep 19, 2023 at 6:09 AM Ihor Radchenko  wrote:

> Carlo Tambuatco  writes:
>
> > org-version 9.6.9
>
> Then, (1) open agenda as usual, get the error; (2) re-define
> `org-agenda-get-scheduled' by evaluating the following snippet (C-M-x
> with point inside defun in scratch buffer); (3) open agenda again - you
> should not get the error.
>
> (defun org-agenda-get-scheduled ( deadlines with-hour)
>   "Return the scheduled information for agenda display.
> Optional argument DEADLINES is a list of deadline items to be
> displayed in agenda view.  When WITH-HOUR is non-nil, only return
> scheduled items with an hour specification like [h]h:mm."
>   (with-no-warnings (defvar date))
>   (let* ((props (list 'org-not-done-regexp org-not-done-regexp
>   'org-todo-regexp org-todo-regexp
>   'org-complex-heading-regexp
> org-complex-heading-regexp
>   'done-face 'org-agenda-done
>   'mouse-face 'highlight
>   'help-echo
>   (format "mouse-2 or RET jump to Org file %s"
>   (abbreviate-file-name buffer-file-name
>  (regexp (if with-hour
>  org-scheduled-time-hour-regexp
>org-scheduled-time-regexp))
>  (today (org-today))
>  (todayp (org-agenda-today-p date)) ; DATE bound by calendar.
>  (current (calendar-absolute-from-gregorian date))
>  (deadline-pos
>   (mapcar (lambda (d)
> (let ((m (get-text-property 0 'org-hd-marker d)))
>   (and m (marker-position m
>   deadlines))
>  scheduled-items)
> (goto-char (point-min))
> (if (org-element--cache-active-p)
> (org-element-cache-map
>  (lambda (el)
>(when (and (org-element-property :scheduled el)
>   (or (not with-hour)
>   (org-element-property
>:hour-start
>(org-element-property :scheduled el))
>   (org-element-property
>:hour-end
>(org-element-property :scheduled el
>  (goto-char (org-element-property :contents-begin el))
>  (catch :skip
>(org-agenda-skip el)
>(let* ((s (substring (org-element-property
>  :raw-value
>  (org-element-property :scheduled el))
> 1 -1))
>   (pos (save-excursion
>  (goto-char (org-element-property
> :contents-begin el))
>  ;; We intentionally leave NOERROR
>  ;; argument in `re-search-forward' nil.  If
>  ;; the search fails here, something went
>  ;; wrong and we are looking at
>  ;; non-matching headline.
>  (re-search-forward regexp (line-end-position))
>  (1- (match-beginning 1
>   (todo-state (org-element-property :todo-keyword el))
>   (donep (eq 'done (org-element-property :todo-type
> el)))
>   (sexp? (eq 'diary
>  (org-element-property
>   :type (org-element-property :scheduled
> el
>   ;; SCHEDULE is the scheduled date for the entry.  It
> is
>   ;; either the bare date or the last repeat, according
>   ;; to `org-agenda-prefer-last-repeat'.
>   (schedule
>(cond
> (sexp? (org-agenda--timestamp-to-absolute s
> current))
> ((or (eq org-agenda-prefer-last-repeat t)
>  (member todo-state
> org-agenda-prefer-last-repeat))
>  (org-agenda--timestamp-to-absolute
>   s today 'past (current-buffer) pos))
> (t (org-agenda--timestamp-to-absolute s
>   ;; REPEAT is the future repeat closest from CURRENT,
>   ;; according to `org-agenda-show-future-repeats'. If
>   ;; the latter is nil, or if the time stamp has no
>   ;; repeat part, default to SCHEDULE.
>   (repeat
>(cond
> (sexp? schedule)
> ((<= current today) schedule)
> ((not org-agenda-show-future-repeats) schedule)
> (t
>  (let ((base (if (eq
> org-agenda-show-future-repeats 

Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Ihor Radchenko
Carlo Tambuatco  writes:

> org-version 9.6.9

Then, (1) open agenda as usual, get the error; (2) re-define
`org-agenda-get-scheduled' by evaluating the following snippet (C-M-x
with point inside defun in scratch buffer); (3) open agenda again - you
should not get the error.

(defun org-agenda-get-scheduled ( deadlines with-hour)
  "Return the scheduled information for agenda display.
Optional argument DEADLINES is a list of deadline items to be
displayed in agenda view.  When WITH-HOUR is non-nil, only return
scheduled items with an hour specification like [h]h:mm."
  (with-no-warnings (defvar date))
  (let* ((props (list 'org-not-done-regexp org-not-done-regexp
  'org-todo-regexp org-todo-regexp
  'org-complex-heading-regexp org-complex-heading-regexp
  'done-face 'org-agenda-done
  'mouse-face 'highlight
  'help-echo
  (format "mouse-2 or RET jump to Org file %s"
  (abbreviate-file-name buffer-file-name
 (regexp (if with-hour
 org-scheduled-time-hour-regexp
   org-scheduled-time-regexp))
 (today (org-today))
 (todayp (org-agenda-today-p date)) ; DATE bound by calendar.
 (current (calendar-absolute-from-gregorian date))
 (deadline-pos
  (mapcar (lambda (d)
(let ((m (get-text-property 0 'org-hd-marker d)))
  (and m (marker-position m
  deadlines))
 scheduled-items)
(goto-char (point-min))
(if (org-element--cache-active-p)
(org-element-cache-map
 (lambda (el)
   (when (and (org-element-property :scheduled el)
  (or (not with-hour)
  (org-element-property
   :hour-start
   (org-element-property :scheduled el))
  (org-element-property
   :hour-end
   (org-element-property :scheduled el
 (goto-char (org-element-property :contents-begin el))
 (catch :skip
   (org-agenda-skip el)
   (let* ((s (substring (org-element-property
 :raw-value
 (org-element-property :scheduled el))
1 -1))
  (pos (save-excursion
 (goto-char (org-element-property :contents-begin 
el))
 ;; We intentionally leave NOERROR
 ;; argument in `re-search-forward' nil.  If
 ;; the search fails here, something went
 ;; wrong and we are looking at
 ;; non-matching headline.
 (re-search-forward regexp (line-end-position))
 (1- (match-beginning 1
  (todo-state (org-element-property :todo-keyword el))
  (donep (eq 'done (org-element-property :todo-type el)))
  (sexp? (eq 'diary
 (org-element-property
  :type (org-element-property :scheduled el
  ;; SCHEDULE is the scheduled date for the entry.  It is
  ;; either the bare date or the last repeat, according
  ;; to `org-agenda-prefer-last-repeat'.
  (schedule
   (cond
(sexp? (org-agenda--timestamp-to-absolute s current))
((or (eq org-agenda-prefer-last-repeat t)
 (member todo-state org-agenda-prefer-last-repeat))
 (org-agenda--timestamp-to-absolute
  s today 'past (current-buffer) pos))
(t (org-agenda--timestamp-to-absolute s
  ;; REPEAT is the future repeat closest from CURRENT,
  ;; according to `org-agenda-show-future-repeats'. If
  ;; the latter is nil, or if the time stamp has no
  ;; repeat part, default to SCHEDULE.
  (repeat
   (cond
(sexp? schedule)
((<= current today) schedule)
((not org-agenda-show-future-repeats) schedule)
(t
 (let ((base (if (eq org-agenda-show-future-repeats 
'next)
 (1+ today)
   current)))
   (org-agenda--timestamp-to-absolute
s base 'future (current-buffer) pos)
  (diff (- current schedule))
  

Re: [BUG] tikz latex figures don't render properly in the html output. [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]

2023-09-19 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> tusharhero--- via "General discussions about Org-mode."
>  writes:
>
>> \begin{tikzpicture}
>> \draw (0,0) circle [radius=2cm];
>> \end{tikzpicture}
>
> ... But, but, but!  There
> is a new LaTeX preview system in works [2],
> and it fixes a lot of problems out of the
> box, including yours!

Fist, for the record...
Confirmed.

I can also confirm that TEC's feature branch does not have this bug.

On main, the bug is caused by horrible heuristics in
`org-html--latex-environment-numbered-p' and
`org-html--unlabel-latex-environment', which make a naive assumption
that \begin{foo*} is always available and codifies unnumbered version of
environment.

However, \begin{tikzpicture*} environment is not valid. Moreover,
\begin{tikzpicture} is not numbered either (just as many other
non-equation environments).

That said, I am not sure what is going on with numbering in TEC's branch
- the above two functions are left in the code, __unused__. Which
indicates that we might also have some feature regression on that branch.
Timothy, any comments?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Carlo Tambuatco
org-version 9.6.9

On Tue, Sep 19, 2023 at 5:51 AM Ihor Radchenko  wrote:

> Carlo Tambuatco  writes:
>
> > I'm unfamiliar with how to apply patches to my org install. What do I do?
>
> May you then first tell me the output of M-x org-version?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Ihor Radchenko
Carlo Tambuatco  writes:

> I'm unfamiliar with how to apply patches to my org install. What do I do?

May you then first tell me the output of M-x org-version?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Feature request: Add group checks for manual tag setting (not just fast tags) [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]

2023-09-19 Thread Ihor Radchenko
sreenivas sumadithya  writes:

> Currently, tag groups/ mutually exclusive tags can be set when tags are set
> manually (without shortcuts being assigned to the tags / fast tags). Need
> the behavior seen in fast tags in manual tagging for tag groups.
>
> Reproduction:
> - Create an org file
> - "#+tags: {dog cat} mat"
> - Save the file after setting this.
> - Close buffer
> - Open file
> - Make a heading
> - C-c C-q dog
> - C-c C-q cat
>
> Result:
> - Both 'cat' and 'dog' are assigned to the heading.
>
> Desired behavior:
> - One of the tags should be replaced by the other.

I can only follow the described recipe when setting
org-use-fast-tag-selection to non-standard value of t.

For such scenario, I just pushed a fix onto main - entering group tags
from exclusive groups will now clear already applied tags from the same
group.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=edcb8eca5

In case of the default settings (org-use-fast-tag-selection = auto), the
interface is different - prompt will list all the tags already present
in the heading:

- C-c C-q dog from the recipe will look like

  TAGS: 
  TAGS: dog
  * heading :dog:

- Another C-c C-q will, however, yield
  TAGS: :dog:
  entering "cat" manually
  TAGS: :dog:cat
  will still force setting both the tags:
  * heading :dog:cat:

In the above scenario, there is no non-ambiguous way to know which
exclusive tag is implied by the user. So, I am inclined to keep the
current behavior. Unless there are better ideas.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Carlo Tambuatco
I'm unfamiliar with how to apply patches to my org install. What do I do?

On Tue, Sep 19, 2023 at 5:19 AM Ihor Radchenko  wrote:

> Carlo Tambuatco  writes:
>
> > then I set a deadline for that item
> > * TODO Item
> >SCHEDULED: <2023-09-19 Tue> DEADLINE: <2023-10-03 Tue>
> >
> > notice the deadline for the item is two weeks from the scheduled date,
> >
> > I get this error:
> >
> > Debugger entered--Lisp error: (wrong-type-argument stringp (timestamp
> > (:type active :raw-value "<2023-10-03 Tue>" :year-start 2023 :month-start
> > 10 :day-start 3 :hour-start nil :minute-start nil :year-end 2023
> :month-end
> > 10 :day-end 3 :hour-end nil :minute-end nil :begin 115 :end 132
> :post-blank
> > 1)))
>
> Thanks for reporting!
> I think I fixed the problem on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c61ec6255
>
> May you please confirm?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Ihor Radchenko
Carlo Tambuatco  writes:

> then I set a deadline for that item
> * TODO Item
>SCHEDULED: <2023-09-19 Tue> DEADLINE: <2023-10-03 Tue>
>
> notice the deadline for the item is two weeks from the scheduled date,
>
> I get this error:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp (timestamp
> (:type active :raw-value "<2023-10-03 Tue>" :year-start 2023 :month-start
> 10 :day-start 3 :hour-start nil :minute-start nil :year-end 2023 :month-end
> 10 :day-end 3 :hour-end nil :minute-end nil :begin 115 :end 132 :post-blank
> 1)))

Thanks for reporting!
I think I fixed the problem on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c61ec6255

May you please confirm?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Org agenda crashes when an agenda's deadline is within 14 days of its scheduled time.

2023-09-19 Thread Carlo Tambuatco
When I create an agenda item that is scheduled for say:
* TODO Item
  SCHEDULED: <2023-09-19 Tue>

then I set a deadline for that item
* TODO Item
   SCHEDULED: <2023-09-19 Tue> DEADLINE: <2023-10-03 Tue>

notice the deadline for the item is two weeks from the scheduled date,

I get this error:

Debugger entered--Lisp error: (wrong-type-argument stringp (timestamp
(:type active :raw-value "<2023-10-03 Tue>" :year-start 2023 :month-start
10 :day-start 3 :hour-start nil :minute-start nil :year-end 2023 :month-end
10 :day-end 3 :hour-end nil :minute-end nil :begin 115 :end 132 :post-blank
1)))

string-match("\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\(
+..." (timestamp (:type active :raw-value "<2023-10-03 Tue>" :year-start
2023 :month-start 10 :day-start 3 :hour-start nil :minute-start nil
:year-end 2023 :month-end 10 :day-end 3 :hour-end nil :minute-end nil
:begin 115 :end 132 :post-blank 1)))
  org-parse-time-string((timestamp (:type active :raw-value "<2023-10-03
Tue>" :year-start 2023 :month-start 10 :day-start 3 :hour-start nil
:minute-start nil :year-end 2023 :month-end 10 :day-end 3 :hour-end nil
:minute-end nil :begin 115 :end 132 :post-blank 1)))
  org-time-string-to-time((timestamp (:type active :raw-value "<2023-10-03
Tue>" :year-start 2023 :month-start 10 :day-start 3 :hour-start nil
:minute-start nil :year-end 2023 :month-end 10 :day-end 3 :hour-end nil
:minute-end nil :begin 115 :end 132 :post-blank 1)))
  #f(compiled-function (el) #)((headline
(:raw-value "Today's Dentist" :begin 80 :end 162 :pre-blank 0
:contents-begin 105 :contents-end 160 :robust-begin nil :robust-end nil
:level 2 :priority nil :tags nil :todo-keyword #("TODO" 0 4 (wrap-prefix
#("*** " 0 4 (face org-indent)) line-prefix #("*" 0 1 (face org-indent))
face ((:foreground "#FF") org-level-2) fontified t)) :todo-type todo
:post-blank 2 :footnote-section-p nil :archivedp nil :commentedp nil
:post-affiliated 80 :deadline (timestamp (:type active :raw-value
"<2023-10-03 Tue>" :year-start 2023 :month-start 10 :day-start 3
:hour-start nil :minute-start nil :year-end 2023 :month-end 10 :day-end 3
:hour-end nil :minute-end nil :begin 115 :end 132 :post-blank 1))
:scheduled (timestamp (:type active :raw-value "<2023-09-19 Tue>"
:year-start 2023 :month-start 9 :day-start 19 :hour-start nil :minute-start
nil :year-end 2023 :month-end 9 :day-end 19 :hour-end nil :minute-end nil
:begin 143 :end 159 :post-blank 0)) :title (#("Today's Dentist" 0 15
(:parent (headline #3 :parent (headline (:raw-value "Appointments"
:begin 1 :end 162 :pre-blank 1 :contents-begin 80 :contents-end 160
:robust-begin 82 :robust-end 158 :level 1 :priority nil :tags
(#("@appointment" 0 12 (fontified t face ... mouse-face highlight keymap
... line-prefix "" wrap-prefix ...))) :todo-keyword nil :todo-type nil
:post-blank 2 :footnote-section-p nil :archivedp nil :commentedp nil
:post-affiliated 1 :title (#("Appointments" 0 12 (:parent ...))) :parent
(org-data (:begin 1 :contents-begin 1 :contents-end 160 :end 162
:robust-begin 3 :robust-end 158 :post-blank 2 :post-affiliated 1 :path
"/Users/carloftambuatco/Documents/Org/Personal/Appo..." :mode org-data
:CATEGORY "Appointments" :parent nil :cached t :org-element--cache-sync-key
nil)) :cached t :org-element--cache-sync-key nil)) :cached t
:org-element--cache-sync-key nil)))
  org-element-cache-map(#f(compiled-function (el) #) :next-re "\\]+\\)>" :fail-re
"\\]+\\)>" :narrow t)
  org-agenda-get-scheduled((#("  Appointments:In  14 d.:  TODO Today'..." 0
27 (done-face org-agenda-done undone-face org-upcoming-distant-deadline
face org-upcoming-distant-deadline date (9 19 2023) type
"upcoming-deadline" todo-state #("TODO" 0 4 (wrap-prefix ... line-prefix
... face ... fontified t)) priority 4986 ts-date 738796 effort-minutes nil
effort nil warntime nil org-hd-marker # org-marker # help-echo "mouse-2 or RET jump to org file ~/Docu..."
org-complex-heading-regexp "^\\(\\*+\\)\\(?:
+\\(CANCELLED\\|DONE\\|FAIL\\..." org-todo-regexp
"\\(CANCELLED\\|DONE\\|FAIL\\|IN_PROGRESS\\|..." org-not-done-regexp
"\\(IN_PROGRESS\\|T\\(?:EST\\(?:ING\\)?\\|ODO..." mouse-face highlight
dotime nil ...) 27 62 (done-face org-agenda-done undone-face
org-upcoming-distant-deadline face org-upcoming-distant-deadline date (9 19
2023) type "upcoming-deadline" todo-state #("TODO" 0 4 (wrap-prefix ...
line-prefix ... face ... fontified t)) priority 4986 ts-date 738796
warntime nil org-hd-marker # org-marker # help-echo "mouse-2 or RET jump to org file ~/Docu..."
org-complex-heading-regexp "^\\(\\*+\\)\\(?:
+\\(CANCELLED\\|DONE\\|FAIL\\..." org-todo-regexp
"\\(CANCELLED\\|DONE\\|FAIL\\|IN_PROGRESS\\|..." org-not-done-regexp
"\\(IN_PROGRESS\\|T\\(?:EST\\(?:ING\\)?\\|ODO..." mouse-face highlight
dotime nil format ((... ... ... ... ...) (format " %s %s%s%s" ... ... ...
...)) extra "In  14 d.: " ...) 62 74 (done-face org-agenda-done undone-face
org-upcoming-distant-deadline date (9 19 2023) type "upcoming-deadline"
todo-state #("TODO" 0 4 

Re: bbb:OrgMeetup for Asia-Pacific time zones (was: #2 [[bbb:OrgMeetup]] on Wed, Sep 13, 19:00 UTC+3)

2023-09-19 Thread Tshiung Han See
Ihor Radchenko  writes:

> Tshiung Han See  writes:
>
>> 8am’s not going to work, sorry. But I really appreciate the offer, Corwin.
>>
>> I would be happy to host something that is more amenable for people in my 
>> corner of the world. But I must warn you that I’m *really* new to org-mode.
>>
>> That is, though I’ve been using it for a while, I use it to organize my 
>> lessons (I teach English) and other projects.
>>
>> I hope that’s OK.
>
> I do not think that there is any requirement about being “veteran” in
> Org mode. The job of host is mostly making sure that the conversation is
> not stuck - asking people to introduce themselves (or their Org mode
> usage), encouraging people to ask questions or sharing something
> interesting, looking after questions in chat, etc.
>
> Tshiung, what time and weekday would work best for your schedule?

Mondays at 8pm (UTC/GMT+8) might be a good start.