Table alignment documentation

2020-02-02 Thread Colin Baxter

I notice in https://orgmode.org/manual/Column-width-and-alignment.html
that a footnote says table centering does not work in emacs but only
when exported to html.

This does not seem to be correct as shown in below screen shot. Perhaps
I am missing something.

Best wishes,

Colin.



Re: A few changes to test in master

2020-02-02 Thread Fraga, Eric
On Friday, 31 Jan 2020 at 21:31, Bastien wrote:
> "Fraga, Eric"  writes:
>
>> 1. the header contents are placed at the leftmost column means the first
>>row does not align with the table in two cases:
>>1. when display-line-number-mode is active and/or
>>2. when org-indent-mode is used.
>
> This concern should be gone now - if you can, please pull from master
> and test again.

The header line is now 2 characters to the right of where it should be!
I have looked at the code briefly but cannot figure out why this would
be.  

I have not seen any difference in behaviour for shrunken columns.

Thank you.
-- 
Eric S Fraga via Emacs 28.0.50, Org release_9.3.2-198-g06d36e



Re: A few changes to test in master

2020-02-02 Thread Bastien
Hi Eric,

"Fraga, Eric"  writes:

> On Friday, 31 Jan 2020 at 17:50, Bastien wrote:
>> "Fraga, Eric"  writes:
>>> 2. the display of the first row does not have column widths adjusted and
>>>so the entries do not line up if the table itself has adjusted column
>>>widths (C-c TAB).
>>
>> `org-table-automatic-realign' being t by default, I very seldom have a
>> problem with the alignment of the first row, so this one does not seem
>> to be very problematic to me.
>
> No, sorry, I think you misunderstood as I did not explain properly.  If
> some columns are hidden or shrunk, the header line is not and so the
> columns are misaligned.  This is independent of automatic
> realignment.

Yes, sorry, I realized I did not understood when I received another
similar request.

Please test the feature from master again, I fixed this two days ago.

-- 
 Bastien



Re: A few changes to test in master

2020-02-02 Thread Fraga, Eric
On Friday, 31 Jan 2020 at 17:50, Bastien wrote:
> "Fraga, Eric"  writes:
>> 2. the display of the first row does not have column widths adjusted and
>>so the entries do not line up if the table itself has adjusted column
>>widths (C-c TAB).
>
> `org-table-automatic-realign' being t by default, I very seldom have a
> problem with the alignment of the first row, so this one does not seem
> to be very problematic to me.

No, sorry, I think you misunderstood as I did not explain properly.  If
some columns are hidden or shrunk, the header line is not and so the
columns are misaligned.  This is independent of automatic realignment.

-- 
Eric S Fraga via Emacs 28.0.50, Org release_9.3.2-164-g3d0282



Re: Bug (with fix): org-tempo-add-block incorrectly inserts comma before next `#+begin_src' during expansion [9.3.2 (9.3.2-8-g47b104-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20200127/)]

2020-02-02 Thread Bram Adams
Hi Ihor,

> It's a duplicate of my earlier bug report
> https://lists.gnu.org/archive/html/emacs-orgmode/2019-12/msg00326.html 
> 

True, I seem to notice the same symptoms and also had 
`org-src-tab-acts-natively’ set.

> Hope, there will be some progress. 

Yes, hopefully removing the `’>’ in org-tempo.el is only a temporary hack 
(cannot use `org-insert-structure-template’ due to other templates).

Thanks for the quick reply,

Bram Adams



