Re: org-attach a directory?

2021-06-09 Thread Ypo

C-c C-a

s

(not "S" like in the video, but "s")

El 10/06/2021 a las 1:39, John Kitchin escribió:

can you give an example of those commands, I tried the key commands

C-c C-a which opens the dispatcher
s to set a directory
then C-c C-a z to sync, but it did not do anything but add a :DIR: 
property. it didn't move or copy files anywhere.


Here is the code I am currently using that basically does what I want.

(defun scimax-org-attach-attach-directory-cp (dir)
  "Copy DIR as an attachment to the current heading."
  (interactive "DDir: ")
  (copy-directory dir (file-name-as-directory (org-attach-dir 
'get-create)))

  (org-attach-sync)
  (org-entry-put (point) "ATTACHMENTS"
(concat
 (org-entry-get (point) "ATTACHMENTS")
 (format " [[attachment:%s]]" (car (last (f-split dir)))


(defun scimax-org-attach-attach-directory-mv (dir)
  "Move DIR as an attachment to the current heading."
  (interactive "DDir: ")
  (scimax-org-attach-attach-directory-cp dir)
  (delete-directory dir t t))


John

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



On Wed, Jun 9, 2021 at 3:35 PM Ypo > wrote:


Firstly you set the folder where your files are as attachment
DIRectory.

Then, you set your target attachment DIRectory (always using the
attachment commands).

After doing this, you will be offered the option to copy and
delete all the files from the former to the target folder.

Hugs



Re: org-attach a directory?

2021-06-09 Thread Ypo

Hi John :-)

Take a look:

https://mega.nz/file/hKgECBqY#8UVEURWQBvDpno9DPEk8gb8E-zxAJq3F3E8Y9I9xRFk


El 10/06/2021 a las 1:39, John Kitchin escribió:

can you give an example of those commands, I tried the key commands

C-c C-a which opens the dispatcher
s to set a directory
then C-c C-a z to sync, but it did not do anything but add a :DIR: 
property. it didn't move or copy files anywhere.


Here is the code I am currently using that basically does what I want.

(defun scimax-org-attach-attach-directory-cp (dir)
  "Copy DIR as an attachment to the current heading."
  (interactive "DDir: ")
  (copy-directory dir (file-name-as-directory (org-attach-dir 
'get-create)))

  (org-attach-sync)
  (org-entry-put (point) "ATTACHMENTS"
(concat
 (org-entry-get (point) "ATTACHMENTS")
 (format " [[attachment:%s]]" (car (last (f-split dir)))


(defun scimax-org-attach-attach-directory-mv (dir)
  "Move DIR as an attachment to the current heading."
  (interactive "DDir: ")
  (scimax-org-attach-attach-directory-cp dir)
  (delete-directory dir t t))


John

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



On Wed, Jun 9, 2021 at 3:35 PM Ypo > wrote:


Firstly you set the folder where your files are as attachment
DIRectory.

Then, you set your target attachment DIRectory (always using the
attachment commands).

After doing this, you will be offered the option to copy and
delete all the files from the former to the target folder.

Hugs



Re: org-attach a directory?

2021-06-09 Thread John Kitchin
can you give an example of those commands, I tried the key commands

C-c C-a which opens the dispatcher
s to set a directory
then C-c C-a z to sync, but it did not do anything but add a :DIR:
property. it didn't move or copy files anywhere.

Here is the code I am currently using that basically does what I want.

(defun scimax-org-attach-attach-directory-cp (dir)
  "Copy DIR as an attachment to the current heading."
  (interactive "DDir: ")
  (copy-directory dir (file-name-as-directory (org-attach-dir 'get-create)))
  (org-attach-sync)
  (org-entry-put (point) "ATTACHMENTS"
(concat
 (org-entry-get (point) "ATTACHMENTS")
 (format " [[attachment:%s]]" (car (last (f-split dir)))


(defun scimax-org-attach-attach-directory-mv (dir)
  "Move DIR as an attachment to the current heading."
  (interactive "DDir: ")
  (scimax-org-attach-attach-directory-cp dir)
  (delete-directory dir t t))


John

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



On Wed, Jun 9, 2021 at 3:35 PM Ypo  wrote:

> Firstly you set the folder where your files are as attachment DIRectory.
>
> Then, you set your target attachment DIRectory (always using the
> attachment commands).
>
> After doing this, you will be offered the option to copy and delete all
> the files from the former to the target folder.
>
> Hugs
>


Re: literate programming, development log -- ideas? (ominbus reply)

2021-06-09 Thread Dr. Arne Babenhauserheide

Eric S Fraga  writes:

>> Not sure if it counts as off-topic for this thread, but does everyone
>> use Git to manage their Org docs and notes?
>
> I use a variety of version control systems but for multiple computers I
> use unison to keep them all synchronised.

I use Mercurial for all my private versiontracking.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken


signature.asc
Description: PGP signature


Re: org-attach a directory?

2021-06-09 Thread Ypo
Firstly you set the folder where your files are as attachment DIRectory.

Then, you set your target attachment DIRectory (always using the attachment 
commands).

After doing this, you will be offered the option to copy and delete all the 
files from the former to the target folder.

Hugs


Re: [PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-09 Thread Timothy


Nicolas Goaziou  writes:

> Sure, LGTM!

Cool :) Merged.

Now the only other LaTeX PR I may poke you about in the future is the
latexmk one :P

--
Timothy



[BUG] org-return does not honor delete-selection-mode [9.4.6 (release_9.4.6-551-gf70e36 @ /home/gustavo/.emacs.d/lib/org-mode/lisp/)]

2021-06-09 Thread Gustavo Barros

Hi All,

`org-return' currently does not honor `delete-selection-mode'. An ECM to 
reproduce it is the following.


Start `emacs -Q' and do some setup:
#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/lib/org-mode/lisp")
;; Org repo at commit f70e36252
(load-library "org")
(org-version); => "9.4.6"
(delete-selection-mode 1)
(org-mode)
#+end_src

Now select a region and type "RET". The newline is indeed inserted, but 
the selected region is not deleted, as would be expected. To compare, 
select some region again and type "a".


I don't know when this came to be, but the above ECM was tested on the 
current master. The issue is also present for me in the built-in version 
of Emacs 27.2, Org 9.4.4.


Best regards,
Gustavo.



Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.20, cairo version 1.16.0)

of 2021-03-25
Package: Org mode version 9.4.6 (release_9.4.6-551-gf70e36 @ 
/home/gustavo/.emacs.d/lib/org-mode/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-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-mode-hook '((closure
  (org--rds reftex-docstruct-symbol
   org-element-greater-elements 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-blocked-by-checkboxes

   org-state org-agenda-headline-snapshot-before-repeat
		   org-agenda-start-on-weekday 
		   org-agenda-buffer-tmp-name

   org-priority-regexp org-mode-abbrev-table
		   org-mode-syntax-table 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
   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-id-overriding-file-name
   org-indent-indentation-per-level
		   org-element-paragraph-separate 
		   org-inlinetask-min-level t)

  nil
		  (add-hook 'change-major-mode-hook 'org-show-all 
		  'append

   'local)
  )
 (closure
  (org-src-window-setup *this*
   org-babel-confirm-evaluate-answer-no
   org-babel-tangle-uncomment-comments
   org-src-preserve-indentation org-src-lang-modes
		   org-edit-src-content-indentation 
		   org-babel-library-of-babel

   t)
  nil
  (add-hook 'change-major-mode-hook
   #'org-babel-show-result-all 'append 'local)
  )
 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 '(closure
   (org-id-locations
org-agenda-search-view-always-boolean
org-agenda-overriding-header t)
   (entry) (cdr (assq :title 
   entry)))

org-babel-pre-tangle-hook '(save-buffer)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
org-agenda-loop-over-headlines-in-active-region nil
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-export-before-parsing-hook '(org-attach-expand-links)
org-confirm-shell-link-function 'yes-or-no-p
org-link-parameters '(("attachment" :follow org-attach-follow :complete

Re: [org-cite, oc-basic] configurable open-at-point, font-locking when json?

2021-06-09 Thread Nicolas Goaziou
Hello,

"Bruce D'Arcus"  writes:

> Given how common existing functions are that take a list of keys, WDYT
> about adding something like a `org-cite-get-references-keys` helper
> function, to parallel `org-cite-get-references`?
>
> So in this case one could do:
>
> (bibtex-completion-open-any (org-cite-get-references-keys datum)))

Fair enough. I added an optional KEYS-ONLY argument to
`org-cite-get-references' doing just that.

Regards,
-- 
Nicolas Goaziou



Re: [PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-09 Thread Nicolas Goaziou
Timothy  writes:

> If what I've said above makes sense, I think it would be good to merge
> 👍.

Sure, LGTM!

Regards,



Re: literate programming, development log -- ideas? (ominbus reply)

2021-06-09 Thread Maxim Nikulin

On 09/06/2021 00:21, Samuel Banya wrote:


I've noticed that some times after git merge events across a few 
machines (ex: I forgot I had already pushed notes for my private notes 
on one machine, and had to merge the results from another machine), I'll 
get weird "HEAD" and "END" statements inserted by Git.


Likely you are writing about merge conflicts. They are not weird, it is 
just necessary to resolve them manually and commit clean variant. There 
is no general way to guess what particular user mean when some file in 
different branches has been modified at the same places. See e.g.

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#_basic_merge_conflicts

I remember one case when *clean* merge resulted in JS file that was 
syntactically correct but actually had broken code. It is extremely rare 
accident.



On Tue, Jun 8, 2021, at 1:15 PM, Greg Minshall wrote:

Eric, when you use something RCS-like as your version control system, i
assume that makes grepping to find some old note easy enough.  but,
these days i tend to use git.  when (assuming) you use git, do you have
some easy way to say "well, i had this code that looked sort of like
this... where was it?"?  (sorry, that's really a git question, but ...)


There is "git log -Gpattern" option that allows to search for code 
changes. Do not confuse it with "--grep" that is for commit messages. 
"git gui blame file" can show file state before some line was changed. 
Probably magit has a similar command.





Re: [PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-09 Thread Timothy


Nicolas Goaziou  writes:

> I agree there is no good reason to hard-code "\ref", but, off the top of
> my head, there may be a couple of things to consider:
>
> 1. There is still a dangling \ref in `org-latex-footnote-defined-format';

I noticed this, but looking at the usage I think the user would be
surprised if changing \ref for sections, figures etc. also changed how
footnotes looked.

> 2. This change is already somewhat trivial using a link filter:
>
>  (defun my-ref-link-filter (s &rest _)
>(replace-regexp-in-string (rx string-start "\\ref") "\\foo" s nil t))
>
>  (add-to-list 'org-export-filter-link-functions #'my-ref-link-filter)

As are many things :P but I think it's worth making some more obvious to
users, and IMO this is worth it.

> 3. \hyperref is still hard-coded in `org-latex-link'; your patch could
>look like a partial solution.

A reference with a named description does use hyperref, but I think
that would still be expected --- let me know if you think otherwise
though.

> Those are not strong objections, so if you think none of them is worth
> considering, then I'm fine with your patch.

If what I've said above makes sense, I think it would be good to merge 👍.

All the best,

Timothy.



Re: HTML export uses anchor ids which change on every export

2021-06-09 Thread Nicolas Goaziou
Hello,

Spencer Baugh  writes:

> Nicolas Goaziou  writes:
>> No, for public links, CUSTOM_ID is the only sane way to handle this.
>> Even "sec-2" could betray you if you slightly modify the document.
>
> I understand and agree. However, "sec-2" is strictly better than the
> current situation in terms of link stability: There are many document
> modifications that don't change "sec-2", and there are no document
> modifications that don't change the current id format.
>
> If some user likes link stability a litle bit, but not enough to add
> CUSTOM_ID to every single heading, then providing some option to
> generate ids like "sec-2", which are stable in some situations for very
> little cost, is good for that user.

I disagree. "sec-2" is not "strictly better". Actually, long ago, Org
used "sec-2", or "outline-2", but we got bug reports about that (in
particular, it broke publishing) too. A weaker poison is no healthier.

Please note that, if you're exporting again and again the same document,
you ought to publish it, in which case referenced links are stable.

Also, not too long ago, Timothy had a different suggestion for the
internal link stability problem. One idea to move forward could be to
provide a defcustom to let users use whatever function they want to
generate internal links. I think, however, it might be tricky to have
that function handle properly duplicates.

Regards,
-- 
Nicolas Goaziou



Re: bug#47885: [PATCH] org-table-import: Make it more smarter for interactive use

2021-06-09 Thread Maxim Nikulin

On 06/06/2021 00:50, Utkarsh Singh wrote:

On 2021-06-05, 19:40 +0700, Maxim Nikulin wrote:


This line should be added to org-table.el, but notice "rx ‘not’ syntax
error: (or ". This logical operators have a bit different meaning for
regular expression.


I just "tested" most of them by M-x eval-buffer on
the patched file and then checked the output of `with-temp-buffer'.


I get "Eager macro-expansion failure: (error "rx ‘not’ syntax error: (or 
10 32)")" even in response to M-x eval-buffer.



After reading FAQ about multiple lines in table field I don't think this
PATCH makes much sense as my main driving force for this patch was to
simplify regular expression in `org-table-convert-region' and somehow
add newlines support.


You may check whether csv-mode have got support of newline inside cell 
already and try to sell your parser to them.


There are regular discussions how wonderful it would be to extend org 
table syntax. In my opinion org spreadsheet is overloaded already. On 
the other hand, newline in table cell sometimes is really useful. I have 
seen an idea to put some macro to single-line cell that expands to 
format-specific representation during export ({{{nl}}} =>  in the 
case of HTML). Such macro does not require extension of syntax, so it 
may be viable at least in user configuration.



P.S. Have you read "Structure and Interpretation of Computer Programs"

I also tried Racket after reading:


SICP is dedicated to general concepts rather than to particular 
language, that is why I consider it as a "special case".






Re: [PATCH] Allow LaTeX reference command (\ref) to be customised

2021-06-09 Thread Nicolas Goaziou
Hello,

Timothy  writes:

> I'm wondering if you've had a chance to take a look yet? (just making
> sure this hasn't slipped by, given your recent replies in other
> threads).

I agree there is no good reason to hard-code "\ref", but, off the top of
my head, there may be a couple of things to consider:

1. There is still a dangling \ref in `org-latex-footnote-defined-format';

2. This change is already somewhat trivial using a link filter:

 (defun my-ref-link-filter (s &rest _)
   (replace-regexp-in-string (rx string-start "\\ref") "\\foo" s nil t))

 (add-to-list 'org-export-filter-link-functions #'my-ref-link-filter)

3. \hyperref is still hard-coded in `org-latex-link'; your patch could
   look like a partial solution.

Those are not strong objections, so if you think none of them is worth
considering, then I'm fine with your patch.

Regards,
-- 
Nicolas Goaziou



Re: [org-cite, oc-basic] configurable open-at-point, font-locking when json?

2021-06-09 Thread Bruce D'Arcus
On Tue, Jun 8, 2021 at 4:25 PM Nicolas Goaziou  wrote:
>
> Hello,
>
> "Bruce D'Arcus"  writes:
>
> > On Tue, Jun 8, 2021 at 7:36 AM Bruce D'Arcus  wrote:
> >
> >> (org-cite-register-processor 'bibtex
> >> :follow #'bibtex-completion-open-any)
> >
> > Actually, looking at the docstrings, I don't think this will work as
> > is, as the follow processor "accepts two arguments, the citation or
> > citation reference object at point", while the bibtex-completion
> > functions take a list of keys.
> >
> > So I guess for that I'd need a little wrapper to call that function.
>
> Indeed.

Not a big deal, but I'll ask :-)

Given how common existing functions are that take a list of keys, WDYT
about adding something like a `org-cite-get-references-keys` helper
function, to parallel `org-cite-get-references`?

So in this case one could do:

(bibtex-completion-open-any (org-cite-get-references-keys datum)))

Bruce



Re: literate programming, development log -- ideas? (ominbus reply)

2021-06-09 Thread Eric S Fraga
On Tuesday,  8 Jun 2021 at 20:15, Greg Minshall wrote:
> Eric, when you use something RCS-like as your version control system, i
> assume that makes grepping to find some old note easy enough.  but,
> these days i tend to use git.  when (assuming) you use git, do you have
> some easy way to say "well, i had this code that looked sort of like
> this... where was it?"?  (sorry, that's really a git question, but ...)

Yes, for SRC (RCS-like), it's straightforward to go into the ,v file and
search.  For git, I try to make sure the commit message is as
informative as necessary and then search on the log.  The alternative is
git-timemachine which allows me to go back and forward in time looking
at the buffer.

Having said this, I don't often find myself looking for anything in the
history.  For major alternatives that might come up during the project,
I use branches.  But only with git as I have never figured out how to
get a branch set up in src.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-549-ga0a87d



Re: literate programming, development log -- ideas? (ominbus reply)

2021-06-09 Thread Eric S Fraga
> Not sure if it counts as off-topic for this thread, but does everyone
> use Git to manage their Org docs and notes?

I use a variety of version control systems but for multiple computers I
use unison to keep them all synchronised.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-549-ga0a87d