Re: [BUG] With R using ":var d=data" breaks ":colnames yes" [9.7-pre (release_9.6.10-881-g595a32]

2024-03-07 Thread Paul Stansell
Hi Ihor,

Thanks for your advice, it helps a lot.  Sorry for submitting
something that wasn't a bug.

Paul

On Thu, 7 Mar 2024 at 13:16, Ihor Radchenko  wrote:

> Paul Stansell  writes:
>
> > It seems that using ":var d=data" breaks ":colnames yes" in the header of
> > an R code block.
> > ...
> > #+name: data
> > |+|
> > |  x |  y |
> > |+|
> > | 111.89 |  88.37 |
> > | 392.12 | 297.33 |
> > |+|
>
> It is expected.
> :colnames yes implies:
>
>  The ‘colnames’ header argument accepts ‘yes’, ‘no’, or ‘nil’
>  values.  The default value is ‘nil’: if an input table has column
>  names--because the second row is a horizontal rule--then Org
>  removes the column names, processes the table, puts back the column
>  names, and then writes the table to the results block.  Using
>  ‘yes’, Org does the same to the first row, even if the initial
>  ^
>  table does not contain any horizontal rule.  When set to ‘no’, Org
>  does not pre-process column names at all.
>
> In your table, the first row is a horizontal line, so Org tries to parse
> the first line as column names. And fails, of course.
>
> I guess that we can make `org-babel-get-colnames' smarter and make it
> skip the leading hlines.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


[BUG] With R using ":var d=data" breaks ":colnames yes" [9.7-pre (release_9.6.10-881-g595a32]

2024-03-06 Thread Paul Stansell
Hello,

It seems that using ":var d=data" breaks ":colnames yes" in the header of
an R code block.

In the example below the first code block uses ":colnames yes" and gives
the correct output, the second code block uses ":var d=data" to read the
data in the table (although it read the header as data), and the third code
uses both ":colnames yes" and ":var d=data" but gives the error "Wrong type
argument: sequencep, hline".

Thanks,

Paul

# = Start example =
#+name: data
|+|
|  x |  y |
|+|
| 111.89 |  88.37 |
| 392.12 | 297.33 |
|+|

This code block works as expected.
#+begin_src R --no-save --no-restore :colnames yes
  data.frame(x=1, y=2)
#+end_src

#+RESULTS:
| x | y |
|---+---|
| 1 | 2 |


This code block shows that the data in the table can be read (although
the table header is read as data).
#+begin_src R --no-save --no-restore :var d=data
  d
#+end_src

#+RESULTS:
|  x |  y |
| 111.89 |  88.37 |
| 392.12 | 297.33 |


However, using both ":colnames yes" and ":var d=data" together gives
an error "Wrong type argument: sequencep, hline"
#+begin_src R --no-save --no-restore :colnames yes :var d=data
  data.frame(x=1, y=2)
#+end_src
# = End example =



Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0)
 of 2023-08-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.10-881-g595a32 @
/home/ps/.emacs.d_Kubuntu-23.04/org-mode-git/lisp/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-startup-folded t
 org-id-link-to-org-use-id t
 org-mode-hook '((closure
  (org-agenda-skip-regexp org-fold-core-style
org-table1-hline-regexp
   org-table-tab-recognizes-table\.el
org-table-dataline-regexp
   org-table-any-border-regexp
org-agenda-restriction-lock-overlay
   org-agenda-overriding-restriction org-agenda-diary-file
   org-complex-heading-regexp calendar-mode-map t)
  nil (setq imenu-create-index-function
'org-imenu-get-tree))
 (closure
  (org--rds reftex-docstruct-symbol org-attach-method
   org--single-lines-list-is-paragraph
org-element-greater-elements
   org-agenda-restrict-end org-agenda-restrict-begin
org-agenda-restrict
   visual-fill-column-width org-clock-history
org-agenda-current-date
   org-with-time org-defdecode org-def
org-read-date-inactive org-ans2
   org-ans1 org-columns-current-fmt-compiled
org-clock-current-task
   org-clock-effort org-agenda-skip-function
org-agenda-skip-comment-trees
   org-agenda-archives-mode org-end-time-was-given
org-time-was-given
   org-log-note-extra org-log-note-purpose
org-log-post-message
   org-last-inserted-timestamp org-last-changed-timestamp
   org-entry-property-inherited-from org-state
   org-agenda-headline-snapshot-before-repeat
org-agenda-buffer-name
   org-agenda-start-on-weekday org-agenda-buffer-tmp-name
   org-priority-regexp org-mode-abbrev-table
org-element-cache-persistent
   org-element-cache-version buffer-face-mode-face
org-tbl-menu org-org-menu
   org-struct-menu org-entities org-last-state
org-id-track-globally
   org-clock-start-time texmathp-why remember-data-file
   org-agenda-tags-todo-honor-ignore-options
calc-embedded-open-mode
   calc-embedded-open-formula calc-embedded-close-formula
   align-mode-rules-list org-emphasis-alist
org-emphasis-regexp-components
   org-export-registered-backends org-modules crm-separator
   org-babel-load-languages org-id-overriding-file-name
   org-indent-indentation-per-level
org-element--timestamp-regexp
   org-element-cache-map-continue-from
org-element-paragraph-separate
   org-agenda-buffer-name org-inlinetask-min-level t)
  nil (add-hook 'change-major-mode-hook 'org-fold-show-all
'append 'local))
 (closure
  (org-src-window-setup *this*
org-babel-confirm-evaluate-answer

Bug: file names capitalised when using gnuplot [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2024-03-06 Thread Paul Stansell
Hello,

A bug occurs when plotting data from an Org table using Gnuplot.  An
example is given below.  In the first code block the plot is produced as
expected, but in the second code block (where I have changed a lowercase
"c" to an uppercase "C") gnuplot tries to plot data from a
non-existent file name that consists of all uppercase letters.

Thanks,

Paul

# = Start example =
#+name: data
|+|
|  x |  y |
|+|
| 111.89 |  88.37 |
| 392.12 | 297.33 |
|+|

This code block works.  It tries to read the data from
"/tmp/babel-stable-462/gnuplot--633772447824105179", which exists.
#+begin_src gnuplot :var c=data :results silent
  reset session
  plot "$c" u 1:2
#+end_src

This code block does not work.  It tries to read the data from
"/TMP/BABEL-STABLE-462/GNUPLOT-2096937058546578295", which does not
exist.
#+begin_src gnuplot :var C=data :results silent
  reset session
  plot "$C" u 1:2
#+end_src
# = End example =



current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-id-link-to-org-use-id t
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-all append
local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-clock-persist 'history
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-history-length 28
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '((auto-mode . emacs) ("\\.odt\\'" . "libreoffice %s")
 ("\\.docx\\'" . "libreoffice %s") ("\\.xlsx\\'" .
"libreoffice %s")
 ("\\.png\\'" . "xv %s") ("\\.jpg\\'" . "xv %s")
("\\.jpeg\\'" . "xv %s")
 ("\\.webp\\'" . "xv %s") ("\\.pdf\\'" . "okular \"%s\"")
 ("\\.xoj" . "xournal %s") ("\\.xopp" . "xournalpp %s"))
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-hide-leading-stars t
 org-babel-load-languages '((R . t) (emacs-lisp . t) (gnuplot . t) (octave
. t) (python . t)
(fortran . t) (sql . t) (ditaa . t) (dot . t)
(shell . t))
 org-log-done 'time
 org-highlight-latex-and-related '(latex)
 org-occur-hook '(org-first-headline-recenter)
 org-log-into-drawer t
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-todo-keywords '((sequence "TODO(t!)" "MAYBE(m!)" "STARTED(s!)"
"WAITING(w@/!)" "|"
  "DONE(d)" "INFO(i!)" "CANCELLED(c@)" "UNFINISHED(u@)"
"ABANDONED(a@)")
 )
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-babel-tangle-lang-exts '(("fortran" . "F90") ("python" . "py")
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-format-latex-options '(:foreground "Yellow" :background default :scale
1.2
:html-foreground "Black" :html-background
"Transparent"
:html-scale 1.07 :matchers ("begin" "$1" "$"
"$$" "\\(" "\\["))
 org-clock-display-default-range 'untilnow
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export
org-attach-export-link :complete
org-attach-complete-link)
   ("eww" :follow eww :store org-eww-store-link)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store
org-mhe-store-link)
   ("irc" :follow org-irc-visit :store
org-irc-store-link :export

Re: [BUG] tmp [9.7-pre (release_9.6.10-881-g595a32 @ /home/ps/.emacs.d/org-mode-git/lisp/)]

2023-11-11 Thread Paul Stansell
Hello Ihor,

Thanks very much for your clarification and advice.  I didn't know about
C- or `org-fold-catch-invisible-edits'.  Setting

   (setq org-fold-catch-invisible-edits 'error)

is very useful.

Paul


[BUG] tmp [9.7-pre (release_9.6.10-881-g595a32 @ /home/ps/.emacs.d/org-mode-git/lisp/)]

2023-11-10 Thread Paul Stansell
Hello,

When using Org Mode version 9.7-pre (release_9.6.10-881-g595a32) the
following happens that doesn't happen when using Org Mode version 9.5.5
(release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]:

When the cursor is at the end of a folded section, that is, immediately
after the ellipses, and return is pressed the folded section is made
visible (i.e., it is unfolded).


This is particularly problematic when adding a new section after the last
section in an org file.  If the last section is folded it seems impossible
to get the cursor beyond the final ellipses so when adding a new section
below this one (using return or Alt-return) the previous section is
always opened.  For sections that aren't the last one can put the cursor at
the start of the next section and press Alt-return to insert a new section
above it without unfolding any sections.

Kind regards,

Paul

# ==

Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.10-881-g595a32 @
/home/ps/.emacs.d_Kubuntu-23.04/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-log-done 'time
 org-fontify-done-headline nil
 org-log-into-drawer t
 org-startup-folded 'content
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-format-latex-options '(:foreground "Yellow" :background default :scale
1.2
:html-foreground "Black" :html-background
"Transparent"
:html-scale 1.07 :matchers ("begin" "$1" "$"
"$$" "\\(" "\\["))
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-file-apps '((auto-mode . emacs) ("\\.odt\\'" . "libreoffice %s")
 ("\\.docx\\'" . "libreoffice %s") ("\\.xlsx\\'" .
"libreoffice %s")
 ("\\.png\\'" . "xv %s") ("\\.jpg\\'" . "xv %s")
("\\.jpeg\\'" . "xv %s")
 ("\\.webp\\'" . "xv %s") ("\\.pdf\\'" . "okular \"%s\"")
 ("\\.xoj" . "xournal %s") ("\\.xopp" . "xournalpp %s"))
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
  org-cycle-optimize-window-after-visibility-change
  org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-fold-show-all
append local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-babel-load-languages '((R . t) (emacs-lisp . t) (gnuplot . t) (octave
. t) (python . t)
(fortran . t) (sql . t) (ditaa . t) (dot . t)
(shell . t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-adapt-indentation t
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-highlight-latex-and-related '(latex)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-tangle-lang-exts '(("fortran" . "F90") ("python" . "py")
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-remove-zero-time-clocks t
 org-hide-leading-stars t
 org-todo-keywords '((sequence "TODO(t!)" "MAYBE(m!)" "STARTED(s!)"
"WAITING(w@/!)" "|"
  "DONE(d)&quo

Re: [BUG] Search leaves draws open [9.7-pre (release_9.6.10-835-gf3de4c @ ~/.emacs.d/org-mode-git/lisp/)]

2023-10-20 Thread Paul Stansell
> >> org-hide-drawer-all
> >>
> >
> > I don't seem to have that command.  I'm using Org mode
> > release_9.6.10-835-gf3de4c.
>
> It was made into a command in
>
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=13353f1fa34f6f085ffbf142b380af7308f02981


I see, I found the command, it's called org-fold-hide-drawer-all
(not org-hide-drawer-all).

However, strangely, it doesn't close drawers that have been opened by the
bug that causes drawers to remain open after the searching (eg, those
opened by searching for "text" in the file I included in my bug report).


Re: [BUG] Search leaves draws open [9.7-pre (release_9.6.10-835-gf3de4c @ ~/.emacs.d/org-mode-git/lisp/)]

2023-10-20 Thread Paul Stansell
>
> > In the meantime, is there a command that will close all drawers, even
> those
> > that are open in sections (headings) that are closed?  I searched but
> > didn't find anything.
>
> org-hide-drawer-all
>

I don't seem to have that command.  I'm using Org mode
release_9.6.10-835-gf3de4c.

I grep for org-hide-drawer-all there is the following entry that seems to
imply the command is obsolete:

(define-obsolete-function-alias 'org-hide-drawer-all
  'org-fold-hide-drawer-all "9.6")

If I try to run the command using

  M-x org-hide-drawer-all

I'm told "no match".


Re: [BUG] Search leaves draws open [9.7-pre (release_9.6.10-835-gf3de4c @ ~/.emacs.d/org-mode-git/lisp/)]

2023-10-19 Thread Paul Stansell
Hello Ihor,

In the meantime, is there a command that will close all drawers, even those
that are open in sections (headings) that are closed?  I searched but
didn't find anything.

Thanks,

Paul


[BUG] Search leaves draws open [9.7-pre (release_9.6.10-835-gf3de4c @ ~/.emacs.d/org-mode-git/lisp/)]

2023-10-16 Thread Paul Stansell
Hello,

Using Ctrl-S to search an org file leaves drawers open after the search.
For example, open the attached org file, search_bug.org, and, with the
cursor initially at the first line of the file, search for "text" with
- Ctrl-s text
This finds the first occurrence of "text" in "Subsection 1".  Then press
Ctrl-a to go to the beginning of the line.  At this point all the drawers
in "Subsection 1" are opened and left open.  They are not closed by
Shift-tab visibility cycling.

This doesn't happen with Org mode version 9.5.5 (release_9.5.5).

Thanks,

Paul


Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.10-835-gf3de4c @
~/.emacs.d/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
   org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
 org-cycle-optimize-window-after-visibility-change
 org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-fold-show-all append
   local]
  5]
#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-babel-show-result-all
   append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-confirm-shell-link-function 'yes-or-no-p
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-speed-command-hook '(org-speed-command-activate
 org-babel-speed-command-activate)
 org-persist-directory "/tmp/org-persist-Fs6tWx"
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
 org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
  ("id" :follow org-id-open)
  ("eww" :follow org-eww-open :store org-eww-store-link)
  ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
  ("mhe" :follow org-mhe-open :store org-mhe-store-link)
  ("irc" :follow org-irc-visit :store org-irc-store-link
:export org-irc-export)
  ("info" :follow org-info-open :export org-info-export
:store org-info-store-link :insert-description
org-info-description-as-command)
  ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
  ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
  ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
  ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
  ("w3m" :store org-w3m-store-link)
  ("doi" :follow org-link-doi-open :export
org-link-doi-export)
  ("file+sys") ("file+emacs")
  ("shell" :follow org-link--open-shell)
  ("news" :follow
#[514 "\301\300\302 Q \"\207"
 ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("mailto" :follow
#[514 "\301\300\302 Q \"\207"
 ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("https" :follow
#[514 "\301\300\302 Q \"\207"
 ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("http" :follow
#[514 "\301\300\302 Q \"\207"
 ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("ftp" :follow
#[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"]
 6 "\n\n(fn URL ARG)"]
)
  ("help" :follow org-link--open-help :store
org-link--store-help)
  ("file" :complete org-link-complete-file)
  ("elisp" :follow org-link--open-elisp))
 org-metaup-

Re: Named columns in org tables [9.7-pre (release_9.6.9-797-g4d0f89]

2023-09-27 Thread Paul Stansell
Hello Bruno,


> Could allowing column names on the LHS in my first example be put on a
> todo list?
>

 It seems to be on a todo list already as the following exists:
- https://list.orgmode.org/877cqwbpa2@runbox.com

Paul


Fwd: Named columns in org tables [9.7-pre (release_9.6.9-797-g4d0f89]

2023-09-27 Thread Paul Stansell
Hello Bruno,

It seems to me it's a bug in the documentation.
>
> Currently, column names are not allowed in the LHS (Left Hand Side) of
> the formula ('org-table-get-stored-formulas' assumes it).  Although I'm
> not sure why.
>

 However, the following, with the column name on the RHS, works

|---+++|
|   |  3 |  4 ||
| ^ | c1 | c2 | c3 |
|---+++|
#+TBLFM: $c3 = $c1 + $c2

Could allowing column names on the LHS in my first example be put on a todo
list?

By the way, there is a small error in your example as your $3 should be $4.

Thanks,

Paul


Named columns in org tables [9.7-pre (release_9.6.9-797-g4d0f89]

2023-09-26 Thread Paul Stansell
Hello,

On this page https://orgmode.org/manual/Advanced-features.html
it says
- '!' :: The fields in this line define names for the columns, so that
  you may refer to a column as '$Tot' instead of '$6'.

However, when I experimented with this I found that the first of the
following two tables works (i.e. the empty cells are filled in
correctly), but the second doesn't (the only difference is the
replacement of $4 with $c3 in the second table):

|---+++|
| ! | c1 | c2 | c3 |
| # |  1 |  2 ||
| # |  3 |  4 ||
|---+++|
#+TBLFM: $4 = $c1 + $c2

|---+++|
| ! | c1 | c2 | c3 |
| # |  1 |  2 ||
| # |  3 |  4 ||
|---+++|
#+TBLFM: $c3 = $c1 + $c2

Is this a bug?

Thanks,

Paul

===

Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.9-797-g4d0f89 @
~/.emacs.d/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
   org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
 org-cycle-optimize-window-after-visibility-change
 org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-fold-show-all append
   local]
  5]
#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-babel-show-result-all
   append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-confirm-shell-link-function 'yes-or-no-p
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-speed-command-hook '(org-speed-command-activate
 org-babel-speed-command-activate)
 org-persist-directory "/tmp/org-persist-Cls3dG"
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
 org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
  ("id" :follow org-id-open)
  ("eww" :follow org-eww-open :store org-eww-store-link)
  ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
  ("mhe" :follow org-mhe-open :store org-mhe-store-link)
  ("irc" :follow org-irc-visit :store org-irc-store-link
:export org-irc-export)
  ("info" :follow org-info-open :export org-info-export
:store org-info-store-link :insert-description
org-info-description-as-command)
  ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
  ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
  ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
  ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
  ("w3m" :store org-w3m-store-link)
  ("doi" :follow org-link-doi-open :export
org-link-doi-export)
  ("file+sys") ("file+emacs")
  ("shell" :follow org-link--open-shell)
  ("news" :follow
#[514 "\301\300\302 Q \"\207"
 ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("mailto" :follow
#[514 "\301\300\302 Q \"\207"
 ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("https" :follow
#[514 "\301\300\302 Q \"\207"
 ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("http" :follow
#[514 "\301\300\302 Q \"\207"
 ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("ftp" :follow
#[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"]
 6 "\n\n(fn URL ARG)"]
)
  ("help" :follow org-link--open-help :store
org-link--store-help)
  ("file" :complete org-link-complete-file)
  ("elisp" :follow org-link--open-elisp))
 org-metaup-hook '(org-babel-load-in-session-maybe)
 )


Re: [BUG] wrong-type-argument listp 4240 [9.7-pre (release_9.6.8-749-g4fe52f @ .emacs.d/org-mode-git/lisp/)]

2023-09-14 Thread Paul Stansell
> May you please add
>
> (setq org-element--cache-self-verify 'backtrace)
> (setq org-element--cache-self-verify-frequency 1.0)
>
> to your config?
>

Yes, I'll do that, thanks.


Re: [BUG] wrong-type-argument listp 4240 [9.7-pre (release_9.6.8-749-g4fe52f @ .emacs.d/org-mode-git/lisp/)]

2023-09-13 Thread Paul Stansell
Hello Ihor,

Please let us know if you keep seeing the error more than once.
>
> If you do, we will provide instructions how to get more debugging info,
> so that we can figure out what exactly is going wrong.
>

Since I reported the first warning message in this thread, I've had about
half a dozen similar (but not identical) ones when opening an org file.
They are not repeatable though, in the sense that if I close the file and
re-open it I don't see the warning a second time.

The latest message is this:

   Warning (org-element-cache): org-element--cache: Org parser error
   in file.org::1687. Resetting.
The error was: (error "Invalid search bound (wrong side of point)")
Backtrace:
   nil
Please report this to Org mode mailing list (M-x
org-submit-bug-report). Disable showing Disable logging

Paul


[BUG] wrong-type-argument listp 4240 [9.7-pre (release_9.6.8-749-g4fe52f @ .emacs.d/org-mode-git/lisp/)]

2023-09-06 Thread Paul Stansell
Hello,

I don't know what caused the following message when I opened an org file,
but I'm reporting it as requested by the message:

Warning (org-element-cache): org-element--cache: Org parser error in
tmp_train_notes.org::1. Resetting.
 The error was: (wrong-type-argument listp 4240)
 Backtrace:
nil
 Please report this to Org mode mailing list (M-x org-submit-bug-report).
Disable showing Disable logging

When I opened the same file a second time there was no error message.

Paul


Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.8-749-g4fe52f @
~/.emacs.d/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-log-done 'time
 org-fontify-done-headline nil
 org-log-into-drawer t
 org-startup-folded t
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-format-latex-options '(:foreground "Yellow" :background default :scale
1.2
:html-foreground "Black" :html-background
"Transparent"
:html-scale 1.07 :matchers ("begin" "$1" "$"
"$$" "\\(" "\\["))
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-file-apps '((auto-mode . emacs) ("\\.odt\\'" . "libreoffice %s")
 ("\\.docx\\'" . "libreoffice %s") ("\\.xlsx\\'" .
"libreoffice %s")
 ("\\.png\\'" . "xv %s") ("\\.jpg\\'" . "xv %s")
("\\.jpeg\\'" . "xv %s")
 ("\\.webp\\'" . "xv %s") ("\\.pdf\\'" . "okular \"%s\"")
 ("\\.xoj" . "xournal %s") ("\\.xopp" . "xournalpp %s"))
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
  org-cycle-optimize-window-after-visibility-change
  org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-fold-show-all
append local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-babel-load-languages '((R . t) (emacs-lisp . t) (gnuplot . t) (octave
. t) (python . t)
(fortran . t) (sql . t) (ditaa . t) (dot . t)
(shell . t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-adapt-indentation t
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-highlight-latex-and-related '(latex)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-preserve-indentation t
 org-babel-tangle-lang-exts '(("fortran" . "F90") ("python" . "py")
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-remove-zero-time-clocks t
 org-hide-leading-stars t
 org-todo-keywords '((sequence "TODO(t!)" "MAYBE(m!)" "STARTED(s!)"
"WAITING(w@/!)" "|"
  "DONE(d)" "INFO(i!)" "CANCELLED(c@)" "UNFINISHED(u@)"
"ABANDONED(a@)")
 )
 org-id-link-to-org-use-id t
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-confirm-babel-evaluate nil
 org-fold-core-isearch-open-f