> Bram Adams  writes:
> 
>> Hi,
>> 
>> I encountered a bug in org-tempo-add-block, where the following snippet in 
>> an org file (with “> `org-structure-template-alist’):
>> ===
>> > 
>> [random text, potentially empty]
>> 
>> #+begin_src any_code_block
>> […]
>> #+end_src
>> === 
>> 
>> … expands into (notice the comma before `#+begin'):
>> ===
>> [expansion of > 
>> [random text, potentially empty]
>> 
>> ,#+begin_src any_code_block
>> […]
>> #+end_src
>> ===
>> 
>> (The issue does not occur when using `org-insert-structure-template’.)
>> 
>> The spurious comma seems to be generated by the second `’>’ on line 125 of 
>> org-tempo.el:
>> ===
>> (defun org-tempo-add-block (entry)
>>  "Add block entry from `org-structure-template-alist'."
>>  (let* ((key (format "<%s" (car entry)))
>>   (name (cdr entry))
>>   (special (member name '("src" "export"
>>(tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" 
>> name))
>> `(,(format "#+begin_%s%s" name (if special " " ""))
>>   ,(when special 'p) '> n '> ,(unless special 'p) n 
>> ;; <—— line 125
>>   ,(format "#+end_%s" (car (split-string name " ")))
>>   >)
>> key
>> (format "Insert a %s block" name)
>> 'org-tempo-tags)))
>> ===
>> 
>> Removing the second `’>’ on line 125 fixes the issue.
>> 
>> Kind regards,
>> 
>> Bram Adams
>> 
>> 
>> ===
>> ===
>> ===
>> 
>> Emacs  : GNU Emacs 26.3 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 
>> 158 AppKit 1561.6)
>> of 2019-08-29
>> Package: Org mode version 9.3.2 (9.3.2-8-g47b104-elpaplus @ 
>> ~/.emacs.d/elpa/org-plus-contrib-20200127/)
>> 
>> current state:
>> ==
>> (setq
>> org-src-mode-hook '(org-src-babel-configure-edit-buffer
>> org-src-mode-configure-edit-buffer)
>> org-fontify-whole-heading-line t
>> org-refile-target-verify-function 'verify-refile-target
>> org-agenda-scheduled-leaders '("Sch.: " "Sch.%2dx: ")
>> org-link-shell-confirm-function 'yes-or-no-p
>> org-babel-after-execute-hook '(org-redisplay-inline-images)
>> org-tempo-keywords-alist nil
>> org-metadown-hook '(org-babel-pop-to-session-maybe)
>> org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
>> org-refile-targets '((nil :maxlevel . 4) (filter_out_cal :maxlevel . 4))
>> org-enforce-todo-dependencies t
>> org-edit-src-content-indentation 0
>> org-src-tab-acts-natively t
>> org-special-ctrl-a/e t
>> org-agenda-files '(“/path/to/org/"
>>“/path/to/org/archive/")
>> org-shiftup-final-hook '(windmove-up)
>> org-blocker-hook '(org-block-todo-from-checkboxes
>>org-block-todo-from-children-or-siblings-or-parent)
>> org-archive-location "archive/%s_archive.gpg::"
>> org-super-agenda-mode t
>> org-mode-hook '(add-pcomplete-to-capf org-bullets-mode org-tempo-setup
>> #[0 "\300\301\302\303\304$\207"
>>   [add-hook change-major-mode-hook org-show-all append 
>> local] 5]
>> ob-ipython-auto-configure-kernels
>> #[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
>> #[0 "\301\211\207" [imenu-create-index-function 
>> org-imenu-get-tree]
>>   2]
>> org-eldoc-load)
>> org-outline-path-complete-in-steps nil
>> org-archive-hook '(org-attach-archive-delete-maybe)
>> org-confirm-elisp-link-function 'yes-or-no-p
>> org-agenda-finalize-hook '(ap/org-super-agenda-origami-fold-default
>>gs/org-agenda-project-highlight-warning
>>#[0 "\300ed\301#\207"
>>  [remove-text-properties (mouse-face t)] 4]
>>)
>> 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-shiftdown-final-hook '(windmove-down)
>> org-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning)
>> (0.5 . org-upcoming-deadline)
>> (0.0 . org-upcoming-distant-deadline))
>> 

Re: Bug (with fix): org-tempo-add-block incorrectly inserts comma before next `#+begin_src' during expansion [9.3.2 (9.3.2-8-g47b104-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20200127/)]

2020-02-02 Thread Ihor Radchenko
It's a duplicate of my earlier bug report
https://lists.gnu.org/archive/html/emacs-orgmode/2019-12/msg00326.html

Hope, there will be some progress. 

Best,
Ihor

Bram Adams  writes:

> Hi,
>
> I encountered a bug in org-tempo-add-block, where the following snippet in an 
> org file (with “ `org-structure-template-alist’):
> ===
> 
> [random text, potentially empty]
>
> #+begin_src any_code_block
> […]
> #+end_src
> === 
>
> … expands into (notice the comma before `#+begin'):
> ===
> [expansion of 
> [random text, potentially empty]
>
> ,#+begin_src any_code_block
> […]
> #+end_src
> ===
>
> (The issue does not occur when using `org-insert-structure-template’.)
>
> The spurious comma seems to be generated by the second `’>’ on line 125 of 
> org-tempo.el:
> ===
> (defun org-tempo-add-block (entry)
>   "Add block entry from `org-structure-template-alist'."
>   (let* ((key (format "<%s" (car entry)))
>(name (cdr entry))
>(special (member name '("src" "export"
> (tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" 
> name))
>  `(,(format "#+begin_%s%s" name (if special " " ""))
>,(when special 'p) '> n '> ,(unless special 'p) n 
> ;; <—— line 125
>,(format "#+end_%s" (car (split-string name " ")))
>>)
>  key
>  (format "Insert a %s block" name)
>  'org-tempo-tags)))
> ===
>
> Removing the second `’>’ on line 125 fixes the issue.
>
> Kind regards,
>
> Bram Adams
>
>
> ===
> ===
> ===
>
> Emacs  : GNU Emacs 26.3 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 
> 158 AppKit 1561.6)
>  of 2019-08-29
> Package: Org mode version 9.3.2 (9.3.2-8-g47b104-elpaplus @ 
> ~/.emacs.d/elpa/org-plus-contrib-20200127/)
>
> current state:
> ==
> (setq
>  org-src-mode-hook '(org-src-babel-configure-edit-buffer
>  org-src-mode-configure-edit-buffer)
>  org-fontify-whole-heading-line t
>  org-refile-target-verify-function 'verify-refile-target
>  org-agenda-scheduled-leaders '("Sch.: " "Sch.%2dx: ")
>  org-link-shell-confirm-function 'yes-or-no-p
>  org-babel-after-execute-hook '(org-redisplay-inline-images)
>  org-tempo-keywords-alist nil
>  org-metadown-hook '(org-babel-pop-to-session-maybe)
>  org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
>  org-refile-targets '((nil :maxlevel . 4) (filter_out_cal :maxlevel . 4))
>  org-enforce-todo-dependencies t
>  org-edit-src-content-indentation 0
>  org-src-tab-acts-natively t
>  org-special-ctrl-a/e t
>  org-agenda-files '(“/path/to/org/"
> “/path/to/org/archive/")
>  org-shiftup-final-hook '(windmove-up)
>  org-blocker-hook '(org-block-todo-from-checkboxes
> org-block-todo-from-children-or-siblings-or-parent)
>  org-archive-location "archive/%s_archive.gpg::"
>  org-super-agenda-mode t
>  org-mode-hook '(add-pcomplete-to-capf org-bullets-mode org-tempo-setup
>  #[0 "\300\301\302\303\304$\207"
>[add-hook change-major-mode-hook org-show-all append 
> local] 5]
>  ob-ipython-auto-configure-kernels
>  #[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
>  #[0 "\301\211\207" [imenu-create-index-function 
> org-imenu-get-tree]
>2]
>  org-eldoc-load)
>  org-outline-path-complete-in-steps nil
>  org-archive-hook '(org-attach-archive-delete-maybe)
>  org-confirm-elisp-link-function 'yes-or-no-p
>  org-agenda-finalize-hook '(ap/org-super-agenda-origami-fold-default
> gs/org-agenda-project-highlight-warning
> #[0 "\300ed\301#\207"
>   [remove-text-properties (mouse-face t)] 4]
> )
>  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-shiftdown-final-hook '(windmove-down)
>  org-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning)
>  (0.5 . org-upcoming-deadline)
>  (0.0 . org-upcoming-distant-deadline))
>  org-track-ordered-property-with-tag t
>  org-babel-pre-tangle-hook '(save-buffer)
>  org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" 
> . default)
>  ("\\.pdf\\'" . default) ("\\.jpg\\'" . system) ("\\.JPG\\'" 
> . system)
>  ("\\.png\\'" . system) ("\\.PNG\\'" . system))
>  org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
> org-babel-header-arg-expand)
>  org-hide-leading-stars t
> 

Re: org table integrity

2020-02-02 Thread John Kitchin
This is a little tricky to guarantee; there are just so many ways to edit a
table.

One way to do this is like the following. The idea is to use the
org-cycle-hook to check the last cell you were in when you pressed TAB in a
table. This of course does not work if you don't use tab, and in its
current form does not work on shift-tab.  You set an #+attr_org line to
have list of predicate functions for each column. stringp is tricky, all
the cells are strings, so I tried a regexp for numbers. numberp is also not
quite right, for me "1a" converts to 1. This code is pretty lightly tested,
so tread warily!

I had to add the advice for some reason. I don't know why, but it appears
to me the org-cycle-hook does not get run inside org-cycle. I don't think
this should be necessary, but it was to test this out.

Here is the code. After you run it, each time you tab through the table,
you should see some messages telling you what was tested, and some of them
should cause an error with a message about it.

#+BEGIN_SRC emacs-lisp
(defun org-timestamp-p (contents)
  "Return non-nil if CONTENTS is a legal org timestamp"
  (with-temp-buffer
(insert contents)
(goto-char (point-min))
(re-search-forward org-element--timestamp-regexp nil t)))