Re: [BUG] unexpected octave output from code blocks [9.7-pre (release_9.6.7-581-gd38ca5)]

2023-09-06 Thread Paul Stansell
>
> Thanks for reporting!
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=13e4ee737


Great work, thanks!


[BUG] unexpected octave output from code blocks [9.7-pre (release_9.6.7-581-gd38ca5)]

2023-09-05 Thread Paul Stansell
Hello,

The attached org file gives examples of outputs from octave code blocks
that are unexpected and inconsistent.

The attached bug.org file should be opened with

  emacs -Q -l init.el bug.org

The problems only occur when the ":session" header is used.

Paul


Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.7-581-gd38ca5 @
/home/ps/.emacs.d_Kubuntu-23.04/org-mode-git/lisp/)
(org-babel-do-load-languages
 'org-babel-load-languages
 '((octave . t)))

(setq org-confirm-babel-evaluate nil)
Run with

  /usr/bin/emacs -Q -l init.el bug.org

Then execute the code blocks by using C-c C-c in code block.

Unexpected output (as it includes a blank line ": " and "octave >")
#+begin_src octave :session oct1 :results output
  x = 1;
  x = 1;
  x = 1
#+end_src

#+RESULTS:
: 
: octave> x = 1

Unexpected output (as it does not include ": x = 1")
#+begin_src octave :session oct2 :results output
  x = 1;
  x = 1
  x = 1;
#+end_src

#+RESULTS:

By comparison, these code block give expected results
#+begin_src octave :session oct3 :results output
  x = 1
  x = 1
  x = 1
#+end_src

#+RESULTS:
: x = 1
: x = 1
: x = 1

#+begin_src octave :session oct4 :results output
  x = 1;
  x = 1
  x = 1
#+end_src

#+RESULTS:
: 
: x = 1
: x = 1

Also, if the ":session" headers are removed the all the code blocks give the expected results, for example,
#+begin_src octave :results output
  x = 1;
  x = 1;
  x = 1
#+end_src

#+RESULTS:
: x = 1


Re: [BUG] tangle breaks fortran modules [9.7-pre (release_9.6.7-581-gd38ca5)]

2023-09-05 Thread Paul Stansell
>
> Meanwhile, you can set :main no as default header argument for fortran.
>

Thanks for taking another look.  I was not aware of ":main no", but it's a
perfectly good fix for my problem.


Re: [BUG] tangle breaks fortran modules [9.7-pre (release_9.6.7-581-gd38ca5)]

2023-09-04 Thread Paul Stansell
>
> I opened the latest Org git repo, ran make repro, opened the file,
> clicked on "tangle" link, moved to the linked source code, and executed
> it. It worked.
>
> So, I am unable to reproduce the problem on my system.
>

Hello Ihor,

Thanks for investigating.  Can you please post your tangled file named
circle.f90.

Mine looks like this

program main
MODULE Circle
  implicit None
  public :: area
contains
  function area(r)
  implicit none
  real, intent(in) :: r
  real :: area
  area = 3.14159 * r**2
  return
  end function area
END MODULE Circle
end program main

which is broken because org/babel has added the first and last lines.

Thanks,

Paul


[BUG] tangle breaks fortran modules [9.7-pre (release_9.6.7-581-gd38ca5)]

2023-09-03 Thread Paul Stansell
Hello,

The attached file is an example of how tangle wraps the Fortran module in

  program main
  end program main

which prevents the code from compiling.

There are more instructions on how to reproduce the bug in the attached
bug.org file.

Paul



Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.7-581-gd38ca5 @
/home/ps/.emacs.d_Kubuntu-23.04/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-log-done 'time
 org-fontify-done-headline nil
 org-log-into-drawer t
 org-startup-folded t
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-format-latex-options '(:foreground "Yellow" :background default :scale
1.2
:html-foreground "Black" :html-background
"Transparent"
:html-scale 1.07 :matchers ("begin" "$1" "$"
"$$" "\\(" "\\["))
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-file-apps '((auto-mode . emacs) ("\\.odt\\'" . "libreoffice %s")
 ("\\.docx\\'" . "libreoffice %s") ("\\.xlsx\\'" .
"libreoffice %s")
 ("\\.png\\'" . "xv %s") ("\\.jpg\\'" . "xv %s")
("\\.jpeg\\'" . "xv %s")
 ("\\.webp\\'" . "xv %s") ("\\.pdf\\'" . "okular \"%s\"")
 ("\\.xoj" . "xournal %s") ("\\.xopp" . "xournalpp %s"))
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
  org-cycle-optimize-window-after-visibility-change
  org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-fold-show-all
append local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-babel-load-languages '((R . t) (emacs-lisp . t) (gnuplot . t) (octave
. t) (python . t)
(fortran . t) (sql . t) (ditaa . t) (dot . t)
(shell . t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-adapt-indentation t
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-highlight-latex-and-related '(latex)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-tangle-lang-exts '(("fortran" . "F90") ("python" . "py")
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-remove-zero-time-clocks t
 org-hide-leading-stars t
 org-todo-keywords '((sequence "TODO(t!)" "MAYBE(m!)" "STARTED(s!)"
"WAITING(w@/!)" "|"
  "DONE(d)" "INFO(i!)" "CANCELLED(c@)" "UNFINISHED(u@)"
"ABANDONED(a@)")
 )
 org-id-link-to-org-use-id t
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-confirm-babel-evaluate nil
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-clock-in-switch-to-state "STARTED"
 org-clock-persist 'history
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-persist-before-write-hook '(org-elemen

Re: [BUG] org-export-data: Unable to resolve link [9.7-pre (release_9.6.7-579-gde9f89)]

2023-07-29 Thread Paul Stansell
On Sat, 29 Jul 2023 at 09:30, Ihor Radchenko  wrote

>
> Thanks for reporting!
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d38ca5923


 It's working fine now.  Thanks very much for your quick response!


[BUG] org-export-data: Unable to resolve link [9.7-pre (release_9.6.7-579-gde9f89)]

2023-07-28 Thread Paul Stansell
In org version 9.3, the gnuplot code block below successfully plots the data
in Table1 (which includes a local hyperlink in the last column).

  #+name: Table1
  | x |  y | notes  |
  |---++|
  | 0 |  0 | [[note_1]] |
  | 1 |  1 ||
  | 2 |  4 ||

  <>: a note

  #+begin_src gnuplot :var d=Table1 :results silent
plot [][] d u 1:2 w lp
  #+end_src

However, trying the same in the newer org versions 9.3 or 9.7-pre gives the
error:

  Unable to resolve link: "note_1"




Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.7-579-gde9f89 @
/home/ps/.emacs.d_Kubuntu-23.04/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
 org-cycle-optimize-window-after-visibility-change
 org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-fold-show-all append local] 5]
#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-babel-show-result-all append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-babel-load-languages '((gnuplot . t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
  ("id" :follow org-id-open)
  ("eww" :follow org-eww-open :store org-eww-store-link)
  ("rmail" :follow org-rmail-open :store org-rmail-store-link)
  ("mhe" :follow org-mhe-open :store org-mhe-store-link)
  ("irc" :follow org-irc-visit :store org-irc-store-link :export
org-irc-export)
  ("info" :follow org-info-open :export org-info-export :store
org-info-store-link :insert-description
org-info-description-as-command)
  ("gnus" :follow org-gnus-open :store org-gnus-store-link)
  ("docview" :follow org-docview-open :export org-docview-export :store
org-docview-store-link)
  ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
  ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