(defun check-table-integrity (_state)
  (interactive)
  ;; get previous contents
  (let* ((column)
(element (org-element-context))
(attr)
(funcs)
(field)
(valid))

(while (and (org-at-table-p) (not (eq 'table (car element)))
(setq element (org-element-property :parent element

(when (eq 'table (car element))

  (setq attr (car (org-element-property :attr_org element))
   funcs (plist-get (read (format "(%s)" attr)) :types))

  (save-excursion
(org-table-previous-field)
(setq column (org-table-current-column)
 func (nth (- column 1) funcs)
 field (org-table-get-field)
 valid (funcall (eval func) (s-trim field)))

(message "checking %s field with %s" field func)

;; this is a little tricky. valid is non-nil, and 0 is considered non-nil
(unless valid
 (error "%s did not pass %s" field func))


(add-hook 'org-cycle-hook 'check-table-integrity)

(advice-add 'org-cycle :after (lambda (x) (cl-loop for func in
org-cycle-hook
  do (funcall func ""
#+END_SRC

#+RESULTS:

#+attr_org: :types ('org-timestamp-p (lambda (x) (string-match-p "[0-9]+"
x)) 'stringp)
| [2020-02-02 Sun] |  1 | no  |
| [2020-02-09 Sun] | no | yes |
| not a ts |  3 | 3   |

An alternative way to do this might be to have a function that runs when
you leave a table, then it could validate the cells in a similar way. The
easy way to do this is with a post-command hook, but this is hard to do
without performance hits. The harder way to do it is with cursor sensor
functions, but this requires a hack on font-lock for tables. A final way is
to make a save/kill-buffer hook function that would map over each table and
validate them before allowing the save/kill to complete.



John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Sat, Feb 1, 2020 at 9:09 PM Jude DaShiell  wrote:

> Does a way exist in orgmode to fix a column so that it only stores time
> stamps?  A table I'm using has two columns that could this kind of error
> protection and two that should contain text.
>
>
>
> --
>
>
>


Re: A new, "org-bullets"-like minor mode

2020-02-02 Thread D


> I haven't looked at the code yet but would it make sense for your new
> mode just being renamed to "org-bullet" instead? Do you expect that
> some current users won't want to update?

I have been considering that, but decided against replacing org-bullets
(or calling the package something akin to org-bullets+) for two reasons:
1) For the things I have/had in mind I would not have wanted to ensure
backwards-compatibility.

I would hate to see long-time users of org-bullets to experience
breakage because of design decisions I made.  I think that there is a
lot of value in keeping a straightforward package with a singular goal
for people that want exactly that.  While I made sure to ease the pain
of transitioning for people interested, I would not want to touch it
beyond maintenance.  From what I know, spacemacs ships with it for
example, so I would not like to cause anything downstream without warning.

2) While there are perfectly valid reasons to name a package similar to
another ("xpackage", "packagex", "package+", "pakG", ...) I personally
shy away from the practice to avoid confusion.  LaTeX packages are
notorious for this, and their overuse of this convention has led to many
frustrating afternoons for me in the past years.

> If you want to stick with creating a new mode, are there any bug fixes
> that you could backport to "org-bullet"?

I am sincerely considering to help maintain the project, to "adopt" it
from the orphanage, should org-superstar gain any popularity.  I will
gladly port anything technical (bugfixes, plausible performance patches)
I can to org-bullets if requested, but I would not add features.
However, I hesitate to immediately pick up the role of maintaining
org-bullets for the simple reason that I'd first like to have a project
of my own to show for myself, as a proof of responsibility if you will.

> I don't actually use it myself and just enable it temporarily if someone
> reports a bug or something.  It's not that I am not interested in
> something like this package, but from the sound of it I would rather use
> your package than the old "org-bullet".

If you find the time to check out my package, I am always open for
criticism and suggestions.  Seeing how young the package is I am very
open to adding features and making quality of life improvements to the
interfaces.

> If I remember correctly it, then it took some effort to contact sabof,
> but eventually they gave their blessing.

I sent sabof a mail via the Github address, if you have any means of
communication with him, would you mind sharing them?





Re: A new, "org-bullets"-like minor mode

2020-02-02 Thread Jonas Bernoulli


> Much like org-bullets-mode, the new mode (dubbed
> "org-superstar-mode" for the time being) visually replaces headline
> stars with UTF8 bullets.  However, while I took the code of org-bullets
> as an initial template, I have largely rewritten the code base for lots
> of additional features

I haven't looked at the code yet but would it make sense for your new
mode just being renamed to "org-bullet" instead? Do you expect that some
current users won't want to update?

If you want to stick with creating a new mode, are there any bug fixes
that you could backport to "org-bullet"?

> However, since the mode still contains code snippets from org-bullets, I
> have tried to contact the original author (sabof) of the package in the
> hopes of getting an official approval before making the thing public.
> The problem with /that/ however is that the author has been inactive for
> several years now, with the package being maintained by Jonas Bernoulli,
> who I did not yet contact.

I don't actually use it myself and just enable it temporarily if someone
reports a bug or something.  It's not that I am not interested in
something like this package, but from the sound of it I would rather use
your package than the old "org-bullet".

If I remember correctly it, then it took some effort to contact sabof,
but eventually they gave their blessing.

  Jonas



Re: Provide org-insert-subitem

2020-02-02 Thread Adam Porter
Bastien  writes:

> `org-insert-subheading' and `org-insert-todo-subheading' are not used
> anywhere in Org's code.  Do you them?  How?
>
> I'm more inclined to delete these commands since they have no binding
> than to add an `org-insert-subitem'.
>
> Hitting  then  seems swift and handy enough.

Please do not delete org-insert-subheading!  I use it every day and have
for years.  :) It would be much less convenient to have to use two
commands.

BTW, in my version of Org, org-insert-subheading works on both list
items and subheadings, so there's no need for a separate
org-insert-subitem command:

  Insert a new subheading and demote it.
  Works for outline headings and for plain lists alike.




Re: org-superstar-mode: A re-imagining of org-bullets with new features

2020-02-02 Thread Adam Porter
Hi D,

This looks fantastic!  Great work!  I sent you a quick suggestion on the
issue tracker.  Let's get this on MELPA ASAP!  :)




Re: [BUG] Tags misalign while editing heading

2020-02-02 Thread Bastien
Dmitrii Korobeinikov  writes:

> Sure, filed it here
>
> https://github.com/emacs-evil/evil/issues/1264

Thanks!

-- 
 Bastien



Re: Strangely recognized non-lists and non-headers.

2020-02-02 Thread D
> You need to escape them with commas.

Ah, I overlooked that because I did not check the manual whether leading
stars are escaped automatically and just assumed it, sorry.  Thanks a lot!

Though, there is one minor thing I noticed:

Leading stars are valid comment symbols in Fortran, as long as they are
the first character in the line.  They are recognized in SRC fortran
blocks when the star is unescaped, but not when the star is escaped, meaning
#+BEGIN_SRC fortran
,***
,* a valid comment
,**
#+END_SRC
 is displayed with the org-block face instead of the usual
font-lock-comment-face.




Re: [BUG] Infinite loop in org-agenda-show-new-time

2020-02-02 Thread Andrew Hyatt
On Sat, Feb 1, 2020 at 4:33 AM Bastien  wrote:

> Hi Andrew,
>
> Andrew Hyatt  writes:
>
> > I've been having this same issue - the issue is quite reproducible
> > for me, and it has been for years.  I just finally grew tired of the
> > issue and decided to investigate it, and yes, the issue is
> > org-agenda-show-new-time.
> >
> > I also have invisible entries in the org buffer, and the call to
> > org-move-to-column apparently will move several lines forward, which
> > causes us to process the same lines over and over.
> >
> > Wrapping the call to org-move-to-column with a let setting the
> > buffer-invisibility-spec to nil does fix the issue.
>
> this problem is from... 2013!
> https://lists.gnu.org/archive/html/emacs-orgmode/2013-08/msg00218.html
>
> Is there anything we still need to fix in this area?  If so, can you
> send it as a patch against current maint branch?
>

Yes, there's definitely still a problem similar to the one reported -
although I have yet to pare it down to a reproducible case.
I need to look at this more to understand why the fix that was done doesn't
seem to work.  Once I understand that, I'll be close to creating a patch.
The issue is that I don't know this code very well, so any fix I make might
be wrong for some other reason I don't understand.


>
> Thanks,
>
> --
>  Bastien
>


Re: Strangely recognized non-lists and non-headers.

2020-02-02 Thread Nicolas Goaziou
D  writes:

> On 02.02.20 12:59, Nicolas Goaziou wrote:
>> Long story short. Don't use this function, it is not correctly
>> implemented at the moment. The correct way to check if you're in a list
>> is something like:
>> 
>>   (org-element-lineage (org-element-at-point) '(plain-list) t)
>
> I tried that out, but it still seems to recognize source code as
> headlines, replacing the predicate does not change the behavior.

Of course. You cannot have headlines within a source block. You need to
escape them with commas. I'm just pointing out that the code above is
the right way to check if you're in a list.



Re: [RFC PATCH] specify a time, not number of minutes to keep, with org-resolve-clock

2020-02-02 Thread Bastien
Hi Dan,

Dan Drake  writes:

> I'm willing to assign copyright to the FSF, make my
> contribution public domain, or whatever is most convenient and
> easiest to get this into org.

Thanks!  My understanding is that your contribution has already been
added to org-mode, which is fine.

To assign your copyright to the FSF for future contributions, you can
follow the instructions here:

https://code.orgmode.org/bzg/org-mode/raw/master/request-assign-future.txt

Best (and hello from the OLPC old days!)

-- 
 Bastien



Re: [RFC PATCH] specify a time, not number of minutes to keep, with org-resolve-clock

2020-02-02 Thread Dan Drake
I just wanted to add that I have no real opinion one way or the other on
the TINYCHANGE bit; I was just following what I found at
https://orgmode.org/worg/org-contribute.html.

I also have no strong opinion on how copyright should be handled for this.
I'm willing to assign copyright to the FSF, make my contribution public
domain, or whatever is most convenient and easiest to get this into org.

Regards,

Dan


On Sat, Feb 1, 2020 at 10:48 AM Nicolas Goaziou 
wrote:

> Bastien  writes:
>
> > Future maintainers may of course interpret the recommendations of
> > the FSF differently, but that's mine for now.
>
> Of course, sir.
>


-- 
Ceci n'est pas une .signature.


Re: Strangely recognized non-lists and non-headers.

2020-02-02 Thread D
Hi,

On 02.02.20 12:59, Nicolas Goaziou wrote:
> Long story short. Don't use this function, it is not correctly
> implemented at the moment. The correct way to check if you're in a list
> is something like:
> 
>   (org-element-lineage (org-element-at-point) '(plain-list) t)

I tried that out, but it still seems to recognize source code as
headlines, replacing the predicate does not change the behavior.  It
seems to be something more deeply rooted than that, I mean, otherwise
org mode wouldn't try to collapse those fake-headlines when hitting TAB,
either.

Regards,

D.



Re: Strangely recognized non-lists and non-headers.

2020-02-02 Thread Nicolas Goaziou
Hello,

D  writes:

> I use org-list-in-valid-context-p as a quick hack to check if what I am
> looking at is actually a list.  

Long story short. Don't use this function, it is not correctly
implemented at the moment. The correct way to check if you're in a list
is something like:

  (org-element-lineage (org-element-at-point) '(plain-list) t)


Regards,

-- 
Nicolas Goaziou



Bug (with fix): org-tempo-add-block incorrectly inserts comma before next `#+begin_src' during expansion [9.3.2 (9.3.2-8-g47b104-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20200127/)]

2020-02-02 Thread Bram Adams
Hi,

I encountered a bug in org-tempo-add-block, where the following snippet in an 
org file (with “’ on line 125 of 
org-tempo.el:
===
(defun org-tempo-add-block (entry)
  "Add block entry from `org-structure-template-alist'."
  (let* ((key (format "<%s" (car entry)))
 (name (cdr entry))
 (special (member name '("src" "export"
(tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" 
name))
   `(,(format "#+begin_%s%s" name (if special " " ""))
 ,(when special 'p) '> n '> ,(unless special 'p) n 
;; <—— line 125
 ,(format "#+end_%s" (car (split-string name " ")))
 >)
   key
   (format "Insert a %s block" name)
   'org-tempo-tags)))
===

Removing the second `’>’ on line 125 fixes the issue.

Kind regards,

Bram Adams


===
===
===

Emacs  : GNU Emacs 26.3 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 
AppKit 1561.6)
 of 2019-08-29
Package: Org mode version 9.3.2 (9.3.2-8-g47b104-elpaplus @ 
~/.emacs.d/elpa/org-plus-contrib-20200127/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-fontify-whole-heading-line t
 org-refile-target-verify-function 'verify-refile-target
 org-agenda-scheduled-leaders '("Sch.: " "Sch.%2dx: ")
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-after-execute-hook '(org-redisplay-inline-images)
 org-tempo-keywords-alist nil
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-refile-targets '((nil :maxlevel . 4) (filter_out_cal :maxlevel . 4))
 org-enforce-todo-dependencies t
 org-edit-src-content-indentation 0
 org-src-tab-acts-natively t
 org-special-ctrl-a/e t
 org-agenda-files '(“/path/to/org/"
“/path/to/org/archive/")
 org-shiftup-final-hook '(windmove-up)
 org-blocker-hook '(org-block-todo-from-checkboxes
org-block-todo-from-children-or-siblings-or-parent)
 org-archive-location "archive/%s_archive.gpg::"
 org-super-agenda-mode t
 org-mode-hook '(add-pcomplete-to-capf org-bullets-mode org-tempo-setup
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-all append local] 
5]
 ob-ipython-auto-configure-kernels
 #[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
 #[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree]
   2]
 org-eldoc-load)
 org-outline-path-complete-in-steps nil
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-finalize-hook '(ap/org-super-agenda-origami-fold-default
gs/org-agenda-project-highlight-warning
#[0 "\300ed\301#\207"
  [remove-text-properties (mouse-face t)] 4]
)
 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-shiftdown-final-hook '(windmove-down)
 org-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning)
 (0.5 . org-upcoming-deadline)
 (0.0 . org-upcoming-distant-deadline))
 org-track-ordered-property-with-tag t
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . 
default)
 ("\\.pdf\\'" . default) ("\\.jpg\\'" . system) ("\\.JPG\\'" . 
system)
 ("\\.png\\'" . system) ("\\.PNG\\'" . system))
 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) (sql . t) (shell . t) (dot . t) (sqlite . t)
(perl . t) (ditaa . t) (ipython . t) (python . t)
(applescript . t) (emacs-lisp . t))
 org-shiftright-final-hook '(windmove-right)
 org-agenda-time-grid '((daily today remove-match) (800 1200 1600 2000) ".."
"")
 org-log-done 'time
 org-highlight-latex-and-related '(latex)
 org-ellipsis " ↴"
 org-use-fast-todo-selection t
 org-fast-tag-selection-single-key 'expert
 org-src-lang-modes '(("jupyter-python" . python) ("arduino" . arduino)
  ("redis" . redis) ("php" . php) ("ipython" . python) ("C" 
. c)
  ("C++" . c++) ("asymptote" . asy) ("bash" . sh)
  ("beamer" . 

Bug: org-indent-region doesn't restore cursor position when org-src-tab-acts-natively is t [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]

2020-02-02 Thread Sébastien Miquel

Given the following src block in org-mode:

#+BEGIN_SRC emacs-lisp
(defun my-function ()
  (instruction1)
  (instruction2)
;;  (instruction3)
  )
#+END_SRC

Steps to reproduce (with emacs -Q):
 1) set org-src-tab-acts-natively to t
 2) set the mark at the beginning of the function definition inside the 