org-bbdb-complete-link :store org-bbdb-store-link)
  ("w3m" :store org-w3m-store-link)
  ("doi" :follow org-link-doi-open :export org-link-doi-export)
  ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell)
  ("news" :follow
#[514 "\301\300\302 Q \"\207" ["news" browse-url ":"] 6
 "\n\n(fn URL ARG)"]
)
  ("mailto" :follow
#[514 "\301\300\302 Q \"\207" ["mailto" browse-url ":"] 6
 "\n\n(fn URL ARG)"]
)
  ("https" :follow
#[514 "\301\300\302 Q \"\207" ["https" browse-url ":"] 6
 "\n\n(fn URL ARG)"]
)
  ("http" :follow
#[514 "\301\300\302 Q \"\207" ["http" browse-url ":"] 6
 "\n\n(fn URL ARG)"]
)
  ("ftp" :follow
#[514 

[BUG] manual should explain how to insert literal dollar sign

2023-06-30 Thread Paul Rubin
Context: I wanted to mention in a document that a certain item cost 
"$12.98+$.77 s/h".  Since the period after the second $ is punctuation, 
the parsing heuristic interpreted that as LaTeX, giving math output in 
the html export.  So I spent a while muddling around trying to figure 
out how to escape the dollar sign, then sought help on IRC, where I got 
the answer: write \dollar and the Org entity parser will turn it into a 
literal dollar sign.  I would not have figured this out myself.


Requested fix: explain the \dollar escape in the Org manual section 
"LaTeX fragments".


Thanks!

Paul





Re: orgmode 9.6

2022-12-16 Thread Paul Schlesinger
Just to remind you the encoding warning does not occur with the same files
using the emacs 28.1 with orgmode 9.52 included.  The characters that
trigger the warning are ones that are not found in UTF-8 and since I do a
lot of editing of web documents and do not correct them until final
output.  orgmode has ignored them in the past (BEFORE 9.6) and  I am happy
with that as long as the files do not become corrupted.  Can one set the
encoding in orgmode as not having to configure file in real time would be
helpful.
tx Paul
Paul H. Schlesinger MD, PhD
Washington University School of Medicine
Don't let your models of reality become confused with reality itself.


On Fri, Dec 16, 2022 at 12:48 AM Jean Louis  wrote:

> * Paul Schlesinger  [2022-12-16 02:04]:
> > started getting an encoding warning when i would tell emacs I wanted to
> > quit. The warning indicated the offending characters but they were in an
> > unformatted buffer on the screen and I became fatigued trying to correct
> > them.
>
> That will happen not only in the Org mode.
>
> What do you see on screen, which are the problematic characters?
>
>
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>


orgmode 9.6

2022-12-15 Thread Paul Schlesinger
Using the included orgmode 9.52 on emacs 28.1 for much of my daily work,
university professor.  At the end of the day I quit emacs, saving all my
work for the day in a very large folder tree that includes all my working
files and this is rsync'ed onto a usb disk that is a backup and is
sync'ed to a disk on my home computer and I have redundant backups. About
one month ago upgraded to orgmode  9.6 using elpa  and about a week ago I
started getting an encoding warning when i would tell emacs I wanted to
quit. The warning indicated the offending characters but they were in an
unformatted buffer on the screen and I became fatigued trying to correct
them.  If I save the file as raw-text I preserve all the org formatting and
structure.  I upgraded ny home computer to 9.6 and this started happening
on it also.  I have returned my current computers to the included org 9.52
and the problem has stopped.  Can anyone report a similar issue, a cause
and a solution.
Thank you

Paul H. Schlesinger MD, PhD
Washington University School of Medicine
Don't let your models of reality become confused with reality itself.


User

2022-11-23 Thread Paul Schlesinger
Have been using org mode for more than 10 years and package manager since
emacs 26.  When I moved to emacs 28, the included org package was 9.4x and
a nag message to install org from the elpa repository appeared everytime
an org file is processed.  I run emacs on windows and list-packages does
not show and "org" package to install although there are many "org-xxx"
packages.  Suggestions appreciated!

Paul H. Schlesinger MD, PhD
Washington University School of Medicine
Don't let your models of reality become confused with reality itself.


Re: [PROPOSED-PATCH] Fix doc string quoting problems with '

2022-07-25 Thread Paul Eggert

On 7/25/22 01:50, Ihor Radchenko wrote:


The conventions sound reasonable, though I do not think that they are
documented in D.6 Tips for Documentation Strings section of the Elisp
manual.


Thanks, I added the following to the Elisp manual to try to fix that:

https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d04701c0c4959d3c42587a4e1277bb517a2ea04b



I am not sure if it is a
good idea to change explicit 'symbol or '(...) mentions in the
documentation of the defcustoms. In particular, when 'symbol is intended
to be set as (setq variable 'symbol), I feel that 'symbol should be
preferred over `symbol' - it will make life easier for users who can
then just copy-paste the text from docstring.


OK, I went with a more conservative route there, e.g., replacing this:

  \\='((?R set-category get-category))

with this:

  (setq org-agenda-bulk-custom-functions 

\\='((?R set-category get-category))) 



Although wordier, this follows the doc string guidelines and should make 
it clear why the apostrophe is present.




Also, note that references in the babel documentation are _not_ Elisp
symbols - they are defined in #+name: name lines at the relevant src
blocks.


Yes, I left those alone. Here's what I installed:

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6013cb161d6f186829f6bfcfc5dd927c6cb89b49



[PROPOSED-PATCH] Fix doc string quoting problems with '

2022-07-24 Thread Paul Eggert
The Emacs doc string convention is to document values as-is when that
is clear, and surrounded by `single quotes' otherwise. For example, a
doc string "(a b c)" stands for a list of symbols, and the doc string
"`a'" stands for a single symbol. The doc string "\\=`a" is typically
not correct for that single symbol, because that is equivalent to
"(quote a)" and the typical intent is to talk about the symbol, not
about the Lisp quoting construct.  One needs "\\=`X" only when talking
about something intended to be equivalent to "(quote X)", as in the
doc string "(provide \\='org-xyz)".
---
 lisp/ob-core.el|  6 +++---
 lisp/ob-julia.el   |  8 
 lisp/ob-table.el   |  4 ++--
 lisp/org-agenda.el | 16 
 lisp/org-attach-git.el |  2 +-
 lisp/org-capture.el|  4 ++--
 lisp/org-faces.el  |  2 +-
 lisp/org-fold-core.el  |  6 +++---
 lisp/org-macs.el   |  2 +-
 lisp/org-plot.el   |  2 +-
 lisp/org-src.el|  2 +-
 lisp/org-table.el  |  2 +-
 lisp/org.el|  2 +-
 lisp/ox.el | 12 ++--
 14 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index ac9af5d24..945adf3a4 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -487,7 +487,7 @@ evaluates to a string.
 A closure is evaluated when the source block is being
 evaluated (e.g. during execution or export), with point at the
 source block.  It is not possible to use an arbitrary function
-symbol (e.g. \\='some-func), since org uses lexical binding.  To
+symbol (e.g. `some-func'), since org uses lexical binding.  To
 achieve the same functionality, call the function within a
 closure (e.g. (lambda () (some-func))).
 
@@ -514,7 +514,7 @@ functionality is also supported for default header 
arguments by
 providing the header argument multiple times in the alist.  For
 example:
 
-\\='((:var . \"foo=\\\"bar\\\"\")
+ ((:var . \"foo=\\\"bar\\\"\")
   (:var . \"bar=\\\"foo\\\"\"))")
 
 (put 'org-babel-default-header-args 'safe-local-variable
@@ -2627,7 +2627,7 @@ in the buffer."
 If the `default-directory' is different from the containing
 file's directory then expand relative links.
 
-If the optional TYPE is passed as \\='attachment and the path is a
+If the optional TYPE is passed as `attachment' and the path is a
 descendant of the DEFAULT-DIRECTORY, the generated link will be
 specified as an an \"attachment:\" style link."
   (when (stringp result)
diff --git a/lisp/ob-julia.el b/lisp/ob-julia.el
index cb65b0310..7f25fafad 100644
--- a/lisp/ob-julia.el
+++ b/lisp/ob-julia.el
@@ -250,8 +250,8 @@ end")
 (defun org-babel-julia-evaluate-external-process
 (body result-type result-params column-names-p)
   "Evaluate BODY in external julia process.
-If RESULT-TYPE equals \\='output then return standard output as a
-string.  If RESULT-TYPE equals \\='value then return the value of the
+If RESULT-TYPE equals `output' then return standard output as a
+string.  If RESULT-TYPE equals `value' then return the value of the
 last statement in BODY, as elisp."
   (cl-case result-type
 (value
@@ -274,8 +274,8 @@ last statement in BODY, as elisp."
 (defun org-babel-julia-evaluate-session
 (session body result-type result-params column-names-p)
   "Evaluate BODY in SESSION.
-If RESULT-TYPE equals \\='output then return standard output as a
-string.  If RESULT-TYPE equals \\='value then return the value of the
+If RESULT-TYPE equals `output' then return standard output as a
+string.  If RESULT-TYPE equals `value' then return the value of the
 last statement in BODY, as elisp."
   (cl-case result-type
 (value
diff --git a/lisp/ob-table.el b/lisp/ob-table.el
index bafc81a1a..1c17db4cc 100644
--- a/lisp/ob-table.el
+++ b/lisp/ob-table.el
@@ -83,8 +83,8 @@ is the equivalent of the following source code block:
  results
  #+end_src
 
-NOTE: The quotation marks around the function name,
-\\='source-block\\=', are optional.
+NOTE: The quotation marks around the function name
+`source-block' are optional.
 
 NOTE: By default, string variable names are interpreted as
 references to source-code blocks, to force interpretation of a
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ace76729f..8e5f229e5 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1646,7 +1646,7 @@ alpha-down Sort headlines alphabetically, 
reversed.
 
 The different possibilities will be tried in sequence, and testing stops
 if one comparison returns a \"not-equal\".  For example, the default
-\\='(time-up category-keep priority-down)
+(time-up category-keep priority-down)
 means: Pull out all entries having a specified time of day and sort them,
 in order to make a time schedule for the current day the first thing in the
 agenda listing for the day.  Of the entries without a time indication, keep
@@ -2111,7 +2111,7 @@ the lower-case version of all tags."
   "Alist of characters and custom functions for bulk actions.
 For example, this value 

Re: [PROPOSED-PATCH] ox-publish: fix typo in function name

2022-07-24 Thread Paul Eggert

Thanks for the review. Pushed with the changes you suggested.



[PROPOSED-PATCH] ox-publish: fix typo in function name

2022-07-23 Thread Paul Eggert
* lisp/ox-publish.el (org-publish-cache-mtime-of-src):
Rename from org-publish-cache-ctime-of-src, since it
has always cached mtime not ctime.  All uses changed.
---
 lisp/ox-publish.el | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 5c6ad94c9..e3d67b695 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -379,7 +379,7 @@ still decide about that independently."
   "Update publishing timestamp for file FILENAME.
 If there is no timestamp, create one."
   (let ((key (org-publish-timestamp-filename filename pub-dir pub-func))
-   (stamp (org-publish-cache-ctime-of-src filename)))
+   (stamp (org-publish-cache-mtime-of-src filename)))
 (org-publish-cache-set key stamp)))
 
 (defun org-publish-remove-all-timestamps ()
@@ -1287,7 +1287,7 @@ the file including them will be republished as well."
   (let* ((key (org-publish-timestamp-filename filename pub-dir pub-func))
 (pstamp (org-publish-cache-get key))
 (org-inhibit-startup t)
-included-files-ctime)
+included-files-mtime)
 (when (equal (file-name-extension filename) "org")
   (let ((visiting (find-buffer-visiting filename))
(buf (find-file-noselect filename))
@@ -1308,15 +1308,15 @@ the file including them will be republished as well."
   (substring m 0 (match-beginning 0))
 m)
  (when filename
-   (push (org-publish-cache-ctime-of-src
+   (push (org-publish-cache-mtime-of-src
   (expand-file-name filename))
- included-files-ctime)))
+ included-files-mtime)))
  (unless visiting (kill-buffer buf)
 (or (null pstamp)
-   (let ((ctime (org-publish-cache-ctime-of-src filename)))
- (or (time-less-p pstamp ctime)
- (cl-some (lambda (ct) (time-less-p ctime ct))
-  included-files-ctime))
+   (let ((mtime (org-publish-cache-mtime-of-src filename)))
+ (or (time-less-p pstamp mtime)
+ (cl-some (lambda (ct) (time-less-p mtime ct))
+  included-files-mtime))
 
 (defun org-publish-cache-set-file-property
   (filename property value  project-name)
@@ -1361,8 +1361,8 @@ does not exist."
 (error "`org-publish-cache-set' called, but no cache present"))
   (puthash key value org-publish-cache))
 
-(defun org-publish-cache-ctime-of-src (file)
-  "Get the ctime of FILE as an integer."
+(defun org-publish-cache-mtime-of-src (file)
+  "Get the mtime of FILE as an integer."
   (let ((attr (file-attributes
   (expand-file-name (or (file-symlink-p file) file)
 (file-name-directory file)
-- 
2.37.1




Org mode together with bug-reference-mode

2022-05-27 Thread Paul Kaletta
Hi,

I'm using GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 
3.24.30, cairo version 1.17.4) of 2021-08-07.

This Emacs comes with Org mode version 9.4.4 (release_9.4.4 @ 
/usr/share/emacs/27.2/list/org).

I want to use Emacs bug-reference-mode together in my Org mode
setup.  Here's an example file:


# Local Variables:
# eval: (bug-reference-mode)
# bug-reference-bug-regexp: 
"\\(\\(?:\\(?:SUPPORT\\|support\\)-\\)\\([0-9]+\\)\\)"
# bug-reference-url-format: https://www.example.com/SUPPORT-%s
# End:

* Some stuff
SUPPORT-12348 support-56779

support-12346


Outside of Org mode bug-reference-mode works as I would expect,
but as a minor mode of org-mode it behaves weirdly.  Most
importantly "C-c RET" aka bug-reference-push-button doesn't work
at all.  Besides not all occurrences of "SUPPORT-\d+" are
highlighted automatically.  This changes as soon as one modifies
any character.

This seems to be some interference between bug-reference-mode and
Org mode, or maybe even a bug in Emacs itself.

Best,
Paul



Re: [PATCH] org-macs.el: Do not compare wall time and file modification time

2022-05-13 Thread Paul Eggert

On 5/13/22 05:28, Max Nikulin wrote:


Feel free to commit your variant though, I will not object, but I am not 
going to update my patch in this way as well.


I'll leave it up to you; it's not a big deal either way.



Re: [PATCH] org-macs.el: Do not compare wall time and file modification time

2022-05-12 Thread Paul Eggert

On 5/12/22 09:55, Max Nikulin wrote:


+(unless (file-exists-p file)
+  (error "File to tangle does not exist: %s" file))
+(when (file-newer-than-file-p file tangled-file)
   (org-babel-tangle-file file ...


file-newer-than-file-p succeeds only if FILE exists, so in that case 
it'd be a bit more efficient to avoid testing FILE's existence again, e.g.:


   (cond
 ((file-newer-than-file-p file tangled-file)
  (org-bable-tangle-file file ...))
 ((not (file-exists-p file))
  (error "File to tangle does not exist: %s" file)))



Re: [PATCH] org-macs.el: Do not compare wall time and file modification time

2022-05-11 Thread Paul Eggert

The comments don't seem to match the code here.


+  (let* ((tangled-file (concat (file-name-sans-extension file) ".el"))
+ (file-mtime (file-attribute-modification-time
+  (file-attributes (file-truename file
+ (tangled-mtime (file-attribute-modification-time
+ (file-attributes (file-truename tangled-file)
+;; Tangle only if the Elisp file is older than the Org file.
+;; Filesystem may have coarse timestamp resolution (HFS+, FAT)
+;; so no need to update if timestamps are equal and thus
+;; `org-file-newer-than-p' can not be used here.
+(unless (and file-mtime
+ tangled-mtime
+ (not (time-less-p tangled-mtime file-mtime)))


Although this looks correct, there's no need to go to the work of 
computing file-mtime in the common case where tangled-mtime is nil.




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-30 Thread Paul Eggert

On 4/30/22 04:22, Max Nikulin wrote:


I posted a corrected version of my `org-encode-time' macro, but I did 
not add you to Cc (I sent reply through news.gmane.io), and it has no 
special case to check whether `encode-time' supports 6 elements list 
argument:


Thanks, I looked at that and have a couple of questions.

As I understand it, org-encode-time is intended to be a compatibility 
function like org-newline-and-indent and org-string-distance. Those are 
in org-compat.el, so I assumed org-encode-time would be there too.


Also, if the intent is to emulate Emacs 29 encode-time, can't we do 
something like the attached instead? The idea is to implement Emacs 29 
encode-time both on pre-29 Emacs (that don't support lists of length 6) 
and post-29 Emacs (which might drop support for the obsolescent form).
From 2f44ee7524e5b2e53f912cff1276f7817495c657 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Sat, 30 Apr 2022 19:27:15 -0700
Subject: [PATCH] org-encode-time compatibility function

* lisp/org/org-compat.el (org-encode-time): New function.
---
 lisp/org/org-compat.el | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 3e394fbab1..0a0025fa0d 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -144,6 +144,16 @@ org-file-has-changed-p--hash-table
   (defun org-time-convert-to-list (time)
 (seconds-to-time (float-time time
 
+(if (ignore-errors (encode-time '(0 0 0 1 1 1971)))
+(if (ignore-errors (encode-time 0 0 0 1 1 1971))
+(defalias 'org-encode-time #'encode-time)
+  (defun org-encode-time (time  args)
+(encode-time (if args (cons time args) time
+  (defun org-encode-time (time  args)
+(if args
+(apply #'encode-time time args)
+  (apply #'encode-time time
+
 ;; `newline-and-indent' did not take a numeric argument before 27.1.
 (if (version< emacs-version "27")
 (defsubst org-newline-and-indent ( _arg)
-- 
2.34.1



Re: master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc.

2022-04-29 Thread Paul Eggert

On 4/29/22 07:22, Max Nikulin wrote:


It was still working in most real-life cases.


Yes, the current code breaks only in fine-grained cases. Most of the 
time it'll work fine since people rarely compile the same file twice in 
the same second.


 From my point of view, it is better to rewrite `org-compile-time' to 
treat the case when there were no file prior to the call as that the 
file has been updated without comparison of timestamps


Yes, that sounds simpler and better. How about the attached patch?From fbd6561952acf359236afcf7957a197376a18c66 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Fri, 29 Apr 2022 11:06:00 -0700
Subject: [PATCH] Improve org-compile-file timestamp handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org/org-macs.el (org-file-newer-than-p):
Don’t lose timestamp information in an attempt to work around
problems on filesystems with coarse-grained timestamps.
(org-compile-file): Use only filesystem timestamps;
don’t try to compare them to the current time, as
the filesystem clock may be different from our clock.
---
 lisp/org/org-macs.el | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index bb0562dde0..907043580a 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -260,14 +260,8 @@ org-file-newer-than-p
   "Non-nil if FILE is newer than TIME.
 FILE is a filename, as a string, TIME is a Lisp time value, as
 returned by, e.g., `current-time'."
-  (and (file-exists-p file)
-   ;; Only compare times up to whole seconds as some file-systems
-   ;; (e.g. HFS+) do not retain any finer granularity.  As
-   ;; a consequence, make sure we return non-nil when the two
-   ;; times are equal.
-   (not (time-less-p (org-time-convert-to-integer
-			  (nth 5 (file-attributes file)))
-			 (org-time-convert-to-integer time)
+  (when-let ((mtime (file-attribute-modification-time (file-attributes file
+(time-less-p time mtime)))
 
 (defun org-compile-file (source process ext  err-msg log-buf spec)
   "Compile a SOURCE file using PROCESS.
@@ -301,7 +295,7 @@ org-compile-file
 	 (full-name (file-truename source))
 	 (out-dir (or (file-name-directory source) "./"))
 	 (output (expand-file-name (concat base-name "." ext) out-dir))
-	 (time (current-time))
+	 (time (file-attribute-modification-time (file-attributes output)))
 	 (err-msg (if (stringp err-msg) (concat ".  " err-msg) "")))
 (save-window-excursion
   (pcase process
@@ -320,7 +314,7 @@ org-compile-file
 	(_ (error "No valid command to process %S%s" source err-msg
 ;; Check for process failure.  Output file is expected to be
 ;; located in the same directory as SOURCE.
-(unless (org-file-newer-than-p output time)
+(unless (or (not time) (org-file-newer-than-p output time))
   (error (format "File %S wasn't produced%s" output err-msg)))
 output))
 
-- 
2.34.1



Re: master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc.

2022-04-28 Thread Paul Eggert

On 4/27/22 09:55, Stefan Monnier wrote:

Instead of rounding the times to whole seconds, wouldn't it make more
sense to check that the difference is larger than 1s?


org-file-newer-than-p is intended to work on filesystems like HFS+ that 
store just the seconds part of the last-modified time. Since these 
filesystems take the floor of the system time, taking the floor should 
be the most-accurate way to work around timestamp truncation issues, 
where comparing one timestamp that comes from an HFS+ filesystem to 
another timestamp coming from some other source (which is how 
org-file-newer-than-p is used).


The code won't work as desired on filesystems like FAT where the 
last-modified time has only 2-second resolution. Ideally Emacs Lisp code 
would have access to file timestamp resolution but that's not something 
it has now, so I merely preserved org-file-newer-than-p's assumption 
that taking the floor is good enough.




Re: master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc.

2022-04-27 Thread Paul Eggert

Thanks for reporting that. Fixed in Emacs master via the attached.

For the more general issue I'm planning to add a builtin boolean 
variable current-time-list soon, that is t for (HIGH LOW MICROSEC 
PICOSEC) format, nil for (TICKS . HZ) format.From 3abb3681b57d7c8ca7fa808addb0a10b6b109cab Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Wed, 27 Apr 2022 00:29:26 -0700
Subject: [PATCH] Use org-time-convert-to-integer instead of by hand
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org/org-macs.el (org-file-newer-than-p):
Don’t assume list-format timestamps, by using
org-time-convert-to-integer instead of doing it by hand.
---
 lisp/org/org-macs.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index b10725bd52..92591b5bb7 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -257,15 +257,16 @@ org-fit-window-to-buffer
 
 (defun org-file-newer-than-p (file time)
   "Non-nil if FILE is newer than TIME.
-FILE is a filename, as a string, TIME is a list of integers, as
+FILE is a filename, as a string, TIME is a Lisp time value, as
 returned by, e.g., `current-time'."
   (and (file-exists-p file)
;; Only compare times up to whole seconds as some file-systems
;; (e.g. HFS+) do not retain any finer granularity.  As
;; a consequence, make sure we return non-nil when the two
;; times are equal.
-   (not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2)
-			 (cl-subseq time 0 2)
+   (not (time-less-p (org-time-convert-to-integer
+			  (nth 5 (file-attributes file)))
+			 (org-time-convert-to-integer time)
 
 (defun org-compile-file (source process ext  err-msg log-buf spec)
   "Compile a SOURCE file using PROCESS.
-- 
2.32.0



Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-25 Thread Paul Eggert

On 4/25/22 08:37, Paul Eggert wrote:
Yes, I plan to omit the patches that were objected to, and install the 
rest. Once that's done you should be good to go for Org. (Alas my 
workstation died over the weekend, but I should have things up and 
running again soon...)


Got my workstation up, installed the patches into Emacs master, and am 
closing the Emacs bug report.


I'll be happy to review the revised org-encode-time implementation, 
whenever you think it could use a review. (Sorry, I've lost track of 
what the proposal is.)




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-25 Thread Paul Eggert
Yes, I plan to omit the patches that were objected to, and install the 
rest. Once that's done you should be good to go for Org. (Alas my 
workstation died over the weekend, but I should have things up and 
running again soon...)




Re: [DRAFT][PATCH] org-encode-time compatibility and convenience helper

2022-04-23 Thread Paul Eggert

On 4/23/22 01:25, Ihor Radchenko wrote:

+  (should (string-equal
+   "2022-03-24 23:30:01"
+   (format-time-string
+"%F %T"
+(org-encode-time '(01 30 23 24 03 2022 nil -1 nil)
...

These tests will be executed using system value of TZ. I am not sure if
tests are not going to break, say, in southern hemisphere or at some
other bizzare values of TZ.



Good point: that test won't work in a time zone where the local time 
23:30:01 does not exist due to a daylight-saving spring-forward transition.




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-21 Thread Paul Eggert
What appears to be happening here is that the MS-Windows native 
timestamp resolution is 1/64th of a second, and your system's clock is 
offset by 0.0075 s from an integer boundary. I.e., the timestamps in 
increasing order are:


  ...
  1650522862 + 62/64 + 0.0075 = 1650522862.976250
  1650522862 + 63/64 + 0.0075 = 1650522862.991875
  1650522863 +  0/64 + 0.0075 = 1650522863.007500
  1650522863 +  1/64 + 0.0075 = 1650522863.023125
  1650522863 +  2/64 + 0.0075 = 1650522863.038750
  ...

and the system clock never returns a timestamp on an integer boundary 
(i.e., tv_nsec is never zero).


We have two options to express this as Emacs timestamps:

(1) We can keep information about resolution but lose information about 
time, by using a resolution of 15.625 ms (i.e., 1/64 s) and truncating 
timestamps to the nearest 1/64 second.  This would generate the 
following (TICKS . HZ) timestamps:


  ...
  (105633463230 . 64) = 1650522862 + 62/64 = 1650522862.968750
  (105633463231 . 64) = 1650522862 + 63/64 = 1650522862.984375
  (105633463232 . 64) = 1650522863 +  0/64 = 1650522863.00
  (105633463233 . 64) = 1650522863 +  1/64 = 1650522863.015625
  (105633463234 . 64) = 1650522863 +  2/64 = 1650522863.031250
  ...

(2) We can keep information about time but lose information about the 
resolution, by using a resolution of 0.625 ms (i.e., HZ = 10 / 
625000 = 16000). (We use 0.625 ms because it is the coarsest resolution 
that does not lose time info.) This would generate the following (TICKS 
. HZ) timestamps:


  ...
  (2640836580762 . 1600) = 1650522862 + 1562/1600 = 1650522862.976250
  (2640836580762 . 1600) = 1650522862 + 1587/1600 = 1650522862.991875
  (2640836580762 . 1600) = 1650522863 +   12/1600 = 1650522863.007500
  (2640836580762 . 1600) = 1650522863 +   37/1600 = 1650522863.023125
  (2640836580762 . 1600) = 1650522863 +   62/1600 = 1650522863.038750
  ...

The patch does (2), and this explains the "gettime_res returned 625000 
ns" in your output.


It shouldn't be hard to change the patch to do (1), if desired. I doubt 
whether users will care one way or the other.



> don't we use time values for file timestamps?

Yes, but file timestamps should use the resolution of the file system, 
which in general is different from the resolution of the system clock. 
That's a separate matter, which would be the subject of a separate 
patch. For now we can stick with what we already have in that department.



> And for Windows, all this does is measure the "resolution" of the
> Gnulib emulation of timespec functions on MS-Windows, it tells nothing
> about the real resolution of the system time values.

If Emacs Lisp code (which currently is based on the Gnulib code) can see 
only (say) 1-microsecond timestamps, then it doesn't matter that the 
underlying system clock has (say) 1-nanosecond precision. Of course it 
would be better for Emacs to see the system timestamp resolution, and if 
we can get the time of day on MS-Windows to a precision better than 1/64 
second then I assume Emacs should do that. Once it does, the patch 
should calculate a higher HZ value to tell users about the improved 
resolution.



> if the "time resolution" determined by this procedure
> is different between two systems, does it mean that two time values
> that are 'equal' on one of them could be NOT 'equal' on another?

Sure, but the traditional (HIGH LOW MICROSEC PICOSEC) representation has 
the same issue. For example, if A's clock has 1 ms resolution and B's 
clock has 10 ms resolution, A's (time-convert nil 'list) called twice 
would return (say) the two timestamps (25184 64239 1000 0) and (25184 
64239 1001 0) at the same moments that B's calls would return (25184 
64239 1000 0) twice. A would say that the two timestamps differ; B would 
say they're the same.


This sort of disagreement is inherent to how timestamp resolution works. 
It doesn't matter whether the timestamps are represented by (HIGH LOW 
MICROSEC PICOSEC) or by (TICKS . HZ); users will run into the same 
problem in both cases.





Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-20 Thread Paul Eggert

On 4/20/22 12:30, Eli Zaretskii wrote:


I see the time samples change in jumps of 15 msec.


Could you give the first part of the output? I would like to see what 
the the samples are jumping from and to, and how often they jump.


Something like the following is what I'd hope to see from the first 
lines of the output of 'gllib/test-gettime-res x'. What are you seeing?


gettime_res returned 15625000 ns
time = 1650496481.515625000
time = 1650496481.53125
time = 1650496481.546875000
time = 1650496481.56250
time = 1650496481.578125000
time = 1650496481.59375
time = 1650496481.609375000
time = 1650496481.62500
time = 1650496481.640625000
time = 1650496481.65625


 Which is expected
on MS-Windows, given the scheduler time tick, but what does that have
to do with the system's time resolution?


The resolution of Elisp's (time-convert nil t) is determined by the 
smallest nonzero gap between timestamps that are returned by C's 
current_timespec. This is the system time resolution as far as Elisp is 
concerned, because Elisp cannot return the current time at a finer 
resolution than what current_timespec gives it. This resolution is not 
necessarily the same as the time resolution of the motherboard clock, OS 
high-res timestamp, file timestamps, etc.



And how is the 0.625 msec
number reported by the program obtained from those samples?


Use the largest resolution R ns consistent with the samples, such that 
10 is an integer multiple of R so that timestamp computations 
are exact.




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-20 Thread Paul Eggert

On 4/20/22 12:14, Eli Zaretskii wrote:

Sorry, my bad.  The result is the same, but I do get printouts.  What
do you want to know or see from there?


I want to see what the current_timespec's resolution is, which we should 
be able to tell from the debugging output. For example, on my Solaris 10 
sparc platform the command 'gltests/test-gettime-res x' outputs:


gettime_res returned 200 ns
time = 1650482432.256445600
time = 1650482432.256460600
time = 1650482432.256464400
time = 1650482432.256468200
time = 1650482432.256471400
time = 1650482432.256474600
time = 1650482432.256478000
time = 1650482432.256481200
time = 1650482432.256484800
...

and these timestamps say that with very high probability 
current_timespec's clock resolution is indeed 200 ns.




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-20 Thread Paul Eggert

On 4/20/22 09:56, Max Nikulin wrote:


A typo: double "a".


Thanks, fixed in the attached which I installed in master.


If I get your idea correctly then "January, 31" + "1 month" should be 
more impressive as impossible date.


Thanks, good idea; also in the attached patch.


I can not figure out which elisp function can help to 
determine wall time for Aug 1 start of day in Cairo:


Africa/Cairo  Thu Jul 31 21:59:59 2014 UT = Thu Jul 31 23:59:59 2014 EET 
isdst=0 gmtoff=7200
Africa/Cairo  Thu Jul 31 22:00:00 2014 UT = Fri Aug  1 01:00:00 2014 
EEST isdst=1 gmtoff=10800


input: 2014-08-01 Africa/Cairo
(timezone may be implicit as the system one)
expected output: 01:00:00


Given mktime's limitations there's no trivial way to do this for 
arbitrary timestamps, since 00:00 doesn't exist in Cairo that day. 
Worse, in some locations near the International Date Line entire days do 
not exist, because at 00:00 they advanced the clocks forward 24 hours in 
order to move the date line.


It sounds like you're asking for a function that, given a date, yields 
the first broken-down timestamp on or after 00:00 of that date. For 
something like that, I'd use encode-time on 00:00 of that date to get a 
timestamp T, and then use time-add and decode-time to decode T-86400 
seconds, T, and T+86400 seconds, and if the decoded times all look fine 
then return (decode-time T). If not (i.e., their UTC offsets differ, or 
T's decoded time is not 00:00 on the correct date) I'd use binary search 
to find discontinuities between T-86400 and T+86400 and look next to 
those discontinuities to find timestamps closer to what you want.


Of course this is not ideal - but it's similar to what many mktime 
implementations do internally, and it's also similar to what Emacs's 
cal-dst already does (maybe you can look there for ideas), so you'd be 
in good company.From f98c3f4426fecf794f47f27aebe1f3b854fb1bfd Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Wed, 20 Apr 2022 12:03:19 -0700
Subject: [PATCH] More encode-time pitfall doc fixes

* doc/lispref/os.texi (Time Conversion): Improve discussion of
encode-time pitfalls based on comments by Max Nikulin (Bug#54764#63).
---
 doc/lispref/os.texi | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index cabae08970..4138dab09f 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1670,7 +1670,7 @@ Time Conversion
 convention, @var{dst} is @minus{}1 and @var{zone} defaults to the
 current time zone rule (@pxref{Time Zone Rules}).
 When modernizing an obsolescent caller, ensure that the more-modern
-list equivalent contains 9 elements with a a @code{dst} element that
+list equivalent contains 9 elements with a @code{dst} element that
 is @minus{}1, not @code{nil}.
 
 Year numbers less than 100 are not treated specially.  If you want them
@@ -1695,22 +1695,28 @@ Time Conversion
 For example:
 
 @lisp
-;; Try to compute the time four years from now.
+;; Try to compute the time one month from now.
 ;; Watch out; this might not work as expected.
 (let ((time (decode-time)))
-  (setf (decoded-time-year time)
-(+ (decoded-time-year time) 4))
+  (setf (decoded-time-month time)
+(+ (decoded-time-month time) 1))
   time)
 @end lisp
 
 @noindent
 Unfortunately, this code might not work as expected if the resulting
-time is invalid due to daylight saving transitions, time zone changes,
+time is invalid due to month length differences,
+daylight saving transitions, time zone changes,
 or missing leap days or leap seconds.  For example, if executed on
-February 29, 2096 this code yields a nonexistent date because 2100 is
-not a leap year.  To avoid some (though not all) of the problem, you
+January 30 this code yields a nonexistent date February 30,
+which @code{encode-time} would adjust to early March.
+Similarly, adding four years to February 29, 2096 would yield the
+nonexistent date February 29, 2100; and adding one hour to 01:30 on
+March 13, 2022 in New York would yield a timestamp 02:30 that does not
+exist because clocks sprang forward from 02:00 to 03:00 that day.
+To avoid some (though not all) of the problem, you
 can base calculations on the middle of the affected unit, e.g., start
-at July 1 when adding years.  Alternatively, you can use the
+at the 15th of the month when adding months.  Alternatively, you can use the
 @file{calendar} and @file{time-date} libraries.
 @end defun
 
-- 
2.32.0



Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-20 Thread Paul Eggert

On 4/20/22 08:07, Max Nikulin wrote:

I have not checked if mktime is a part of 
POSIX and C standard.
mktime is part of both the C standard and POSIX. POSIX extends the C 
standard by saying that time_t is an integer type (the C standard allows 
time_t to be a floating-point type) and that time_t counts non-leap 
seconds since the Epoch (the C standard doesn't say what time_t counts, 
thought it implies that it counts seconds from some origin, which may 
not be 1970).
I still believe that optional DST and ZONE values is an improvement of 
the `encode-time' interface with no real drawbacks.


Yes, that's the direction we're headed.



Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-18 Thread Paul Eggert
Here are the main points I see about making timestamps work better in 
Org mode, and related patches to how Emacs handles timestamps.


* Max would like encode-time to treat a list (SS MM HH DD MM ) as if 
it were (SS MM HH DD MM  nil -1 nil), as that would be more 
convenient for how Org mode deals with ambiguous local timestamps. This 
is relatively easy to add for Emacs 29+, and is done in first of the 
attached proposed patches to Emacs master.


* As I understand it, Max would like a function that emulate Emacs 29 
encode-time with one argument, even if running in Emacs versions back to 
Emacs 25. I suppose such a function would also need to implement Emacs 
27+ encode-time's support for subsecond resolution. E.g., 
(org-encode-time '((44604411568 . 10) 55 0 19 4 2022 - -1 t)) 
should return (1650329744604411568 . 10) even in Emacs 25 and 26.


* There are three other Emacs timestamp changes I should mention that 
might be relevant to Org mode:


** 1. Although in Emacs 28 functions like (time-convert nil t) return a 
timestamp resolution of 1 ns, in Emacs 29 I plan to fix them so that 
they return the system clock resolution, which is often coarser than 1 
ns. This is done in the 4th attached patch.


** 2. In Emacs 29 format-time-string should support a new format "%-N" 
which outputs only enough digits for the system clock resolution. (This 
is the same as GNU "date".) This is done in the 5th attached patch.


** 3. Emacs 29 current-time and related functions should generate a 
(TICKS . HZ) timestamp instead of the old (HIGH LOW MICROSECS PICOSECS) 
timestamp. This change has been planned for some time; it was announced 
in Emacs 27. As far as I know Org mode is already ready for this change 
but I thought I'd mention it again here. This is done in the last 
attached patch.


* My last topic in this email is Max's request for a feature that I'm 
not planning to put into Emacs 29 as it'll require more thought. This 
addresses the problem where your TZ is "Africa/Juba" and you want to 
encode a timestamp like "2021-01-31 23:30" which is ambiguous since at 
24:00 that day Juba moved standard time back by an hour. Unfortunately 
the underlying C mktime function does not allow disambiguation in the 
rare situation where standard time moves further west of Greenwich. 
Addressing this problem would require rewriting mktime from scratch in 
Elisp, or using heuristics that would occasionally fail, or (my 
favorite) extending glibc mktime to treat tm_isdst values other than 
-1,0,1 to support disambiguating such timestamps. In the meantime, one 
can disambiguate such timestamps in Elisp by using numeric time zones, e.g.:


  (format-time-string "%F %T %z"
  (encode-time '(0 30 23 31 1 2021 - -1 TZ))
  "Africa/Juba")

yields "2021-01-31 23:30:00 +0200" if TZ is 7200, and "2021-01-31 
23:30:00 +0300" if TZ is 10800. And perhaps this is the right way to go 
in the long run anyway.From 3d02a8e1192a782a16ffdee4940612f69a12629f Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Mon, 18 Apr 2022 13:08:26 -0700
Subject: [PATCH 1/6] Support (encode-time (list s m h D M Y))

* src/timefns.c (Fencode_time): Add support for a 6-elt list arg.
Requested by Max Nikulin for Org (bug#54764).
* test/src/timefns-tests.el (encode-time-alternate-apis): New test.
---
 doc/lispref/os.texi   |  5 +
 etc/NEWS  |  5 +
 src/timefns.c | 21 +++--
 test/src/timefns-tests.el |  9 +
 4 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index cabae08970..bfcd51318e 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1660,6 +1660,11 @@ Time Conversion
 handle situations like this you can use a numeric @var{zone} to
 disambiguate instead.
 
+The first argument can also be a list @code{(@var{second} @var{minute}
+@var{hour} @var{day} @var{month} @var{year})}, which is treated like
+the list @code{(@var{second} @var{minute} @var{hour} @var{day}
+@var{month} @var{year} nil -1 nil)}.
+
 As an obsolescent calling convention, this function can be given six
 or more arguments.  The first six arguments @var{second},
 @var{minute}, @var{hour}, @var{day}, @var{month}, and @var{year}
diff --git a/etc/NEWS b/etc/NEWS
index 3e7788277d..c5a136ea68 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1950,6 +1950,11 @@ For example, '(time-add nil '(1 . 1000))' no longer warns that the
 '(1 . 1000)' acts like '(1000 . 100)'.  This warning, which was a
 temporary transition aid for Emacs 27, has served its purpose.
 

+** 'encode-time' now also accepts a 6-element list with just time and date.
+(encode-time (list SECOND MINUTE HOUR DAY MONTH YEAR)) is now short for
+(encode-time (list SECOND MINUTE HOUR DAY MONTH YEAR nil -1 nil)).
+
 +++
 ** 'date-to-time' now assumes earliest values if its ar

Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-16 Thread Paul Eggert

On 4/16/22 09:26, Max Nikulin wrote:
Feel free to shorten the added fragment, to change the wording, or to 
use your variant instead. See the attachment.


Thanks, I installed that and then installed the attached, which merges 
that with some documentation improvements that I drafted based on this 
thread.


It is a messy area but I hope the documentation is clearer now.From f1ba92448d1e573640547c68d9bed89fe5c43da0 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Sat, 16 Apr 2022 18:48:51 -0700
Subject: [PATCH] Document encode-time caveats
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* doc/lispref/os.texi (Time of Day, Time Conversion):
Move the warnings about DST being -1 to closer to where DST is
discussed, and reword and improve the discussions and warnings.
Be more precise about years before 1969 (possible west of UTC) vs the
Epoch.  Mention some problems due to leap seconds, leap years,
daylight saving transitions, and time zone changes.  Modernize
discussion of OS timestamp range.  Prefer secular ‘BCE’ to religious
‘BC’.  Omit discussion of decoded-time-add and make-decoded-time, as
they are in a library and are not always available; instead, mention
the library.  Warn about common mistakes when doing simple date
arithmetic.
* src/timefns.c (Fencode_time): In doc string, mention date
arithmetic and tighten up the wording a bit.
---
 doc/lispref/os.texi | 153 +++-
 src/timefns.c   |  16 ++---
 2 files changed, 73 insertions(+), 96 deletions(-)

diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 66689f43a9..8366689640 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1303,10 +1303,16 @@ Time of Day
 
 @cindex Lisp timestamp
 @cindex timestamp, Lisp
+@cindex Coordinated Universal Time
+@cindex Universal Time
+@cindex UTC
+@cindex leap seconds
   Many functions like @code{current-time} and @code{file-attributes}
 return @dfn{Lisp timestamp} values that count seconds, and that can
 represent absolute time by counting seconds since the @dfn{epoch} of
-1970-01-01 00:00:00 UTC.
+1970-01-01 00:00:00 UTC (Coordinated Universal Time).  Typically these
+counts ignore leap seconds; however, GNU and some other operating
+systems can be configured to count leap seconds.
 
   Although traditionally Lisp timestamps were integer pairs, their
 form has evolved and programs ordinarily should not depend on the
@@ -1367,8 +1373,8 @@ Time of Day
 Some of these conversions rely on operating system functions that
 limit the range of possible time values, and signal an error such as
 @samp{"Specified time is not representable"} if the
-limits are exceeded.  For instance, a system may not support years
-before 1970, or years before 1901, or years far in the future.
+limits are exceeded.  For instance, a system might not support
+timestamps before the epoch, or years far in the future.
 You can convert a time value into
 a human-readable string using @code{format-time-string}, into a Lisp
 timestamp using @code{time-convert}, and into other forms using
@@ -1434,11 +1440,11 @@ Time Zone Rules
 which is a platform-dependent default time zone.
 
 The set of supported @env{TZ} strings is system-dependent.  GNU and
-many other systems support the tzdata database, e.g.,
+many other systems support TZDB timezones, e.g.,
 @samp{"America/New_York"} specifies the time zone and daylight saving
 time history for locations near New York City.  GNU and most other
 systems support POSIX-style @env{TZ} strings, e.g.,
-@samp{"EST+5EDT,M4.1.0/2,M10.5.0/2"} specifies the rules used in New
+@samp{"EST5EDT,M4.1.0,M10.5.0"} specifies the rules used in New
 York from 1987 through 2006.  All systems support the string
 @samp{"UTC0"} meaning Universal Time.
 
@@ -1490,18 +1496,20 @@ Time Conversion
   These functions convert time values (@pxref{Time of Day}) to Lisp
 timestamps, or into calendrical information and vice versa.
 
-  Many 32-bit operating systems are limited to system times containing
-32 bits of information in their seconds component; these systems
-typically handle only the times from 1901-12-13 20:45:52 through
-2038-01-19 03:14:07 Universal Time.  However, 64-bit and some 32-bit operating
-systems have larger seconds components, and can represent times far in
-the past or future.
-
-  Calendrical conversion functions always use the Gregorian calendar, even
-for dates before the Gregorian calendar was introduced.  Year numbers
-count the number of years since the year 1 BC, and do not skip zero
+  Many operating systems use 64-bit signed integers to count seconds,
+and can represent times far in the past or future.  However, some are
+more limited.  For example, old-fashioned operating systems that use
+32-bit signed integers typically handle only times from 1901-12-13
+20:45:52 through 2038-01-19 03:14:07 Universal Time.
+
+  Calendrical conversion functions use the Grego

Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-16 Thread Paul Eggert

On 4/15/22 10:23, Max Nikulin wrote:

if you are storing future events bound to wall time then namely 
time zone identifier should have precedence.


Although that would make sense for some applications it's not a good 
idea in general. For example, if you're scheduling a Zoom meeting you 
should save both, because other meeting participants may interpret 
strings like "Pacific/Apia" differently.



Just identifier may be ambiguous around DST transition. So timezone 
abbreviations are ambiguous per se but when identifiers are known they 
may be still necessary to resolve uncertainties for backward time 
shifts. At certain moment the Olson DB started to use "+04" 
abbreviations instead of letters for transitions unrelated to daylight 
saving time.


Yes, timezone names like "Europe/Lisbon" are ambiguous during fallback 
transitions, or if the meaning of "Europe/Lisbon" changes. This is why 
one should also save UT offsets when generating localtime timestamps.


Around five years ago I changed TZDB to numeric use time zone 
abbreviations like "+04" instead of my inventions like "GET", because I 
wanted TZDB to follow existing practice, not invent it. A nice side 
effect is that numeric abbreviations are unambiguous. (Besides, even _I_ 
couldn't remember what "GET" meant. :-)




And WET/WEST gets another bit of info in addition to numerical offset.


That info is meant only for users; I wouldn't rely on it for 
calculations because those abbreviations are ambiguous. It could well 
be, for example that the meaning of "PST" in the United States will 
change in the near future.



I do not remember if it is possible at all to obtain using libc the 
period of constant time offset, when time shift value is valid. 
Sometimes it is necessary to recalculate offset.


Sorry, I don't understand this point. One can easily recalculate the UT 
offset in Emacs Lisp by generating the desired timestamp and calling 
decode-time on it. You surely are talking about something else, but I 
don't know what it is.



You wrote that "2021-01-31 23:30:00 +0300" is parsed correctly. My 
opinion is that when time zone is known to be Africa/Juba (system-wide 
setting, environment variable, or an argument of the parsing function) 
then "2021-01-31 23:30:00 CAT" and "2021-01-31 23:30:00 EAT" should be 
parsed correctly (and localized date-time formats should be parsed as 
well).


That's not possible in general, since the two abbreviations can be the 
same. Traditionally in Australia, for example, "CST" meant both "Central 
Standard Time" and "Central Summer Time", and there are probably still 
apps that use the equivalent of TZ="CST-9:30CST,M10.1.0,M4.1.0/3" which 
does precisely that.


It's hardly ever a good idea to rely on time zone abbreviations as 
they're too often ambiguous. It's much better to use UT offsets. When 
generating a localtime timestamp, one should always output its UT offset 
(in addition to any other advisory info you might want to output). And 
if you do that, many of the abovementioned problems are easily solved.




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-14 Thread Paul Eggert

On 4/14/22 06:19, Max Nikulin wrote:

 date-time + 
"America/Los_Angeles" input should not be reduced to timezone offset in 
the output.


It depends on the application. For some applications (e.g., generating 
"Date:" lines in email), it is entirely correct to output a timestamp 
like "14 Apr 2022 15:16:04 -0700", thus losing the fact that the 
timestamp was generated with TZ="America/Los_Angeles".



Zone internal object or identifier is important for calculation of other 
date-time values based on the origin value.


Again, that depends on the application. It's typically wrong to store an 
old timestamp in a form like "1950-07-01 00:00 Europe/Lisbon", because 
there is no standard for what "Europe/Lisbon" means. If you update your 
copy of TZDB, or interpret such a timestamp on another computer, that 
can change the interpretation of such a timestamp. In this particular 
case, a change in TZDB release 2021b altered the interpretation of this 
old timestamp because we discovered that DST was observed in 1950 in 
Portugal.


If you want to keep the TZDB identifier for advice about how to 
interpret dates relative to a timestamp, that's fine. But you should 
keep the UT offset in addition to the TZDB identifier, if you want your 
app to be fully accurate and useful. For example, you should store 
"1950-07-01 00:00:00 + Europe/Lisbon" for a timestamp generated by 
TZDB release 2021a, so that when you interpret the timestamp in release 
2021b you'll have an idea of what you're dealing with.



I want hints like "in the case of ambiguity resolve to transition time immediately 
before/immediately after transition" or "provide suitable time prior to/after to 
transition".


Although that might be nice it's not what mktime gives us, and I doubt 
whether it's a good idea to try to implement it from scratch in Emacs.


I hope, they may work without explicitly providing time zone offset to the input that anyway requires additional calculations. 


It doesn't require additional calculations on the Emacs Lisp user's 
part. All you need to do is save the UT offset, and use it later. 
There's so little overhead to this that it's not worth worrying about.


±n hours may mean ±n*3600 seconds or time with same minutes and seconds 
values but hours value is changed by n even if a 30 min DST transition 
happens in between.


Sorry, I don't understand what this sentence is intended to mean.


`parse-time-string' has another set of problems.


Sure, but that was just an example. You can write your own date parser. 
The point is that when you save a localtime timestamp, you should save 
its UT offset too, in whatever notation is appropriate.


UTC offset is another feature and implementing the hints I have 
tried to describe may require implementing from scratch full stack of 
time handling functions.


I doubt whether that's a good idea. I've written that sort of code, and 
it's a lot more work than one might think and it's notoriously difficult 
to do it correctly. You have better things to do.
So I still do not see any point in mandatory DST and ZONE fields in new 
interface of `encode-time'.


I think we're in agreement here. As I mentioned earlier, I plan to 
modify Emacs encode-time so that you can pass it a 6-arg list as well as 
an 9-arg list. Once this change is in, the DST and ZONE fields will not 
be mandatory.




Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-13 Thread Paul Eggert

On 4/13/22 07:40, Max Nikulin wrote:


I do not see a way to get 23:30 EAT +0300.


Are you asking for a function F where you say, "I want to give F a 
possibly-ambiguous decoded local time D, and for F to return all 
timestamps that map to D"? If so, encode-time doesn't do that, because 
the underlying C API (namely, mktime) doesn't do that. All mktime and 
encode-time do is give you *one* timestamp that maps to D; it won't give 
you any other timestamps.


If you're worried about possibly-ambiguous decoded local times, you 
could probe (say) one day before and one day after encode-time's result 
to see if the UTC offset changes, and let that guide you to find other 
possible timestamps that map to the decoded time. Although this is just 
a heuristic it should be good enough.


I doubt whether you need to do that, though. Code that is not careful 
about local time offsets doesn't care how ambiguous decoded times are 
resolved. And code that does care should record UTC offsets anyway, and 
you can use those offsets to disambiguate the decoded times. Something 
like this, say:


 (defun encode-and-format-time (time tz)
   (let ((etime (encode-time (parse-time-string time
 (format-time-string "%F %T %Z %z" etime tz)))

With this definition, (encode-and-format-time "2021-01-31 23:30:00 
+0300" "Africa/Juba") yields "2021-01-31 23:30:00 EAT +0300", which is 
the timestamp you want.




`encode-time' should only accept time zone as time offset and should not allow 
default or named value that may be ambiguous.


If we're talking about Org's encode-time substitute, you can of course 
do what you like. But Emacs encode-time has supported ambiguous 
timestamps for some time and I expect it's used by apps that don't care 
how ambiguous decoded times are resolved, which means we shouldn't 
remove that support without having a very good reason.




should be possible to provide hints to `encode-time' to get deterministic 
behavior in the case of time transitions


Yes, that feature is already there. The hint is the UTC offset, as 
illustrated above.




Re: [DRAFT][PATCH] org-encode-time compatibility and convenience helper

2022-04-11 Thread Paul Eggert

On 4/11/22 08:22, Max Nikulin wrote:


+  (defmacro org-encode-time ( time)
+(pcase (length time)
+  (1 `(encode-time ,(car time)))
+  (6 `(encode-time (list ,@time nil -1 nil)))
+  (9 `(encode-time (list ,@time)))


After seeing this code and thinking about it a bit more I now understand 
better why you'd prefer Emacs encode-time to accept a 6-argument list. 
I'll work on adding that to Emacs master (to become Emacs 29). Of course 
something like the above will still needed for Emacs 27 and 28.




Re: [FR] Please consider adding "none" as option for ':mode' table LaTeX attribute

2022-04-11 Thread Paul Van Gelder
Hello Eric,

Thank you very much: that did it :-). Should have known there is always already 
a way!

Kind regards,

Paul

Sent from my iPhone

> On 11 Apr 2022, at 13:06, Eric S Fraga  wrote:
> 
> Hi Paul,
> 
>> On Monday, 11 Apr 2022 at 12:08, Paul van Gelder wrote:
>> First, to manually delete the following three lines from the .tex file:
> 
> If you add these options to the ATTR_LATEX line:
> 
> :float nil :center nil
> 
> you should get what you wanted.
> 
> -- 
> : Eric S Fraga, with org release_9.5.2-426-gf6813d in Emacs 29.0.50




[FR] Please consider adding "none" as option for ':mode' table LaTeX attribute

2022-04-11 Thread Paul van Gelder
Hello all,

This is my first time mailing to the orgmode mailing list; I've read the 
mailing list entry at orgmode.org and I've searched for an answer online, but 
please accept my apologies if this mail doesn't comply with the list etiquette 
after all.

I am trying to export tables from orgmode to LaTex/PDF. I am using the 
following:\

#+ATTR_LATEX: :environment xltabular :width \textwidth :align |l|X|X|X| 
:placement [H]

(Note that there is a lowercase "l" between the the first two pipes "|" after 
:align)

When I export a (long) table that doesn't fit on the page, the table just runs 
off the PDF page.

After some online searching, I found a work-around:

First, to manually delete the following three lines from the .tex file:

\begin{table}[H]
\centering

\end{table} 

Second, to move the \caption{} (which used to be above the now deleted 
\end{table} above \end{xltabular}.

Then the table formats correctly over multiple pages. It is no problem at all 
for me to do this manually, but I thought it may be convenient to have a 'none' 
or 'nil' option for ':mode' that wouldn't input the \table environment in the 
first place?

Perhaps I am doing it all wrong, and my feature request doesn't make any sense. 
In that case, I'd be delighted how to properly output an xltabular table that 
spans multiple pages - without having to manually edit the .text file.

I will try and figure out if I can edit some relevant Elisp code (and propose 
that as feature solution), but that may take a long time since I've never done 
that in the past.

Anyhow, thanks for this amazing mode and wish you all a good day.

Kind regards,

Paul

Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-04-09 Thread Paul Eggert

On 4/7/22 05:37, Max Nikulin wrote:

 (encode-time '(0 30 20 07 04 2022 nil nil nil)) ; wrong! 


Yes, and I see a couple of places (org-parse-time-string, 
org-read-date-analyze) where Org mode returns the wrong decoded 
timestamps, ending in (nil nil nil) even though the DST flag is unknown 
so they should end in (nil -1 nil). Please see attached proposed patch 
which fixes this (also see below).



Since Emacs-27 time fields as separated arguments are considered 
obsolete for calls of `encode-time'.


Obsolescent, not obsolete. The old form still works and it's not going 
away any time soon. If the efficiency concerns you mention are 
significant, we should keep the old form indefinitely.



t is inconvenient to add 3 extra mandatory components at 
the each place.


Then let's keep using the obsolescent calling convention for places 
where that's convenient. Perhaps we should change the documentation to 
say "older" instead of "obsolescent".



 From my point of view it is better to change implementation of 
`encode-time' so that it may accept 6-component list SECOND...YEAR. It 
should not add noticeable performance penalty but makes the function 
more convenient in use.


Unfortunately it makes the function more convenient to use incorrectly. 
This was part of the motivation for the API change. The obsolescent 
calling convention has no way to deal with ambiguous timestamps like 
2022-11-06 01:30 when TZ="America/Los_Angeles". Org mode surely has bugs 
in this area, although I don't have time to scout them out.



Daylight saving 
time field matters only as a list component and ignored as a separate 
argument (by the way, it should be stressed in the docstring).


Do you have a wording suggestion? (The doc string already covers the 
topic concisely; however, conciseness is not always a virtue. :-)


The reason -1 is the default in the obsolete API is backward 
compatibility. If we could have designed the API from scratch it would 
have been different.



In the Org code it is unsure which way to call `encode-time' is more 
convenient. In a half of the cases a list is obtained from another 
function, but another half is timestamp built from computed components. 
Unless the inconsistency with DST I would say that both ways to call the 
function should be supported.


Yes, that's the idea.


So my proposal is to not force Org mode to use new calling convention 
for `encode-time' till DST and ZONE list components will became optional 
ones in a released Emacs version.


This would delay things for ten years or so, no? We'd have to wait until 
Org mode supported only Emacs 29 and later.


Instead, I suggest that we stick with what we have when that's cleaner. 
That is, Org mode can use the obsolescent encode-time API when it's 
cleaner to do that.


It would be helpful for Org mode to use the new encode-time form in some 
cases, when the new form is cleaner. It's easy to support the new form 
efficiently even in older Emacs, using a compatibility shim. This is 
also in the attached proposed patch.


This patch has a few other minor cleanups in the area.

I haven't installed the patch, or tested it other than via 'make check'.


PS. Org mode usually uses encode-time for calendrical calculations. This 
is dicey, as some days don't exist (for example, December 30, 2011 does 
not exist if TZ="Pacific/Apia", because Samoa moved across the 
International Date Line that day). And it's also dicey when Org mode 
uses 00:00:00 (midnight at the start of the day) as a timestamp 
representing the entire day, as it's all too common for midnight to not 
exist (or to be duplicated) due to a DST transition. Generally speaking, 
when Org mode is doing calendrical calculations it should use 
calendrical functions rather than encode-time+decode-time, which are 
best used for time calculations not calendar calculations. (I realize 
that fixing this in Org would be nontrivial; perhaps I should file this 
"PS" as an Org bug report for whoever has time to fix it)From 094345e10ad45e06f7b32e2f8017592210f43463 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Sat, 9 Apr 2022 00:17:09 -0700
Subject: [PATCH] Improve Org usage of timestamps
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The main thing is to follow the (encode-time X) convention where
X’s DST component of nil means standard time, -1 means unknown.
* lisp/org/ol.el (org-store-link): Prefer plain (encode-time ...)
to (apply 'encode-time ...), for speed.
* lisp/org/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
Prefer org-time-string-to-seconds to doing it by hand.
* lisp/org/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org/org.el (org-time-string-to-time, org-timestamp-change):
Prefer (org-encode-time-1 X) to (apply #'encode-time X) when X is
the output of org-parse-time-string.  They're equivalent and
the former is a bit cleaner.
* lisp/o

Re: bug#54731: Please, revert part of dd0727e1ec1 related to Org mode (`encode-time')

2022-04-05 Thread Paul Eggert

On 4/5/22 09:43, Max Nikulin wrote:

Please, revert changes from dd0727e1ec1 related to Org to fix the 
daylight saving time and to mitigate merge conflicts during porting of 
future fixes in Org.


Thanks for mentioning the problem. I installed the attached, which I 
hope suffices.


This patch does keep two of the Org-related parts of dd0727e1ec1; these 
parts should work OK with Emacs 25 and so can be merged into Org before 
it starts assuming Emacs 27.From 9e07ec56c7e58ee1eb5598dfdd1b772a690daa24 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Tue, 5 Apr 2022 17:48:05 -0700
Subject: [PATCH] Port Org encode-time usage back to Emacs 25
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org/ol.el (org-store-link):
* lisp/org/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
* lisp/org/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org/org-macro.el (org-macro--vc-modified-time):
* lisp/org/org-macs.el (org-2ft, org-matcher-time):
* lisp/org/org-table.el (org-table-eval-formula):
* lisp/org/org.el (org-read-date, org-display-custom-time)
(org-time-string-to-time, org-timestamp-change):
Don’t assume Emacs 27 encode-time, since standalone Org still
works with Emacs 25 and it’s easier if we minimize differences
from standalone Org.  Problem reported by Max Nikulin (Bug#54731).
This reverts much of 2021-12-16T17:40:21Z!egg...@cs.ucla.edu.
---
 lisp/org/ol.el  | 2 +-
 lisp/org/org-clock.el   | 8 
 lisp/org/org-colview.el | 2 +-
 lisp/org/org-macro.el   | 2 +-
 lisp/org/org-macs.el| 4 ++--
 lisp/org/org-table.el   | 2 +-
 lisp/org/org.el | 8 
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index 905e491f4a..a03d85f618 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -1575,7 +1575,7 @@ org-store-link
 	  (setq link
 		(format-time-string
 		 (car org-time-stamp-formats)
-		 (encode-time
+		 (apply 'encode-time
 			(list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
 			  nil nil nil
 	  (org-link-store-props :type "calendar" :date cd)))
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index dce5d9d4c0..7395669109 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1904,11 +1904,11 @@ org-clock-sum
 	   ((match-end 2)
 	;; Two time stamps.
 	(let* ((ts (float-time
-			(encode-time
+			(apply #'encode-time
 			   (save-match-data
  (org-parse-time-string (match-string 2))
 		   (te (float-time
-			(encode-time
+			(apply #'encode-time
 			   (org-parse-time-string (match-string 3)
 		   (dt (- (if tend (min te tend) te)
 			  (if tstart (max ts tstart) ts
@@ -3042,9 +3042,9 @@ org-clock-update-time-maybe
 	  (setq ts (match-string 1)
 		te (match-string 3))
 	  (setq s (- (float-time
-		  (encode-time (org-parse-time-string te)))
+		  (apply #'encode-time (org-parse-time-string te)))
 		 (float-time
-		  (encode-time (org-parse-time-string ts
+		  (apply #'encode-time (org-parse-time-string ts
 		neg (< s 0)
 		s (abs s)
 		h (floor (/ s 3600))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 371889432d..829fcbbe3f 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -782,7 +782,7 @@ org-colview-construct-allowed-dates
   (setq time-after (copy-sequence time))
   (setf (nth 3 time-before) (1- (nth 3 time)))
   (setf (nth 3 time-after) (1+ (nth 3 time)))
-  (mapcar (lambda (x) (format-time-string fmt (encode-time x)))
+  (mapcar (lambda (x) (format-time-string fmt (apply #'encode-time x)))
 	  (list time-before time time-after)
 
 (defun org-columns-open-link ( arg)
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index bb8a95065b..0921f3aa27 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -378,7 +378,7 @@ org-macro--vc-modified-time
   (buffer-substring
    (point) (line-end-position)
 		   (when (cl-some #'identity time)
-			 (setq date (encode-time time
+			 (setq date (apply #'encode-time time
 	  (let ((proc (get-buffer-process buf)))
 		(while (and proc (accept-process-output proc .5 nil t)
 	  (kill-buffer buf))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 6f038f026b..b10725bd52 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -1185,7 +1185,7 @@ org-2ft
((numberp s) s)
((stringp s)
 (condition-case nil
-	(float-time (encode-time (org-parse-time-string s)))
+	(float-time (apply #'encode-time (org-parse-time-string s)))
   (error 0)))
(t 0)))
 
@@ -1252,7 +1252,7 @@ org-matcher-time
 \"\", and \"\".
 
 Return 0. if S is not recognized as a valid value."
-  (let ((today (float-time (encode-time
+  (let ((today (float-time (apply #'encode-time
   (append '(0 0 0) (nthcdr 3 (decode-time)))
 (save-match-data
   (cond
diff --git 

Bug report: remote file python src output gives FileNotFound (+ suggested fix)

2020-11-24 Thread paul
When working remotely, a python SRC block with a session and :results set to 
output will return a FileNotFoundError.
To reproduce this bug:
1. Open a .org file remotely
2. Insert the following
#+BEGIN_SRC python :results output :session check
print("a")
#+END_SRC
3. org-ctrl-c-ctrl-c in the code block

I already figured out how to fix it:
In ob-python.el.gz, the function org-babel-python-evaluate-session the 
let-variable tmp-src-file is made, which contains tramp-prefix when working 
remotely. But the tramp-prefix is still there here:
(format org-babel-python--exec-tmpfile tmp-src-file)
which causes the remotely executed command to still contain the prefix, and 
hence it cannot find it.
To fix, the line above could be replaced with
(format org-babel-python--exec-tmpfile (or (file-remote-p tmp-src-file 
'localname) tmp-src-file))

Hope this helps :) (and many many thanks for org-mode)



Re: [Manual] missing parameter documentation in the Capturing column view paragraph

2020-06-22 Thread Paul Bonaud
Oh right, many thanks for both the answers !

On Sat, 20 Jun 2020 at 07:44, Kyle Meyer  wrote:

> Paul Bonaud writes:
>
> > In the “Capturing column view” paragraph of the Org-mode manual there is
> no
> > mention of the `:match` parameter which was added in
> >
> https://code.orgmode.org/bzg/org-mode/commit/8983ac917b1ca1b46697a5d27655e4ef71fa6537
> >
> > It would be nice to add it in the Manual of org-mode available at
> > https://orgmode.org/manual/Capturing-column-view.html
>
> Thanks for noticing.  It looks like an entry for :match was added by
> Carsten in 1a978953a (2020-03-23).  That commit will be included in the
> 9.4 release.
>
> > If I can contribute via a patch or git please let me know how I can do
> > this. I didn't find the source code of the orgmode.org/manual in the
> wild.
>
> For future reference, it's in the above repo under doc/org-manual.org.
> Patches for other issues are of course very appreciated.  Information on
> contributing is at <https://orgmode.org/worg/org-contribute.html>.
>


[Manual] missing parameter documentation in the Capturing column view paragraph

2020-06-19 Thread Paul Bonaud
Hello,

In the “Capturing column view” paragraph of the Org-mode manual there is no
mention of the `:match` parameter which was added in
https://code.orgmode.org/bzg/org-mode/commit/8983ac917b1ca1b46697a5d27655e4ef71fa6537

It would be nice to add it in the Manual of org-mode available at
https://orgmode.org/manual/Capturing-column-view.html

If I can contribute via a patch or git please let me know how I can do
this. I didn't find the source code of the orgmode.org/manual in the wild.

Many thanks for your help and have a nice day,
Paul B.


display-buffer-pop-up-frame causes many extra frames for capture

2020-05-02 Thread Stephen Paul Weber

Hello all!

I have been working to increase my frame use with emacs, and have taken the
following from the manual:

(custom-set-variables
'(display-buffer-base-action
'(
  (display-buffer-reuse-window display-buffer-pop-up-frame)
  (reusable-frames . 0)
)
)
)

When used with org-capture, something surprising happens.  At first, a new frame
is popped up to show the capture template menu.  So far, so good.  However,
after I hit a key to select a template instead of my new frame being replaced
with one containing the template, instead I get 2 new frames (or it closes this
one and makes 3 new -- I end up with 4 total including the original frame I ran
org-capture from) one of the new frames contains the template result and the
other contains `other-buffer` with the usual result that I am looking at 3
frames containing whatever I was working on and one frame containing the org
capture template.

I'm happy to make further customisations of my environment to avoid this, but it
is very surprising to me so I wonder if anyone can guess what might be happening
and give me some pointers about it?

Thank you.


signature.asc
Description: PGP signature


[O] Fwd: Preview of latex fragments

2019-02-23 Thread Paul Schlesinger
Paul H. Schlesinger MD, PhD
Washington University School of Medicine
Don't let your models of reality become confused with reality itself.


-- Forwarded message -
From: Paul Schlesinger 
Date: Sat, Feb 23, 2019 at 12:15 PM
Subject: Preview of latex fragments
To: Orgmode 


Using emacs 26, org 9.1.4, ImageMagick 7.0.8-6 Q16 x64 on windows 10 I
cannot get the preview or CDLatex to function reliably.  For both the key
shortcuts and the long form commands  I get either no response or invalid
parameter 332 in the log.  When I occasionally get a preview displayed I
cannot toggle the image.

Paul Schlesinger

Paul H. Schlesinger MD, PhD
Washington University School of Medicine
Don't let your models of reality become confused with reality itself.


[O] Preview of latex fragments

2019-02-23 Thread Paul Schlesinger
Using emacs 26, org 9.1.4, ImageMagick 7.0.8-6 Q16 x64 on windows 10 I
cannot get the preview or CDLatex to function reliably.  For both the key
shortcuts and the long form commands  I get either no response or invalid
parameter 332 in the log.  When I occasionally get a preview displayed I
cannot toggle the image.

Paul Schlesinger

Paul H. Schlesinger MD, PhD
Washington University School of Medicine
Don't let your models of reality become confused with reality itself.


[O] [PATCH] When testing, fake the current time more robustly

2019-02-12 Thread Paul Eggert
The old approach required Lisp code to use (current-time)
explicitly when calling other primitives, e.g., (float-time
(current-time)).  The new approach fakes all the primitives,
so that Lisp code can now use expressions like plain (float-time).
* testing/org-test.el (org-test-at-time): New macro.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
* testing/lisp/test-org-timer.el (test-org-timer/with-current-time):
* testing/lisp/test-org.el (test-org/org-read-date)
(test-org/deadline-close-p, test-org/deadline)
(test-org/schedule, test-org/time-stamp):
Use it.
---
 testing/lisp/test-org-colview.el | 15 ++---
 testing/lisp/test-org-timer.el   |  3 +-
 testing/lisp/test-org.el | 57 
 testing/org-test.el  | 52 +
 4 files changed, 69 insertions(+), 58 deletions(-)

diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 532515b53..ed75090df 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -510,10 +510,7 @@
   (should
(equal
 "0min"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time
-   (org-parse-time-string "<2014-03-04 Tue>")
+(org-test-at-time "<2014-03-04 Tue>"
   (org-test-with-temp-text
  "* H
 ** S1
@@ -529,10 +526,7 @@
   (should
(equal
 "2d"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time
-   (org-parse-time-string "<2014-03-04 Tue>")
+(org-test-at-time "<2014-03-04 Tue>"
   (org-test-with-temp-text
  "* H
 ** S1
@@ -548,10 +542,7 @@
   (should
(equal
 "1d 12h"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time
-   (org-parse-time-string "<2014-03-04 Tue>")
+(org-test-at-time "<2014-03-04 Tue>"
   (org-test-with-temp-text
  "* H
 ** S1
diff --git a/testing/lisp/test-org-timer.el b/testing/lisp/test-org-timer.el
index f6bd5ab1a..27156dfa9 100644
--- a/testing/lisp/test-org-timer.el
+++ b/testing/lisp/test-org-timer.el
@@ -40,8 +40,7 @@ Also, mute output from `message'."
 (defmacro test-org-timer/with-current-time (time  body)
   "Run BODY, setting `current-time' output to TIME."
   (declare (indent 1))
-  `(cl-letf (((symbol-function 'current-time) (lambda () ,time)))
- ,@body))
+  `(org-test-at-time ,time ,@body))
 
 
 ;;; Time conversion and formatting
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index feaacf673..c3bd07923 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -198,18 +198,14 @@
   (should
(equal
 "2015-03-04"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time (org-parse-time-string "2014-03-04")
+(org-test-at-time "2014-03-04"
   (org-read-date
t nil "+1y" nil
(apply #'encode-time (org-parse-time-string "2012-03-29"))
   (should
(equal
 "2013-03-29"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time (org-parse-time-string "2014-03-04")
+(org-test-at-time "2014-03-04"
   (org-read-date
t nil "++1y" nil
(apply #'encode-time (org-parse-time-string "2012-03-29"))
@@ -219,25 +215,19 @@
   (should
(equal
 "2014-04-01"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time (org-parse-time-string "2014-03-04")
+(org-test-at-time "2014-03-04"
   (let ((org-read-date-prefer-future t))
(org-read-date t nil "1")
   (should
(equal
 "2013-03-04"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time (org-parse-time-string "2012-03-29")
+(org-test-at-time "2012-03-29"
   (let ((org-read-date-prefer-future t))
(org-read-date t nil "3-4")
   (should
(equal
 "2012-03-04"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time (org-parse-time-string "2012-03-29")
+(org-test-at-time "2012-03-29"
   (let ((org-read-date-prefer-future nil))
(org-read-date t nil "3-4")
   ;; When set to `org-read-date-prefer-future' is set to `time', read
@@ -247,17 +237,13 @@
   (should
(equal
 "2012-03-30"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
-(apply #'encode-time (org-parse-time-string "2012-03-29 
16:40")
+(org-test-at-time "2012-03-29 16:40"
   (let ((org-read-date-prefer-future 'time))
(org-read-date t nil "00:40" nil)
   (should-not
(equal
 "2012-03-30"
-(cl-letf (((symbol-function 'current-time)
-  (lambda ()
- 

[O] Bug: If else blocks inside for loop fail in newest version [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/paul/org-mode/lisp/)]

2018-12-20 Thread Paul Lodder

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.

If else blocks inside for loops in python cause IndentationError, it does 
accept the 'if' and the indented part below the 'if', but from 'else:' onwards 
the code is not evaluated anymore because of the 'unexpected indent'. I added 
an example code block in which this error occurs. The list 'odds' only 
contained even values. 

I fixed it by downgrading to an older release again.

#+BEGIN_SRC python
  even = []
  for i in range(10):
  if i % 2 == 0:
  even.append(i)
  else:
  print("here")
  even.append(("this should be in the list as well",))

  even
#+END_SRC

Emacs  : GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-09-22, modified by Debian
Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @ 
/home/paul/org-mode/lisp/)

current state:
==
(setq
 org-src-lang-modes '(("jupyter-python" . python)
  ("latex-macros" . latex) ("ipython" . python)
  ("ocaml" . tuareg) ("elisp" . emacs-lisp)
  ("ditaa" . artist) ("asymptote" . asy)
  ("dot" . fundamental) ("sqlite" . sql)
  ("calc" . fundamental) ("C" . c) ("cpp" . c++)
  ("C++" . c++) ("screen" . shell-script)
  ("shell" . sh) ("bash" . sh))
 org-journal-mode-hook '(#[nil "\301\302\303\304$\207"
   [org-journal-encrypt-on org-add-hook
org-journal-encryption-hook nil t]
   5]
 (lambda nil
  (org-add-hook org-journal-encrypt-on
   (quote org-journal-encryption-hook) nil t)
  )
 )
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
 org-ellipsis "⤵"
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-time-stamp-custom-formats '("<%a %d %B>" . "<%d %b %a %H:%M>")
 org-preview-latex-default-process 'luamagick
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default) ("pdf" . "mupdf %s")
 ("docx?" . "loffice %s"))
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-from-is-user-regexp "\\"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(org-clock-load ob-ipython-auto-configure-kernels
 org-bullets-mode
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all
append local]
   5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes
 org-journal-update-auto-mode-alist)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-clock-persist 'history
 org-agenda-file-regexp "\\`[^.].*\\.org'\\|[0-9]+$"
 org-cycle-hook '(org-cycle-hide-archived-subtrees
  org-cycle-hide-drawers org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-journal-dir "~/media/org/journal/"
 org-journal-date-format "%A %e %B %Y"
 org-todo-keywords '((sequence "TODO(t)" "FEEDBACK(f)" "VERIFY(v)" "|"
  "DONE(d)" "DELEGATED" "DROPPED")
 )
 org-babel-tangle-lang-exts '(("haskell" . "hs") ("ruby" . "rb")
  ("python" . "py") ("lisp" . "lisp")
  ("latex" . "tex") 

Re: [O] bug#27736: OSX 10.6.8: Building from master branch fails.

2018-03-28 Thread Paul Eggert

On 03/28/2018 12:33 PM, Paul Eggert wrote:
Unfortunately the new org code contains the expression (encode-time 0 
0 0 0 0 -5), which won't work on Emacs platforms where time_t is 
32 bits or is unsigned, since such platforms cannot represent a time_t 
value corresponding to the year -5. 


I installed the attached patch into Emacs master to try to fix this. 
I'll CC: this to emacs-orgmode in the hopes that this won't get lost in 
the next merge to Emacs master.


>From 43994e484fadac28682542e75548e80cbb80987d Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Wed, 28 Mar 2018 15:03:40 -0700
Subject: [PATCH] Port recent org-clock fix to POSIX time_t

* lisp/org/org-clock.el (org-clock-special-range):
Don't assume support for time_t values less than 0, or less than
-2**31 for that matter (Bug#27736).
---
 lisp/org/org-clock.el | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index ff32e28d1e..9be0d5bc1f 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -2239,8 +2239,18 @@ org-clock-special-range
 (let* ((start (pcase key
 		(`interactive (org-read-date nil t nil "Range start? "))
 ;; In theory, all clocks started after the dawn of
-;; humanity.
-		(`untilnow (encode-time 0 0 0 0 0 -5))
+;; humanity.  However, the platform's clock
+;; support might not go back that far.  Choose the
+;; POSIX timestamp -2**41 (approximately 68,000
+;; BCE) if that works, otherwise -2**31 (1901) if
+;; that works, otherwise 0 (1970).  Going back
+;; billions of years would loop forever on Mac OS
+;; X 10.6 with Emacs 26 and earlier (Bug#27736).
+		(`untilnow
+ (let ((old 0))
+   (dolist (older '((-32768 0) (-33554432 0)) old)
+ (when (ignore-errors (decode-time older))
+			   (setq old older)
 		(_ (encode-time 0 m h d month y
 	   (end (pcase key
 		  (`interactive (org-read-date nil t nil "Range end? "))
-- 
2.14.3



Re: [O] Bug: Clock times not summed correctly between years [9.0.9 (9.0.9-82-gb862c2-elpa @ ~/.emacs.d/elpa/org/)]

2018-01-07 Thread Paul Stansell
I see that the exact same "bug" was reported at the start of 2016 by
David Bremner.  Personally, I feel that fewer people would be confused
by this if the default value was set to "untilnow".

I also realised that the full list of values that I can use for
org-clock-display-default-range is described in org-clock.el.

By the way, you guys are brilliant and I thank you for your work on
org mode (which I'd struggle to live without now that I'm so dependent
on it).


Re: [O] Bug: Clock times not summed correctly between years [9.0.9 (9.0.9-82-gb862c2-elpa @ ~/.emacs.d/elpa/org/)]

2018-01-06 Thread Paul Stansell
Hello Nicolas,

Thanks for that tip, I was totally unaware of that option (it doesn't seem
to be mentioned in the user documentation, eg, it's not mentioned on
https://orgmode.org/manual/Clocking-commands.html).

I do wonder why the default range should be set at the current year and not
simply over the full range of clocked times in a heading.

Kind regards,

Paul



On 7 January 2018 at 00:32, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Hello,
>
> Paul Stansell <paulstans...@gmail.com> writes:
>
> > The sum of the clock time seems to be summing just times in the current
> > year.  In the example below typing C-c C-x C-d in the "Example" section
> > displays "1:00" instead of "2:00" on the heading line.  The clocktable
> > computes the sum correctly as "2:00".
>
> See `org-clock-display-default-range'.
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] Bug: Clock times not summed correctly between years [9.0.9 (9.0.9-82-gb862c2-elpa @ ~/.emacs.d/elpa/org/)]

2018-01-06 Thread Paul Stansell
Hello,

The sum of the clock time seems to be summing just times in the current
year.  In the example below typing C-c C-x C-d in the "Example" section
displays "1:00" instead of "2:00" on the heading line.  The clocktable
computes the sum correctly as "2:00".

Thanks

# Start Example 
#+BEGIN: clocktable :maxlevel 2 :scope file
#+CAPTION: Clock summary at [2018-01-06 Sat 21:57]
| Headline | Time   |
|--+|
| *Total time* | *2:00* |
|--+|
| Example  | 2:00   |
#+END:

* DONE Example
  :END:
  :CLOCK:
  CLOCK: [2018-01-06 Sat 20:00]--[2018-01-06 Sat 20:30] =>  0:30
  CLOCK: [2018-01-06 Sat 19:30]--[2018-01-06 Sat 20:00] =>  0:30
  CLOCK: [2017-01-06 Fri 20:00]--[2017-01-06 Fri 20:30] =>  0:30
  CLOCK: [2017-01-06 Fri 19:30]--[2017-01-06 Fri 20:00] =>  0:30
  :END:

# End Example --




Emacs  : GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23)
 of 2015-08-26 on localhost.localdomain
Package: Org mode version 9.0.9 (9.0.9-82-gb862c2-elpa @ ~/.emacs.d/elpa/org/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append local] 5
   "\n\n(fn)"]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
append local] 5
   "\n\n(fn)"]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export :store
org-info-store-link)
   ("gnus" :follow org-gnus-open :store org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
org-bbdb-complete-link :store org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path
   ("help" :follow org--open-help-link)
   ("http" :follow (lambda (path) (browse-url (concat
"http:" path
   ("https" :follow (lambda (path) (browse-url (concat
"https:" path
   ("mailto" :follow (lambda (path) (browse-url (concat
"mailto:; path
   ("message" :follow
(lambda (path) (browse-url (concat "message:" path
   ("news" :follow (lambda (path) (browse-url (concat
"news:; path
   ("shell" :follow org--open-shell-link))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )



Re: [O] Bug: Editing src blocks: user-error: Cannot modify an area being edited in a dedicated buffer [9.1.4 (9.1.4-2-g118753-elpaplus @ /home/paul/.emacs.d/elpa/org-plus-contrib-20171211/)]

2017-12-21 Thread Paul Davis
Turns out that the issue was caused by trying to disable a flycheck checker
using the org edit src hook

On Mon, Dec 18, 2017, 6:30 AM Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Paul Davis <paul.dangersa...@gmail.com> writes:
>
> > Using ~C-c '~ to edit a src block works as expected, but if I make
> > changes and use ~C-c '~ again, I get the error ~Cannot modify an area
> > being edited in a dedicated buffer~
>
> I need more information. Where do you make changes? In the newly created
> buffer? Where do you call ~C-c '~?
>
> For example, I created the following buffer
>
> #+begin_src emacs-lisp
>   (+ 1 2)
> #+end_src
>
> moved on the source block, used C-c '. Then, in the new buffer,
> I replaced 2 with 3 and pressed C-c ' again, without any error?
>
> IOW, could you provide a precise recipe demonstrating the issue?
>
> Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] Error when using :show-process header argument in clojure

2017-12-21 Thread Paul Dumais
Hi I was trying to use the new :show-process header argument for clojure in
Org mode version 9.1.4 (9.1.4-13-g84cb63-elpaplus @
(org-plus-contrib-20171218/)

I get the following error:
org-babel-insert-result: Wrong type argument: markerp, nil


[O] Bug: Editing src blocks: user-error: Cannot modify an area being edited in a dedicated buffer [9.1.4 (9.1.4-2-g118753-elpaplus @ /home/paul/.emacs.d/elpa/org-plus-contrib-20171211/)]

2017-12-18 Thread Paul Davis
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

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

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


Using ~C-c '~ to edit a src block works as expected, but if I make
changes and use ~C-c '~ again, I get the error ~Cannot modify an area
being edited in a dedicated buffer~

It happens with the default setting for ~org-src-window-setup~ as well.

I was not experiencing this issue with version 20171127, which was the
last I had befire upgrading to this version. Tested on 20171205 and it
also presented this bug.


Emacs  : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2017-12-04
Package: Org mode version 9.1.4 (9.1.4-2-g118753-elpaplus @
/home/paul/.emacs.d/elpa/org-plus-contrib-20171211/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 outline-minor-mode-hook '((lambda nil (make-local-variable (quote
smart-outline-cut)) (setq smart-outline-cut nil)))
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(closure
   (htmlize-buffer-places
org-html-format-table-no-css htmlize-css-name-prefix htmlize-output-type
htmlize-output-type htmlize-css-name-prefix t)
   (_name contents) contents)
 org-clock-into-drawer "LOGBOOK"
 org-log-done 'time
 org-src-window-setup 'other-frame
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-clock-mode-line-total 'today
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-clock-idle-time 15
 org-pretty-entities t
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-default-notes-file "~/org/todo.org"
 org-clock-in-resume t
 org-capture-templates '(("t" "Todo" entry (file+headline (concat
org-directory "/todo.org") "Todo") "* TODO %?\n  SCHEDULED:
%^{Schedule}t\n  %A")
 ("n" "Note" entry (file+headline (concat
org-directory "/notes.org") "Notes") "* %? %U\n  %i"))
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(closure (t) (_ contents) contents)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-from-is-user-regexp nil
 org-src-mode-hook '(#[nil "\301 \302\"\207" [flycheck-disabled-checkers
add-to-list emacs-lisp-checkdoc] 3] org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-show-block-all append local] 5]
 #[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-babel-show-result-all append local] 5]
 (closure
  (org-inlinetask-min-level org-struct-menu org-last-state
org-id-track-globally texmathp-why remember-data-file
org-agenda-tags-todo-honor-ignore-options
   iswitchb-temp-buflist calc-embedded-open-mode
calc-embedded-open-formula calc-embedded-close-formula
align-mode-rules-list org-export-registered-backends t)
  nil (add-hook (quote change-major-mode-hook) (quote
org-show-block-all) (quote append) (quote local)))
 (closure (*this* org-babel-confirm-evaluate-answer-no t)
nil
  (add-hook (quote change-major-mode-hook) (quote
org-babel-show-result-all) (quote append) (quote local)))
 #[nil "\300\301!\207" [org-bullets-mode 1] 2] #[nil
"\300\301\302\303\304$\207" [add-hook after-save-hook org-babel-tangle nil
local-please] 5] org-clock-load
 (closure
  (org-inlinetask-min-level org-mode-map org-tbl-menu
org-org-menu org-struct-menu org-entities org-last-state
org-id-track-globally org-clock-start-time
   texmathp-why remember-data-file
org-agenda-tags-todo-honor-ignore-options iswitchb-temp-buflist
calc-embedded-open-mode calc-embedded-open-formula
   calc-embedded-close-formula align-mode-rules-list
org-emphasis-alist org-emphasis-regexp-components
org-export-registered-backends org-modules
   org-babel-load-languages org-element-paragraph-separate
ffap-url-regexp t)
  nil (add-hook (quote change-major-mode-hook) (quote
org-show-block-all) (quote append) (qu

[O] Bug: python code block single import line [9.0.9 (release_9.0.9-754-g940c90)]

2017-08-13 Thread Paul Stansell
Hello,

When executing the python code block

  #+begin_src python :session python1
import numpy as np
  #+end_src

I get this error in my python buffer

  Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Dec  7 2015, 11:16:01)
  [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> >>> >>> import numpy as np
  >>>
  open('/tmp/babel-5320QCO/python-5320y31', 'w').write(str(_))


  'org_babel_python_eoe'
  >>> >>> Traceback (most recent call last):
File "", line 1, in 
  NameError: name '_' is not defined
  >>> >>> >>> 'org_babel_python_eoe'
  >>>

However, the following code block does not give an error:

  #+begin_src python :session python2
import numpy as np
1
  #+end_src


Thanks,

Paul


Emacs  : GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23)
 of 2015-08-26 on localhost.localdomain
Package: Org mode version 9.0.9 (release_9.0.9-754-g940c90)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append
local] 5
   "\n\n(fn)"]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
append local] 5
   "\n\n(fn)"]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export :store
org-info-store-link)
   ("gnus" :follow org-gnus-open :store org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete
org-bbdb-complete-link :store org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow (lambda (path) (browse-url (concat "ftp:"
path
   ("help" :follow org--open-help-link)
   ("http" :follow (lambda (path) (browse-url (concat "http:"
path
   ("https" :follow (lambda (path) (browse-url (concat "https:"
path
   ("mailto" :follow (lambda (path) (browse-url (concat "mailto:;
path
   ("news" :follow (lambda (path) (browse-url (concat "news:;
path
   ("shell" :follow org--open-shell-link))
 org-babel-load-languages '((python . t))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )


[O] Bug: Explicit <6> table column width [9.0.9 (release_9.0.9-754-g940c90)]

2017-08-13 Thread Paul Stansell
Hello,

I think there might be a something wrong when explicitly setting a width
of a table column.

For example, for this table

  |---+--|
  |   | <6>  |
  | 1 | one  |
  | 2 | This is a long chunk of text |
  | 3 | three|
  |---+--|

when I press  in the table the view changes to

  |---+--|
  |   | <6>  |
  | 1 | one  |
  | 2 | This i |
  | 3 | three|
  |---+--|

and when I press C-c the view toggles between

  |---+|
  |   | <6>|
  | 1 | one|
  | 2 | This is a long chunk of text |
  | 3 | three  |
  |---+|

and

  |---+--|
  |   | <6>  |
  | 1 | one  |
  | 2 | This is a long chunk of text |
  | 3 | three|
  |---+--|


Based on previous versions of org mode, I expect to see

  |---+|
  |   | <6>|
  | 1 | one|
  | 2 | This=> |
  | 3 | three  |
  |---+|

and

  |---+--|
  |   | <6>  |
  | 1 | one  |
  | 2 | This is a long chunk of text |
  | 3 | three|
  |---+--|


Thanks,

Paul



Emacs  : GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23)
 of 2015-08-26 on localhost.localdomain
Package: Org mode version 9.0.9 (release_9.0.9-754-g940c90)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append
local] 5
   "\n\n(fn)"]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
append local] 5
   "\n\n(fn)"]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export :store
org-info-store-link)
   ("gnus" :follow org-gnus-open :store org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete
org-bbdb-complete-link :store org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow (lambda (path) (browse-url (concat "ftp:"
path
   ("help" :follow org--open-help-link)
   ("http" :follow (lambda (path) (browse-url (concat "http:"
path
   ("https" :follow (lambda (path) (browse-url (concat "https:"
path
   ("mailto" :follow (lambda (path) (browse-url (concat "mailto:;
path
   ("news" :follow (lambda (path) (browse-url (concat "news:;
path
   ("shell" :follow org--open-shell-link))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )


[O] Bug: Latex math mode not set in footnotes [9.0.9 (9.0.9-68-g492420-elpa @ /Home/ps/.emacs.d/elpa/org/)]

2017-08-12 Thread Paul Stansell
Hello,

Latex math mode is not set in a footnote when exporting an org file to
tex or pdf.  Below and attached is a simple example.

Thanks

---cut here--
* Example

  When exporting to pdf math $\hat{x}$ is okay in the main text but
  not in this footnote.[fn:footnote_1: Math $\hat{x}$.]
---cut here--


Emacs  : GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23)
 of 2015-08-26 on localhost.localdomain
Package: Org mode version 9.0.9 (9.0.9-68-g492420-elpa @
/Home/ps/.emacs.d/elpa/org/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append local] 5
   "\n\n(fn)"]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
append local] 5
   "\n\n(fn)"]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export :store
org-info-store-link)
   ("gnus" :follow org-gnus-open :store org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
org-bbdb-complete-link :store org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path
   ("help" :follow org--open-help-link)
   ("http" :follow (lambda (path) (browse-url (concat
"http:" path
   ("https" :follow (lambda (path) (browse-url (concat
"https:" path
   ("mailto" :follow (lambda (path) (browse-url (concat
"mailto:; path
   ("message" :follow
(lambda (path) (browse-url (concat "message:" path
   ("news" :follow (lambda (path) (browse-url (concat
"news:; path
   ("shell" :follow org--open-shell-link))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )


bug.org
Description: Lotus Organizer


Re: [O] Backward incompatible outline-invisible-p change in emacs master for Org

2017-06-14 Thread Paul Rankin
On Thu, 15 Jun 2017, at 03:18 AM, Kaushal Modi wrote:
> On Wed, Jun 14, 2017 at 1:02 PM Bastien Guerry <b...@gnu.org> wrote:
> 
> > The question is: why this patch in the first place?  Paul authored it
> > and I committed it, so I should know--but I don't.  Maybe Paul know or
> > you know better?
> >
> 
> I later found the reason for that commit here:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24073
> 
> Here is the emacs -Q recipe that Paul posted on that debbugs report:
> 
> 1. emacs -Q
> 2. insert " heading"
> 3. M-: (outline-on-heading-p)
> => t
> 4. C-a
> 5. M-: (put-text-property (point) (1+ (point)) 'invisible 'foo)
> 6. M-; (outline-on-heading-p)
> => nil
> 
> Expected results:
> 
> (outline-on-heading-p)
> => t
> 
> Actual results:
> 
> (outline-on-heading-p)
> => nil
> 
> This shows the relation between outline-on-heading-p and
> outline-invisible-p:
> 
> (defun outline-on-heading-p ( invisible-ok)
>   "Return t if point is on a (visible) heading line.
> If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
>   (save-excursion
> (beginning-of-line)
> (and (bolp) (or invisible-ok (not (outline-invisible-p)))
> (looking-at outline-regexp
> 
> Basically the expectation is that a outline heading be not marked as
> "invisible" by any 'foo invisible property. Outline headings should be
> marked invisible by only 'outline invisible property.
> 
> Also as the function is prefixed with "outline-", that kind of makes sense.
> 
> On the other hand, in org, we need a function that returns non-nil for
> *any* invisible property. So that commit breaks org's expectation.
> 
> This looks fine,
> 
> 
> Thanks.
> 
> 
> > but I'd rather revert the faulty Emacs commit if
> > it is not necessary.
> >
> > Until Paul enlighten us, I'll have a deeper look.
> >
> 
> After reviewing debbugs 24073, the commit looks correct for emacs master
> and outline package. WDYT?

Glad the mystery looks like it's solved.

Btw I looped in the orgmode list back here 
http://lists.gnu.org/archive/html/emacs-orgmode/2016-09/msg00029.html

Thanks.

--
www.paulwrankin.com



Re: [O] Mobile org

2017-01-30 Thread Paul Schlesinger
There appear to be more than just one of us.

paul

On Mon, Jan 30, 2017 at 11:26 AM, Kenneth Jacker <jacke...@appstate.edu>
wrote:

>
> there are people besides just me that use it :)
>
>
> ​Yes ... like me!
>
> *OrgMode* is one of my most used ​"systems".
>
> Getting *MobileOrg* updated would be great!
>
> -Kenneth
>
>
>


-- 
Paul H. Schlesinger MD, PhD
Washington University School of Medicine


[O] Mobile org

2017-01-23 Thread Paul Schlesinger
For about two weeks since getting a new ipad I have not been able to
re-install mobile org. After setting up dropbox I can log in from MobileOrg
but the target directories are not created and they are not use if I create
them manually. This seems to me to be resulting from a change in dropbox.
Perhaps these are anticipated by the promise of a version 1.71 that appears
to be expected but not available. I would appreciate direction to
installation instructions that are current or other explanation.


Thank you

Paul Schlesinger

-- 
Paul H. Schlesinger MD, PhD
Washington University School of Medicine


Re: [O] Org-mode: need install/config help on org-plus-contrib-20161102

2016-11-13 Thread Paul Johnson
On Sun, Nov 13, 2016 at 5:42 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> Hello,
>
> Paul Johnson <pauljoh...@gmail.com> writes:
>
>> Mr. Google says org mode in Emacs can work. I'll try that! (I said on
>> Wednesday).   For 2 days I've been fighting with the install &
>> configuration.  I am pretty sure I'm caught in a Bermuda triangle
>> configuration, where org-mode that comes with Emacs is too old,  but
>> the new one from ELPA results in a fail because its pieces are not
>> finding what they want.
>
> See (info "(org) Installation")
>
> In particular,
>
>   Important: you need to do this in a session where no ‘.org’ file has
>   been visited, i.e., where no Org built-in function have been loaded.
>   Otherwise autoload Org functions will mess up the installation.
>
>
That's a soul crusher.  Thanks for explaining.

I found another way to get this wrong.  Switch between version 24.5 and 25.1.

pj


> Regards,
>
> --
> Nicolas Goaziou



-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.



[O] Org-mode: need install/config help on org-plus-contrib-20161102

2016-11-12 Thread Paul Johnson
I want to write guides for using Linux Shell. I first tried the
features that knitr offers for this via R
(http://yihui.name/knitr/demo/engines), but that turned out to be a
fail because the shell session was not persistent across code chunks
and the working directory was not change-able in a graceful way.

Mr. Google says org mode in Emacs can work. I'll try that! (I said on
Wednesday).   For 2 days I've been fighting with the install &
configuration.  I am pretty sure I'm caught in a Bermuda triangle
configuration, where org-mode that comes with Emacs is too old,  but
the new one from ELPA results in a fail because its pieces are not
finding what they want.

I'm running Ubuntu 16.10 with Emacs24.5.1.  The org mode that comes
with Emacs sorta works.  There is no color highlighting in the Emacs
session. I can do C-c C-c and the chunks do run.  There's no
persistent session, but it looks like setting the working directory
for each chunk solves about 85% of problem. Unfortunately, the HTML
output is completely white.

There's a small glimmer of hope in this mission, but the end result is
too poor to put to use.

Then I got courageous and everything went to hell.  After installing
org mode from elpa, and then org mode from the elpa server hosted by
the org mode server, then org-plus-contrib. In the process, I think I
have found all of the stupid error messages that others have posted in
this list.   I'm punch drunk from putting packages in and debugging
Emacs init.

I'm stopping to ask for some help.  When I install org-plus-contrib,
there are plenty of compiler warnings.  And Emacs itself cannot load,
it chokes on this:

File mode specification error: (invalid-function org-babel-header-args-safe-fn)

That's gotta mean I should not ignore the installer warnings with
org-plus-contrib-20161102, can you help me? Here they are:


Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-C.el
at Sat Nov 12 18:56:20 2016
Entering directory `/home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/'

In end of data:
ob-C.el:448:1:Warning: the function `org-babel--get-vars' is not known to be
defined.

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-J.el
at Sat Nov 12 18:56:20 2016

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-R.el
at Sat Nov 12 18:56:21 2016
ob-R.el:70:11:Warning: reference to free variable `org-babel-safe-header-args'
ob-R.el:408:1:Warning: Unused lexical variable `raw'

In end of data:
ob-R.el:470:1:Warning: the following functions are not known to be defined:
org-babel-header-args-safe-fn, org-babel-graphical-output-file,
org-babel--get-vars

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-abc.el
at Sat Nov 12 18:56:21 2016

In end of data:
ob-abc.el:93:1:Warning: the function `org-babel--get-vars' is not known to be
defined.

Compiling file 
/home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-asymptote.el
at Sat Nov 12 18:56:21 2016

In end of data:
ob-asymptote.el:140:1:Warning: the function `org-babel--get-vars' is not known
to be defined.

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-awk.el
at Sat Nov 12 18:56:21 2016

In end of data:
ob-awk.el:112:1:Warning: the function `org-babel--get-vars' is not known to be
defined.

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-calc.el
at Sat Nov 12 18:56:21 2016

In end of data:
ob-calc.el:111:1:Warning: the function `org-babel--get-vars' is not known to
be defined.

Compiling file 
/home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-clojure.el
at Sat Nov 12 18:56:21 2016

In end of data:
ob-clojure.el:119:1:Warning: the function `org-babel--get-vars' is not known
to be defined.

Compiling file 
/home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-comint.el
at Sat Nov 12 18:56:21 2016

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-coq.el
at Sat Nov 12 18:56:21 2016

Compiling file /home/pauljohn/.emacs.d/elpa/org-plus-contrib-20161102/ob-core.el
at Sat Nov 12 18:56:21 2016

In org-babel-check-confirm-evaluate:
ob-core.el:221:8:Warning: function org-babel-check-confirm-evaluate used to
take 1+ arguments, now takes 1
ob-core.el:221:8:Warning: macro `org-babel-check-confirm-evaluate' being
redefined as a function
ob-core.el:248:1:Warning: Unused lexical variable `block-name'
ob-core.el:248:1:Warning: Unused lexical variable `code-block'
ob-core.el:248:1:Warning: Unused lexical variable `query'
ob-core.el:248:1:Warning: Unused lexical variable `noeval'

In org-babel-check-evaluate:
ob-core.el:248:34:Warning: value returned from (format " (%s) " --name) is
unused
ob-core.el:263:1:Warning: Unused lexical variable `block-name'
ob-core.el:263:1:Warning: Unused lexical variable `code-block'
ob-core.el:263:1:Warning: Unused lexical variable `query'
ob-core.el:263:1:Warning: Unused lexical variable `noeval'

In 

Re: [O] bug#24073: 25.1-rc2

2016-09-02 Thread Paul Rankin
Eli Zaretskii <e...@gnu.org> on Wed, 31 Aug 2016 17:25 +0300:
> > From: Paul Rankin <he...@paulwrankin.com>
> > Date: Wed, 31 Aug 2016 12:56:13 +1000
> > Cc: 24...@debbugs.gnu.org
> > 
> > >> The fix seems trivial to me so I'm wondering if there is anything 
> > >> holding it 
> > >> up from being included in 25?
> > > 
> > > Yes, the fact that Emacs 25 is for all practical purposes already
> > > released.
> > 
> > Okay. 25.2?
> 
> I don't see why not, provided that Org developers give us their
> blessing.  Please bring this to their attention on the Org list, or
> ask them to speak up here.  I don't want us to make any changes that
> could adversely affect Org without consulting them first.

Dear Org Mode maintainers,

Looping you in on a proposed bug fix for `outline-invisible-p'.

Briefly, the problem is the function returns non-nil for any invisible
text property when it should only do so for the outline property. As a
defsubst, it is difficult to patch for other affected programs.

Diff pasted:

--- /usr/local/Cellar/emacs/25.1-rc2/share/emacs/25.1/lisp/outline.el.gz
+++ #
@@ -388,9 +388,9 @@
  nil 'move))
 
 (defsubst outline-invisible-p ( pos)
-  "Non-nil if the character after POS is invisible.
+  "Non-nil if the character after POS has outline invisible property.
 If POS is nil, use `point' instead."
-  (get-char-property (or pos (point)) 'invisible))
+  (eq (get-char-property (or pos (point)) 'invisible) 'outline))
 
 (defun outline-back-to-heading ( invisible-ok)
   "Move to previous heading line, or beg of this line if it's a heading.

Diff finished.  Sat Sep  3 14:35:22 2016



[O] bug#23725: 25.0.94; Org mode uses removed aliases to scroll the calendar

2016-06-08 Thread Paul Eggert

I installed the patch and am marking this as done.





[O] caldav-sync owncloud on Digital Ocean servers and self signed certificates.

2016-06-07 Thread Paul Harper
I am trying to get org-caldav to work with my Owncloud which is running on
a Digital Ocean server.

I am getting the message

org-caldav-check-connection:[server address/path_to_calendar]does not
seem to accept DAV requests

I suspect the issue is related to the self signed certificates on the
Digital Ocean server.

Which my Android devices or with Firefox I can install the self signed
certificates and the Owncloud Calender syncs fine. I am not seeing a
way to do that with Emacs Org-Mode.

Is there a way to deal with self-signed certificates in Emacs Org with
org-caldav and Owncloud?


-- 
Regards,


Paul

about.me/pauljamesharper

GnuPG Fingerprint: B3C2 6A80 BB3E 8D4D 126E  4FBE 5F62 4195 17D3 CB75


“Wisdom consists in being able to distinguish among dangers and make a
choice of the least harmful.” — Niccolo Machiavelli, The Prince

“The user’s going to pick dancing pigs over security every time.” — Bruce
Schneier


[O] Orgzly mobile Org-Mode app for Android now with folding

2016-05-16 Thread Paul Harper

I just noticed that Orgzly the mobile app for Android now has folding. I
think this will be replacing Mobile-Org for me.

1.4-beta.4 is out. It should be the last beta, if no issues are found.

• Add "Fold content" option
• Add "Display content in search" option
• Rearrange Settings
• Update "What's New" dialog's button when DB upgrade is in progress
• Use large bullet for folded notes with children

Opt-in to receive beta releases if you haven't already:
https://play.google.com/apps/testing/com.orgzly

Regards,

Paul



[O] org-agenda repeated tasks showing multiple times

2016-05-15 Thread Paul Harper
Hello,

I am getting the following in my org-agenda everyday with repeated
tasks.

"Sunday 15 May 2016
  schedule:   Sched.16x:  Backup KeepassX Local
  schedule:   Sched.16x:  PC Backup to External Drive
  schedule:   Sched.16x:  Review Weekly
  schedule:   Sched.16x:  Backup KeepassX Local
 Sunday 15 May 2016
  schedule:   Sched.16x:  Backup KeepassX Local
  schedule:   Sched.16x:  PC Backup to External Drive
  schedule:   Sched.16x:  Review Weekly
  schedule:   Sched.16x:  Backup KeepassX Local
  schedule:   Sched.16x:  PC Backup to External Drive
  schedule:   Sched.16x:  Review Weekly
And so on

How do I stop that and only see the task for one particular day in my
agenda?

Regards,

Paul




Re: [O] M-x cfw:open-org-calendar not working

2016-04-27 Thread Paul James Harper
Adam

Thanks. I got it working. But I'll note that method for troubleshooting
in future.

Regards,

Paul
On 2016-04-28 01:16:55, Adam Porter wrote:
> I would try opening the el files and eval-buffer in each one, then see
> if the commands are available.




Re: [O] M-x cfw:open-org-calendar not working - Solved

2016-04-27 Thread Paul Harper
Can't remember where I got this from. But this config got Calfw and
Org-gcal working with Gmail.

#+BEGIN_SRC emacs-lisp
(require 'calfw-cal)
(require 'calfw-ical)
(require 'calfw-howm)
(require 'calfw-org)

(defun my-open-calendar ()
  (interactive)
  (cfw:open-calendar-buffer
   :contents-sources
   (list
(cfw:org-create-source "Green")  ; orgmode source
   )))

;; Org-Gcal
(require 'org-gcal)
(setq org-gcal-client-id "mysecretclientid.googleusercontent.com"
  org-gcal-client-secret "myreallysecret"
  org-gcal-file-alist '(("myem...@gmail.com" .
"~/Dropbox/org/calendars/schedule.org")
  ))

#+END_SRC

I hope it helps somebody out.

On 27 April 2016 at 06:41, Paul Harper <harper.pau...@gmail.com> wrote:

>
> I am following this article "Taming Google Calendar With Org-Mode" to
> try to get sync going with my Google
> Calendar. http://jameswilliams.be/blog/2016/01/11/Taming-Your-GCal.html
>
> I've installed Calfw and Org-Gcal with  the package manager. But when I
> M-x cfw:open-org-calendar it does not find the command. Mx cf  only
> finds cfengine.
>
> What is the best way for me to troubleshoot this? My setup is identical
> to the article except for:
>
> (add-to-list 'load-path "/home/username/.emacs.d/elpa/calfw-20160302.1858")
> (require 'calfw)
> (require 'calfw-org)
>
> Regards
>
>
> Paul
> --
> Sent with my mu4e
>



-- 
Regards,


Paul

about.me/pauljamesharper

GnuPG Fingerprint: B3C2 6A80 BB3E 8D4D 126E  4FBE 5F62 4195 17D3 CB75


“Wisdom consists in being able to distinguish among dangers and make a
choice of the least harmful.” — Niccolo Machiavelli, The Prince

“The user’s going to pick dancing pigs over security every time.” — Bruce
Schneier


[O] M-x cfw:open-org-calendar not working

2016-04-26 Thread Paul Harper

I am following this article "Taming Google Calendar With Org-Mode" to
try to get sync going with my Google
Calendar. http://jameswilliams.be/blog/2016/01/11/Taming-Your-GCal.html

I've installed Calfw and Org-Gcal with  the package manager. But when I
M-x cfw:open-org-calendar it does not find the command. Mx cf  only
finds cfengine.

What is the best way for me to troubleshoot this? My setup is identical
to the article except for:

(add-to-list 'load-path "/home/username/.emacs.d/elpa/calfw-20160302.1858")
(require 'calfw)
(require 'calfw-org)

Regards


Paul
-- 
Sent with my mu4e



[O] bug#23299: 25.1.50; org-timestamp-change: Invalid time zone specification: (nil nil nil)

2016-04-20 Thread Paul Eggert
Thanks for reporting the problem. As Eli suggested, it was a typo in org.el that 
was exposed by recent changes to encode-time. I installed into master the 
attached patch, which I think fixes the bug.
From 313e98ceb078468498998305749b2790b7ba Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@penguin.cs.ucla.edu>
Date: Wed, 20 Apr 2016 00:06:01 -0700
Subject: [PATCH] Fix org-timestamp-change typo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Peter Münster (Bug#23299).
* lisp/org/org.el (org-timestamp-change): Fix typo that relied
on undocumented behavior in ‘encode-time’.  In practice the
old code used local time, so use that.
---
 lisp/org/org.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org/org.el b/lisp/org/org.el
index 3abf627..b0e1e20 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -17459,8 +17459,7 @@ org-timestamp-change
 (+ (if (eq org-ts-what 'hour) n 0)   (nth 2 time0))
 (+ (if (eq org-ts-what 'day) n 0)(nth 3 time0))
 (+ (if (eq org-ts-what 'month) n 0)  (nth 4 time0))
-(+ (if (eq org-ts-what 'year) n 0)   (nth 5 time0))
-(nthcdr 6 time0)))
+(+ (if (eq org-ts-what 'year) n 0)   (nth 5 time0
   (when (and (member org-ts-what '(hour minute))
 extra
 (string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra))
-- 
2.5.5



Re: [O] Patch for ox-confluence.el

2016-03-19 Thread Paul Schorfheide
Thanks for the feedback, Nicolas. I wasn't familiar with defcustom. I made
the two edits and attached an updated patch. I would be happy to maintain
the file in org-mode for now and look into moving it into ELPA.

Thanks
Paul Schorfheide

On Thu, Mar 17, 2016 at 6:23 AM Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Paul Schorfheide <pscho...@gmail.com> writes:
>
> > I made a small change to ox-confluence.el to support additional language
> > name mappings. Can someone please review it?
>
> Thank you for the patch.
>
> AFAIU, "ox-confluence.el" doesn't have a maintainer anymore, in case you
> feel like doing the job.
>
> The library could also be moved to ELPA, IMO.
>
> > +(defvar org-confluence-lang-alist
> > +  '(("sh" . "bash"))
> > +  "Map from org-babel language name to confluence wiki language name")
>
> What about making it a defcustom?
>
> >  ;; All the functions we use
> >  (defun org-confluence-bold (bold contents info)
> >(format "*%s*" contents))
> > @@ -111,8 +115,9 @@
> >  (defun org-confluence-src-block (src-block contents info)
> >;; FIXME: provide a user-controlled variable for theme
> >(let* ((lang (org-element-property :language src-block))
> > - (language (if (string= lang "sh") "bash" ;; FIXME: provide a
> mapping of some sort
> > - lang))
> > + (language (if (assoc lang org-confluence-lang-alist)
> > +(cdr (assoc lang org-confluence-lang-alist))
> > +   lang))
>
> Nitpick:
>
>   (or (cdr (assoc lang org-confluence-lang-alist) lang))
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


0001-Add-org-confluence-lang-alist.patch
Description: Binary data


[O] Patch for ox-confluence.el

2016-03-19 Thread Paul Schorfheide
Hi:

I made a small change to ox-confluence.el to support additional language
name mappings. Can someone please review it?

Thanks
Paul Schorfheide


0001-Add-org-confluence-lang-alist.patch
Description: Binary data


Re: [O] [PATCH] Fix the single quote printed in the message printed by org-table-edit-formulas

2016-03-10 Thread Paul Eggert

On 03/10/2016 09:47 AM, Kaushal Modi wrote:


How can I make the help-echo property display the ` and ' verbatim, 
without curving them?


Help strings are considered documentation, so you need to escape special 
characters in help-echo property strings the same way you'd escape them 
in doc strings. Something like this:


(let* ((str1 "\nhello")
   (echo-str1 "left single quote (`) right single quote (') grave 
accent (\\=`) apostrophe (\\=') kill-region (\\[kill-region])")

   ov)
  (let* ((b (+ 1 (point)))
 (e (+ b (string-width str1
(insert str1)
(setq ov (make-overlay b e)))
  (overlay-put ov 'help-echo echo-str1))




Re: [O] [PATCH] Fix the single quote printed in the message printed by org-table-edit-formulas

2016-03-10 Thread Paul Eggert

On 03/10/2016 07:33 AM, Kaushal Modi wrote:


Shouldn't this be handled by `substitute-command-keys' already?
The fix
looks like a hack.


I don't think this has anything to do with substitute-command-keys. 
That function simply returns a string.


Right, 'message' and 'substitute-command-keys' both turn apostrophe into 
right single quote, so if you really want an apostrophe you need to 
escape it, as Kashal's patch does.


You need to escape the output of substitute-command-keys anyway, in case 
it returns a string containing '%', which 'message' would incorrectly 
interpret as a format specifier.




[O] Treat node or subtree as source block?

2016-02-15 Thread Paul M.
I'm interested in treating an entire node or subtree as a source block for
the purposes of tangling.

Is there some way to specify that, say with properties, without having to
explicitly surround text to be tangled with "#+BEGIN_SRC...#+END_SRC" ?

Thanks,
Paul


[O] [PATCH] New version of org-velocity

2015-12-14 Thread Paul Rodriguez
This updates the version of org-velocity in contrib to the latest version.

The new version supports an Ido-like style of refining searches
interactively, and changes the default behavior to better accommodate users
who use org-velocity for navigation instead of note-taking.

Paul Rodriguez
From 6b073644a65a6a145c2b916c258fe05b68ac3e48 Mon Sep 17 00:00:00 2001
From: "Paul M. Rodriguez" <p...@ruricolist.com>
Date: Mon, 14 Dec 2015 17:51:40 -0600
Subject: [PATCH] org-velocity: New version of org-velocity.

* contrib/lisp/org-velocity.el: New version.
---
 contrib/lisp/org-velocity.el | 387 ++-
 1 file changed, 233 insertions(+), 154 deletions(-)

diff --git a/contrib/lisp/org-velocity.el b/contrib/lisp/org-velocity.el
index a7820f1..bfc4d6c 100644
--- a/contrib/lisp/org-velocity.el
+++ b/contrib/lisp/org-velocity.el
@@ -4,7 +4,7 @@
 
 ;; Author: Paul M. Rodriguez <paulmrodrig...@gmail.com>
 ;; Created: 2010-05-05
-;; Version: 4.0
+;; Version: 4.1
 
 ;; This file is not part of GNU Emacs.
 
@@ -78,12 +78,6 @@
   :group 'org-velocity
   :type 'file)
 
-(defcustom org-velocity-search-is-incremental t
-  "Show results incrementally when possible?"
-  :group 'org-velocity
-  :type 'boolean
-  :safe 'booleanp)
-
 (defcustom org-velocity-show-previews t
   "Show previews of the text of each heading?"
   :group 'velocity
@@ -168,20 +162,27 @@ See the documentation for `org-capture-templates'."
 The length of the preview is determined by `window-width'.
 
 Replace all contiguous whitespace with single spaces."
-  (let ((start (progn
- (forward-line 1)
- (if (looking-at org-property-start-re)
- (re-search-forward org-property-end-re)
-   (1- (point))
-(mapconcat
- #'identity
- (split-string
-  (buffer-substring-no-properties
-   start
-   (min
-(+ start (window-width))
-(point-max
- " ")))
+  (let* ((start (progn
+  (forward-line 1)
+  (if (looking-at org-property-start-re)
+  (re-search-forward org-property-end-re)
+(1- (point)
+ (string+props (buffer-substring
+start
+(min
+ (+ start (window-width))
+ (point-max)
+;; We want to preserve the text properties so that, for example,
+;; we don't end up with the raw text of links in the preview.
+(with-temp-buffer
+  (insert string+props)
+  (goto-char (point-min))
+  (save-match-data
+(while (re-search-forward split-string-default-separators
+  (point-max)
+  t)
+  (replace-match " ")))
+  (buffer-string
 
 (cl-defstruct org-velocity-heading buffer position name level preview)
 
@@ -233,9 +234,16 @@ of the base buffer; in the latter, return the file name of
 
 (defun org-velocity-minibuffer-contents ()
   "Return the contents of the minibuffer when it is active."
-  (if (active-minibuffer-window)
-  (with-current-buffer (window-buffer (active-minibuffer-window))
-(minibuffer-contents
+  (when (active-minibuffer-window)
+(with-current-buffer (window-buffer (active-minibuffer-window))
+  (minibuffer-contents
+
+(defun org-velocity-nix-minibuffer ()
+  "Return the contents of the minibuffer and clear it."
+  (when (active-minibuffer-window)
+(with-current-buffer (window-buffer (active-minibuffer-window))
+  (prog1 (minibuffer-contents)
+(delete-minibuffer-contents)
 
 (defun org-velocity-bucket-file ()
   "Return the proper file for Org-Velocity to search.
@@ -259,6 +267,7 @@ use it."
 (error "No bucket and not an Org file"))
 
 (defvar org-velocity-bucket-buffer nil)
+(defvar org-velocity-navigating nil)
 
 (defsubst org-velocity-bucket-buffer ()
   (or org-velocity-bucket-buffer
@@ -271,9 +280,6 @@ use it."
 (defsubst org-velocity-match-window ()
   (get-buffer-window (org-velocity-match-buffer)))
 
-(defsubst org-velocity-match-staging-buffer ()
-  (get-buffer-create " Velocity matches"))
-
 (defun org-velocity-beginning-of-headings ()
   "Goto the start of the first heading."
   (goto-char (point-min))
@@ -310,29 +316,47 @@ use it."
 (make-variable-buffer-local 'org-velocity-saved-winconf)
 
 (defun org-velocity-edit-entry (heading)
+  (if org-velocity-navigating
+  (org-velocity-edit-entry/inline heading)
+(org-velocity-edit-entry/indirect heading)))
+
+(cl-defun org-velocity-goto-entry (heading  narrow)
+  (goto-char (org-velocity-heading-position heading))
+  (save-excursion
+(when narrow
+  (org-narrow-to-subtree))
+(outline-show-all)))
+
+(defun org-velocity-edit-entry/inline (h

[O] org-agenda-files

2015-10-08 Thread Paul Jewell
Good evening!

I am starting to use a more complex setup for org-mode, having left it
alone for more than a year. The setup I am using is documented here:
http://doc.norang.ca/org-mode.html

I am having a problem with setting up the org-agenda-files variable in
the startup code:

In my .emacs:

8<
(setq org-user-agenda-files ( quote ("~/git/org"
 "~/git/org/test")))

(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))
(load "org-mode")

8<

In the org-mode.el file from the above site:

8<
;; The following setting is different from the document so that you
;; can override the document org-agenda-files by setting your
;; org-agenda-files in the variable org-user-agenda-files
;;
(if (boundp 'org-user-agenda-files)
(setq org-agenda-files org-user-agenda-files)
  (setq org-agenda-files (quote ("~/git/org"
   "~/git/org/client1"
   "~/git/client2"

8<

So by setting org-user-agenda-files in my .emacs before loading
org-mode.el (which I have in my ~/.emacs.d/lisp directory), I should be
setting org-agenda-files to ("~/git/org" "~/git/org/test").

Results of executing the following code (in this order) in the scratch
buffer:
(boundp 'org-user-agenda-files)   =>  t
org-user-agenda-files =>  ("~/git/org" "~/git/org/test")
(boundp 'org-agenda-files)=>  t
org-agenda-files  =>  nil
(setq org-agenda-files org-user-agenda-files) => ("~/git/org"
"~/git/org/test")
org-agenda-files  => ("~/git/org"
"~/git/org/test")

So I don't understand why the commands in .emacs and org-mode.el aren't
giving me the expected results. Have I missed something with my limited
knowledge of lisp?

Many thanks in advance for your help!



Re: [O] org-agenda-files

2015-10-08 Thread Paul Jewell


On 08/10/15 20:42, Eric S Fraga wrote:
> On Tuesday,  6 Oct 2015 at 21:34, Paul Jewell wrote:
> 
> [...]
> 
>> So by setting org-user-agenda-files in my .emacs before loading
>> org-mode.el (which I have in my ~/.emacs.d/lisp directory), I should be
>> setting org-agenda-files to ("~/git/org" "~/git/org/test").
> 
> When do you load org itself?
> 
> Other than variables set by customize, I load org and then setq
> variables.
> 

The problem was customize. I set the org-user-agenda-files in .emacs,
then load the org-mode.el. This loads org mode at te top of the file,
then sets org-agenda-files to org-user-agenda-files.

The bit I missed was that org-agenda-files were set in customize to nil,
and this change was happening after the assignment. Once I cleared this,
everything works as planned.

Thanks for coming back to me!



Re: [O] Favorite way of syncing?

2015-09-13 Thread Paul Rudin
Eric S Fraga  writes:

> On Friday, 11 Sep 2015 at 18:42, Ramon Diaz-Uriarte wrote:
>
> [...]
>
>> I use syncthing (https://syncthing.net/) which, admittedly, does not
>> require a server nor uses SSH :-). I keep four computers in sync this way,
>> and also use it to send/receive the org files (with MobileOrg) to/from
>
> Thanks for the heads up on this.  The only thing I use Dropbox for is
> MobileOrg and I would love to avoid using a proprietary *and* closed
> system, especially as some of the content is sensitive.

If the content is sensitive you can either encrypt the data yourself
before it goes to Dropbox (see e.g. ecryptfs) or use a service that does
this as part of its process (see e.g. spideroak).

Not that I have anything against doing thing other ways - I'm just
pointing out that privacy concerns don't, of themselves, mean you can't
use Dropbox (or similar).






Re: [O] Favorite way of syncing?

2015-09-11 Thread Paul Rudin
Tobias Frischholz  writes:

> Hey there!
>
> I was wondering what is your favorite way of syncing your org files and
> everything.
> I’ve checked out unison, but I want more of an automated system that
> synchronizes my two clients via an SSH server.
>
> So far, I’ve also read that people use TRAMP in conjunction with an SSH Server
> (and work exclusively on this SSH server).
> I’ve also read about org-sync and magit (git is an option for me).
> And now I’m starting the get confused.
>
> Any helpful thoughts would be greatly appreciated!
>

Dropbox (or similar) client on both machines?




Re: [O] export subtree as org file

2015-08-24 Thread Paul Rudin
Xebar Saram zelt...@gmail.com writes:

 Hi

 i was wondering if anyone knows how to export a subtree as a simple org file.
 i know i can copy paste into a new file but it seems quick to just export a
 subtree to a new org file :)



Narrow to subtree (C-x n s) then export to org (C-c C-e o o).






[O] elpa upgrade to 8.3.1 on emacs 24.5

2015-08-06 Thread Paul Schlesinger
When I open an org file I get
File mode specification error: (invalid-function setq-local)

I just upgraded so I don't know of any other problems

Paul Schlesinger

-- 
Paul H. Schlesinger MD, PhD
Washington University School of Medicine


  1   2   3   4   5   6   >