src block

 3) move point to the last line of the src block
 4) call org-indent-region

Effect: the code is indented, but the cursor is moved to first line of
the block.

Expected: the code is indented, and the cursor doesn't move.

Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10)
 of 2019-08-29
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/usr/share/emacs/26.3/lisp/org/)


current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
         org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 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]
         org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 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-tab-first-hook '(org-babel-hide-result-toggle-maybe
          org-babel-header-arg-expand)
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
          org-cycle-show-empty-lines
          org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
              org-babel-speed-command-activate)
 org-confirm-shell-link-function 'yes-or-no-p
 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))
 )




Re: [BUG] Tags misalign while editing heading

2020-02-02 Thread Dmitrii Korobeinikov
Hi Bastien,

Sure, filed it here

https://github.com/emacs-evil/evil/issues/1264

Best,
Dmitrii

вс, 2 февр. 2020 г. в 03:30, Bastien :
>
> Hi Dmitrii,
>
> Dmitrii Korobeinikov  writes:
>
> > Oh, I forgot about the "-Q"... Anyway, I figured the behavior is
> > present with evil-mode.
> >
> > Here's is how to launch a clean evil environment:
> >
> > $ git clone https://github.com/emacs-evil/evil
> > $ cd evil
> > $ make emacs
> >
> > Should I file a bug in the evil tracker?
>
> Yes, probably.  Thanks for the follow-up if any,
>
> --
>  Bastien



Re: Command to edit the heading?

2020-02-02 Thread Dmitrii Korobeinikov
Hi, Bastien,

Well, the idea was to have consistency, since there's already
org-set-tags. But org-set-tags is useful for completion, which can't
be said of the title.
So I think you are right, plain editing is sufficient. Especially now
that I have written a goto-heading function, it's hasn't been a big
deal since then.

Best,
Dmitrii

вс, 2 февр. 2020 г. в 03:31, Bastien :
>
> Hi Dmitrii,
>
> Dmitrii Korobeinikov  writes:
>
> > There is the org-set-tags for tags, but is there anything for the
> > title (org-set-heading/title)?
> > Would be nice to have.
>
> When would it be more useful than editing the headline directly?
>
> From an agenda view?
>
> --
>  Bastien



Re: Provide org-insert-subitem

2020-02-02 Thread Dmitrii Korobeinikov
Hi, Bastien,

> `org-insert-subheading' and `org-insert-todo-subheading' are not used
> anywhere in Org's code.  Do you them?  How?

I use them as intended: for convenience. Basically, I have a binding for this:

  (defun my/insert-heading ()
(interactive)
(end-of-line)
(cond
 ((string-match (rx (and bol (0+ white) "- [")) (thing-at-point
'line t)) (command-execute 'org-insert-todo-heading))
 ((string-match (rx (and bol (0+ white) "-")) (thing-at-point
'line t)) (command-execute 'org-insert-item))
 (t (if (my/org-heading-collapsed-p) (evil-open-below 1))
(command-execute 'org-insert-heading) (evil-normal-state

and a similar function for sub-things. This makes it very easy to
insert (sub)headings/items/todo-items, all with just two bindings.

> Hitting  then  seems swift and handy enough.

Sometimes that would have to bewhen the
items in the list are seperated with a newline. That's an awful lot of
combinations for such a basic task, which I do quite often.

> WDYT?

To me, these functions seem fundamental enough to warrant the
according out-of-the-box experience.

Best,
Dmitrii

вс, 2 февр. 2020 г. в 13:49, Bastien :
>
> Hi Dmitrii,
>
> Dmitrii Korobeinikov  writes:
>
> > In short:
> > org-insert-heading -> org-insert-subheading
> > org-insert-todo-heading -> org-insert-todo-subheading
> > org-insert-item -> ?
> >
> > Maybe should provide org-insert-subitem for consistency?
>
> `org-insert-subheading' and `org-insert-todo-subheading' are not used
> anywhere in Org's code.  Do you them?  How?
>
> I'm more inclined to delete these commands since they have no binding
> than to add an `org-insert-subitem'.
>
> Hitting  then  seems swift and handy enough.
>
> WDYT?
>
> --
>  Bastien



Strangely recognized non-lists and non-headers.

2020-02-02 Thread D
Hi all,

while debugging org-superstar-mode I noticed something very strange, and
I am not sure if it's a bug in org or a bug in my understanding of org.

First off, an MWE for Org mode version 9.1.9 (release_9.1.9-65-g5e4542):

#+BEGIN_SRC C
/*
* This is a header?
  + this
+ is
  * a list?
*/
#+END_SRC

This works. I can promote, demote, fold, etc.  org-superstar also has no
issue with accepting these.  I should add, this is the default config
(emacs -Q on Emacs 26.3).  So no spooky stuff I believe on that end.
So I began digging.

I use org-list-in-valid-context-p as a quick hack to check if what I am
looking at is actually a list.  Said predicate is a simple wrapper
around the function org-in-block-p being called with
org-list-forbidden-blocks.  It is the the list of environments where
lists are not allowed.

Value: ("example" "verse" "src" "export")

There is also a very similar variable: org-protecting-blocks.  This one
marks environments as quoted, disallowing org syntax.

Value: ("src" "example" "export")

Currently these two variables don't know of one another.  Maybe the
latter should be a strict subset of the former?

Anyway, from what I have found org-in-block-p seems to not recognize src
blocks reliably.  I wrote a small function to test this:

(defun nag ()
  (interactive)
  (when (org-list-in-valid-context-p)
(warn "You can make a list here! :(")))

And it seems, yes, you can make a list in a src block.
That's all very peculiar, what do you guys think?



Templating of PDF export

2020-02-02 Thread Florian Lindner
Hello,

I am collecting my cooking recipes in an org-mode file. While that
certainly works for, I would like to have a nice LaTeX export for
non-nerd mortals to look at. All recipes are in one file and each one
looks like:

* Pancakes
** Ingredients
+ 6 Eggs
+ 3 Apples
** Directions
Just do it!
** Source
My mother

Sometimes I take a photo of the meal and ATTACH it.

Most guides how to customize org export are about modifying the document
class and latex snippets there there. However, the basic association
with * Pancakes -> \section, ** Ingredients -> \subsection stays the same.

Is there something builtin org-mode which allows to use a templating
language that allows for a more freely combination of elements, similar
to Jinja or alike?

For example, I want to embed the attachment in the export, appropriately
scaled and nicely placed and have a line break after each recipe.

I know about org-chef, but AFAIK it's more about importing templates
from websites, not about a nice export.

Any ideas for that?

Thanks!
Florian