Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-08 Thread Greg Minshall
Ihor,

> The time span is years and I do not recall any related bug reports.
> So, nobody seems to care.

:)



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-08 Thread Greg Minshall
Ihor,

> Does it make sense from the point of view of R code?
> AFAIU, the current ob-R implementation converts lists into R tables,
> which is not accurate? Would it make sense to convert Elisp lists into R
> lists directly?

my "barely half a cent" would be that backwards compatibility here
trumps, hmm, "logic".  i suspect a note in the wiki page for ob-R
stating that lists are converted to single-column tables would be
sufficient.  (partly because i think people writing code need to refer
to such pages to understand these sorts of mappings.)

(one could make the case that "no one" passes lists to R code; that
could push *me* towards your suggestion.)

cheers, Greg



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-06 Thread Greg Minshall
Jeremie,

i am neutral w.r.t. what the output should be.  like you, i've always
sent in tables.

for me, i don't know that it makes much difference how lists are
presented to R code, as long as it is well-defined and stable over time.

given that, iiuc, 9.5 presented a list as (the equivalent of) multiple
rows of a table, i'd vote for staying with (going back to) that.

(i think that's what the two modifications in Chuck's e-mail give you.)

cheers, Greg



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-05 Thread Greg Minshall
Chuck,

sorry, i didn't see the change you had added.

> So, isn't that what is wanted?

that's a policy question that i can't answer.  :)

cheers, Greg



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-05 Thread Greg Minshall
hi, Charles,

> This makes a list like '("a" "b" "c") into a data.frame with one column.

1. which version of Org are you running?
: Org mode version 9.6 (9.6-g60de19 @ 
/home/minshall/.emacs.d/straight/build/org/):

2. is my below example yours?

i think i used to see the behavior you describe in 9.5.

cheers, Greg



#+begin_src R :var list='("a" "b" "c")
  list
#+end_src

#+RESULTS:
| a | b | c |



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-04 Thread Greg Minshall
for the record, these are the tests i ran with my off-the-cuff "fix"
(s/sequencep/listp/):

#+name: alist
- first item
- second item
- third item

#+begin_src R :var list=alist :session ss
 list
#+end_src

#+RESULTS:
| first item | second item | third item |

#+begin_src R :var variable='(a test)
  variable
#+end_src

#+RESULTS:
| a | test |

#+name: atable
| this | is | a | header | line |
|--++---++--|
| 1| 2  | 3 | 4  | 5|
| a| b  | c | d  | e|

#+begin_src R :var list=atable :session ss
 list
#+end_src

#+RESULTS:
| 1 | 2 | 3 | 4 | 5 |
| a | b | c | d | e |

#+begin_src R :var list='((1 2 3) (1 2))
  list
#+end_src

#+RESULTS:
| 1 | 2 | 3 |
| 1 | 2 |   |


#+begin_src elisp :var list=alist
 list
#+end_src

#+RESULTS:
| first item | second item | third item |



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-04 Thread Greg Minshall
i see this same behavior.  to me, (org-babel-R-assign-elisp) seems to be
the problem, but it hasn't changed any time recently.  (nor, if my =git
blame= is done correctly, has anything else in ob-R.el.)

i don't understand how (org-babel-R-assign-elisp) thinks.  it seems to
assign =max= and =min= assuming that =value= is a list of (at least one)
list(s).

this *might* be a fix.  but, i don't have a lot of confidence it will
not have bad side effects for other cases.  (though i tested it with a
simple list, and a simple table with more than one row, and a list of
two lists, the first of length 3, the second of length 2.):

modified   lisp/ob-R.el
@@ -241,7 +241,7 @@ This function is called by `org-babel-execute-src-block'."
 (defun org-babel-R-assign-elisp (name value colnames-p rownames-p)
   "Construct R code assigning the elisp VALUE to a variable named NAME."
   (if (listp value)
-  (let* ((lengths (mapcar 'length (cl-remove-if-not 'sequencep value)))
+  (let* ((lengths (mapcar 'length (cl-remove-if-not 'listp value)))
 (max (if lengths (apply 'max lengths) 0))
 (min (if lengths (apply 'min lengths) 0)))
 ;; Ensure VALUE has an orgtbl structure (depth of at least 2).




Re: [BUG] ob-R: session evaluation returns empty ouputs with Org 9.6 [9.6 ( @ /home/fsantos/.emacs.d/elpa/org-9.6/)]

2022-12-01 Thread Greg Minshall
Frederic,

> > It looks like there is something wrong with comint-prompt-regexp in
> > R buffers. It somehow does not match the prompt.
> 
> I'm not sure it's the explanation either, since external (i.e.,
> non-session) evaluation works as expected. (Just remove the ":session
> *R*" part of the header, and you'll see everything is okay.)

Ihor will know, but i *think* that without :session, there is no R
"shell" running, so the ...-prompt-regexp isn't used.  rather (do i know
this?  assume this?), an R script is prepared and executed.

cheers, Greg



Re: processing a literal example line by line in a shell source block?

2022-11-06 Thread Greg Minshall
Ihor,

again, thanks for helping me with that problem.

and, just for my (or anyone's) future reference, how i probably *should*
have debugged this was to tangle the relevant source block, and then
examine the resulting shell-script file, and gone from there.

cheers, Greg



Re: processing a literal example line by line in a shell source block?

2022-11-03 Thread Greg Minshall
Ihor,

> Try
> 
> #+name: lbl
> #+begin_example
> line 1
> line 2
> #+end_example
> 
> #+begin_src bash :var input=lbl :results output
>   echo "${input}"
> #+end_src

ah, the double quotes!  thanks very much!

cheers, Greg



processing a literal example line by line in a shell source block?

2022-11-02 Thread Greg Minshall
hi.  i have a text in a named #+begin_example ... #+end_example block.
i would like to process this text line by line in a shell (bash, say)
code block.  but, it appears that the individual lines are not
separated, but passed as one long string to the source block.  (example
below.)

is there a magic incantation i can use to accomplish this?

cheers, Greg

#+name: lbl
#+begin_example
line 1
line 2
#+end_example

#+begin_src bash :var input=lbl :var in2='("first" "second")
  echo ${#input[@]}
  echo ${#in2[@]}
  echo ${input}
#+end_src

#+RESULTS:
|1 |   |  |   |
|2 |   |  |   |
| line | 1 | line | 2 |



Re: form-like process for entering rows in an org-mode table?

2022-09-29 Thread Greg Minshall
hi, Jean Louis,

> I do not know what is column view. But I understand that you need
>  descriptive text.

that was my state until recently, though i had seen various references
to it and its usage on the mailing list.  it at least offers some form
of completing read, at least for what might be in other contexts a "drop
down list".

it's probably at least glancing at to see if it might suit your need.

cheers, Greg



Re: how to remove parentheses from the output of a source code block

2022-09-28 Thread Greg Minshall
Andrés,

sorry -- of course, you can use base e-lisp =string-join= to accomplish
the same thing.

#+BEGIN_SRC emacs-lisp :var table=source-in-table :results value raw
  (let ((sqlcode (mapcar (lambda (row) 
   (concat "INSERT or ignore INTO labels_catalog (id, 
macro, language1, language2) VALUES ("
   (number-to-string (nth 0 row)) ", '" (nth 1 
row) "', '" (nth 2 row) "', '"
   (nth 3 row) "');\n")
   ) table)))
(string-join sqlcode " "))
#+END_SRC


cheers, Greg



Re: how to remove parentheses from the output of a source code block

2022-09-27 Thread Greg Minshall
Andrés,

this is maybe more of an e-lisp question, or, at least, here's more of
an e-lisp answer.  if you have the useful =s= package [1] installed,
then will using =s-join= give you what you want?

  (let ((sqlcode (mapcar (lambda (row) 
   (concat "INSERT or ignore INTO labels_catalog (id, 
macro, language1, language2) VALUES ("
   (number-to-string (nth 0 row)) ", '" (nth 1 
row) "', '" (nth 2 row) "', '"
   (nth 3 row) "');\n")
   ) table)))
(s-join " " sqlcode))

give you what you are looking for?

cheers, Greg

[1] https://github.com/magnars/s.el



Re: form-like process for entering rows in an org-mode table?

2022-09-27 Thread Greg Minshall
Jean Louis,

> * Greg Minshall  [2022-07-22 19:14]:
> > hi.  does anyone have any code, or know of any existing package, that
> > would allow for some sort of form-like (or "transient"-like) interface
> > for adding rows to an org-mode table?  in particular, that provides some
> > sort of =completing-read= interface for a given set of choices for a
> > given column, etc.
> 
> I have total understanding for this use case, as I do similar all the
> time. Just that I don't use Org tables, I use database tables.

the project that needs this has been on the back-burner for a while,
but, for the record, i have looked at "Column View" as a possible
replacement for "org tables as a database".  in addition to a
completing-read interface, column view gives the opportunity to add
descriptive text to a row -- i.e., just the regular, non-property,
content under a headline -- which is very nice.  but, i haven't played
with it enough to see how well it will fit my "needs".

cheers, Greg



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-19 Thread Greg Minshall
Rudy,

> I would deeply appreciate this option for my Org notebook that contains
> two kinds of source blocks: (1) workers for on-demand execution and (2)
> reproducible examples for anytime execution.  I cannot figure out how to
> make Org work with both, meaning it would execute just the reproducible
> examples on 'org-babel-execute-buffer', leaving the workers alone.  As a
> workaround, I configure workers with ':eval query' and then lean against
> the 'n' key during 'org-babel-execute-buffer'. :)

i'm a bit unclear.  does your (single?) Org notebook consist of *one*
file (and thus, [normally? always? my ignorance precedes me], one
buffer), or two files (thus, two buffers).

in the former case (one buffer), i don't know if these proposals will
help.  though, maybe as they are flushed out (precedence of the
buffer-local and/or global-local with header line constructs), it would?

in the latter case (two buffers), then, yes.

cheers, Greg



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-12 Thread Greg Minshall
hi, Tim,

> There are valid use cases for a configuration which does not require
> user interaction (to answer questions on block evaluation), for example,
> when you want to process many org files in a batch process without user
> interaction. Likewise, I don'tg want Emacs to become too much of a
> 'nanny'. If I decide the code in a file is safe and permanently safe, I
> want to be able to disable the queries on that file permanently. I'm
> happy using local variables to do this, though I would also like a
> global option as well.

sorry, i don't think i was clear.  i wasn't suggesting changing the
behavior if =org-confirm-babel-evaluate= is =nil= (either as a
buffer-local, or globally).  the trigger for prompting for "[y,n,Y,N,?]"
or long/short some such would be if it were =t= (i think?).

> With regard to long or short answers to such questions, I think the
> default should be the longer yes/no, but the user should be able to set
> it to y/n (i.e. same as normal Emacs behaviour). Ideally, this would
> fall under the same setting as the new y-or-n facility in recent emacs
> versions (replacing the old approaches like defalias).

ah, i didn't realize there was this configuration possibility.  that
makes sense.  thanks.

> Finally, while I can see there is a use case for being able to have fine
> grained control over individual block execution, I don't think having it
> as a prompt is the correct approach. Once you have many of these blocks
> in a file, that prompt will rapidly become annoying. When I've required
> this level of control, I've found header arguments work fine and I'm not
> sure the added complexity is worth it.

last time i tried to export a file with no buffer-local setting of
org-confirm-babel-evaluate, i was prompted on each code block.  and,
yes, it *is* annoying!  eliminating this behavior, while "preserving a
query", is what i find attractive in Fejda's proposal.

i apologize that i'm not sure of the header argument override?

but, still, i wouldn't argue for any new per-src-block-level
configuration.

cheers, Greg



Org version mismatch -- hooray!

2022-09-12 Thread Greg Minshall
i updated org, and in an existing emacs instance did something (in a
.org file), and got

byte-code: Org version mismatch.  Make sure that correct ‘load-path’ is set 
early in init.el


which i think is great!  thanks very much!

cheers, Greg



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-12 Thread Greg Minshall
Ihor, Fedja, et al.,

i think this is very good.

my suggestion would be to *not* permanently mark a file as safe (i.e., i
would vote against org-confirm-babel-evaluate-safe-paths); rather, let a
local variable do that.  i worry about keeping state in "side cars" (if
one calls them that), as it may be harder for the user to "grep" to find
why some expected behavior is occurring, etc.

in the "default" setting, asking to evaluate a src block would ask:
- "yes" [y]
- "no" [n]
- "always this buffer" [Y?]
- "never this buffer" [N?]

the last two would only survive this buffer; once the buffer is closed
and re-opened, you're back to "default" (unless, of course, there's a
local variable set).

Ihor, you suggested other meanings for "yes +".  while they all are
useful, i like the simplicity of just the "always for this buffer".
and, per-src block seems overkill, and too complicated, too much state
for the user to remember (but, i'm old, so memory is *always* an issue!
:).

when the user responds "always this buffer", maybe a message that, if
they want the same behavior for future buffers of this same file, add a
local variable.

anyway, that's my 2 cents.

cheers, Greg

ps -- i'm neutral w.r.t. single letter versus word-length, completing
read, prompts [the above suggestions notwithstanding].



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-07 Thread Greg Minshall
Steven,

> There is a neat solution to this problem using
> 
> * Local Variables :noexport:
> 
> see the discussion at stackoverflow
> 

thanks.  yes, if one has to do local variables, that is a very nice way
of doing it; i appreciate seeing that.

cheers, Greg



Re: per-file (or, really, per buffer) allowing/disallowing code block execution

2022-09-06 Thread Greg Minshall
Fedja,

> What I would like to have, to safely and easily use org-mode
> as an interactive notebook, is to not have to overload this
> function and to be asked only once per buffer/file whether to:
> 1) Unconditionally allow executing all code blocks
> 2) Unconditionally disallow executing all code blocks
> 3) Ask for every block.

i think that is an interesting idea, and maybe a more pleasant user
interface than what we currently have.  

probably, for me, it would allow me to drop a number of buffer-local
variable customizations, as i'm typically evaluating code in a given
buffer over and over again (and, so, would be happy to pay the price of
saying "yes" once per buffer (per emacs instance).

i'd be curious to hear what the downsides might be, especially anyone
who sees security-related downsides.

Ihor,

> 1) You can set org-confirm-babel-evaluate buffer-locally
> 2) Same or set :eval no header arg. (see
> https://orgmode.org/org.html#Evaluating-Code-Blocks)
> 3) You can set :eval query header arg.

for me the use case is 1) disabling all (or setting to "query") when,
e.g., you are exporting some file you received via e-mail and so trust
*none* of the code blocks; 2) enabling all for some file that you
yourself maintain, and so trust *all* the code blocks.  at least
initially, this seems a nice direction.

cheers, Greg



Re: Secrets in org-babel

2022-09-05 Thread Greg Minshall
Felix,

my setup is probably too complicated.  and, i don't really know what
"aws secretsmanager" is, or how you interact with it.  but, in case this
helps...

i put ("long-term") secrets in pass

https://www.passwordstore.org/


for "programmatic access" (in particular, for passwords needed by e-mail
sending and retrieving programs), avoiding having to enter my password
every ten minutes (or so), i wrote something called credeface/credepass

https://gitlab.com/minshall/credeface

which uses git's (!) credential cache for this service

https://git-scm.com/docs/git-credential


in your case, you might just use `credeface` to first store, then later
retrieve, whatever secrets you get from "aws secretsmanager".
occasionally (`--timeout`), you should be asked by `credeface` to
refresh that value.


bash archlinux (master): {1315} credeface --username ipsilon --host example.com 
store
this is that
bash archlinux (master): {1316} credeface --username ipsilon --host example.com 
get
cannot display secrets on the terminal
bash archlinux (master): {1317} credeface --username ipsilon --host example.com 
get | cat
this is that


cheers, Greg



Re: [FR, DISCUSSION] Re: [:results append] and [:wrap ...] don't play well together

2022-08-09 Thread Greg Minshall
Ihor,

thanks for your e-mail and explanation.

> We may clarify this in the manual.

probably worth doing.  though, trying to describe it succinctly will be
a challenge, i think!

> Another alternative could be treating
> :results append drawer/code/pp/org/latex/html
> differently and putting everything into a single drawer/src/export
> environment like:
> 
> #+begin_src R :results append :wrap foo
> Sys.time()
> #+end_src
> 
> #3:
> 
> #+RESULTS:
> #+begin_foo
> 2021-03-31 05:51:08
> 2021-03-31 05:51:10
> 2021-03-31 05:51:12
> #+end_foo
> 
> However, changing the behaviour will be a breaking change, which we do
> not want for the sake of back-compatibility.
> 
> Instead, we may introduce something like
> :results append-contents drawer
> that will behave like the above.
> 
> Is there a demand to have such a feature?

i suspect that at some point, it would be nice to have org be able to
"understand" how results of previous evaluations are laid out in the
buffer.  whether the need is now, i'm not sure (i can live without it).
(in the documentation you suggest above, it may help to have such an
option to point at; i.e., "if you don't really understand this, but want
something like this, try this option" :)

cheers, Greg



Re: Volunteering to maintain ob-asymptote.el within Org

2022-07-25 Thread Greg Minshall
hi, Munyoki,

i'm neutral w.r.t. asymptote support being in "core org" or in
"contrib".  but, ...

> I'm not _against_ supporting a proffesional-level
> graphics PL.  What I'm trying to say is that
> having it installed should be a choice made by the
> end-user.  Personally, I try to keep my systems as
> minimal as I can make them; and as such I advocate
> for users having that choice.  Very much by
> opinions.  Nevertheless...

in terms of keeping systems minimal, probably you knew this, but i just
wanted to mention that even if ob-asymptote.el is in "core org", the
user will not be required to install asymptote itself.

cheers, Greg



Re: Specify defaults for In Buffer Settings

2022-07-22 Thread Greg Minshall
Fraga, Eric  wrote:

> It comes with Emacs:

ah!  thanks!

cheers, Greg



form-like process for entering rows in an org-mode table?

2022-07-22 Thread Greg Minshall
hi.  does anyone have any code, or know of any existing package, that
would allow for some sort of form-like (or "transient"-like) interface
for adding rows to an org-mode table?  in particular, that provides some
sort of =completing-read= interface for a given set of choices for a
given column, etc.

cheers, Greg



Re: Specify defaults for In Buffer Settings

2022-07-22 Thread Greg Minshall
Eric,

> Have a look at #+SETUP but also consider the autoinsert package.

sorry, but what is the autoinsert package?

cheers, Greg



Re: numbering src blocks in HTML export

2022-07-22 Thread Greg Minshall
Ihor,

> Dear All, may we should provide a normal header arg as an equivalent of
> switches? Honestly, this whole switch syntax sounds unnecessary and only
> over-complicates things.

i'm a fan.



Re: [FR] Make :var foo=name-of-src-block assign the source block code instead of currently assigned result of evaluation (was: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments)

2022-07-16 Thread Greg Minshall
Ihor,

> Alternative ideas are welcome though. I'd prefer to avoid breaking
> change if we can find an equally simple syntax alternative to assign
> source block code to a variable.

my two cents would be to avoid the breaking change.  (i notice, for
example, that i use this construct in some of my .org files.)

cheers, Greg



Re: [FR] Make :var foo=name-of-src-block assign the source block code instead of currently assigned result of evaluation (was: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments)

2022-07-16 Thread Greg Minshall
Ihor,

> The current behaviour of :var foo=name-of-src-block is assigning result
> of evaluation. However, this behaviour is actually not documented.
> 16.4 Environment of a Code Block section of the manual only documents
> uses like

in fact, the text of the info page (on my system?) says
> code block without arguments
>  A code block name, as assigned by ‘NAME’ keyword from the example
>  above, optionally followed by parentheses.

note the "optionally".

cheers, Greg



Re: Alternatives or org-capture?

2022-07-14 Thread Greg Minshall
ypuntot,

by the way, i use =doct= to express org-capture templates:

https://github.com/progfolio/doct


in case that might seem more "intuitive" for you.

cheers, Greg



Re: [External] : Re: missing a character / font in agenda?

2022-07-13 Thread Greg Minshall
for what it's worth, without the symbola font on my machine (though i've
now added it), i seem to see the left-arrow 2b60 rendered using:

ftcrhb:-GNU-Unifont-normal-normal-normal-Sans-Serif-16-*-*-*-c-80-iso10646-1 
(#x2B61)

(if i'm interpreting the output of [C-u C-x =] correctly.)

cheers, Greg



Re: Confused about source code blocks evaluation when exporting

2022-07-12 Thread Greg Minshall
Alain,

let's see.  maybe look in the org manual for ":results" (with "value" or
"output" as options) and ":exports" (with "code" or "results" or "both"
as options).

that might help?

cheers, Greg



Re: [possible patch] Basic fontspec code for LuaLaTeX and XelaTeX (was "LaTeX export: when is it more useful...")

2022-07-10 Thread Greg Minshall
Juan Manuel,

> 1. There could be a defcustom, something like 'org-latex-use-fontspec'
> (I would vote for nil by default).

i just wanted to check: the "nil" case is for those of us who just want
it to work "out of the box"?

and, in the non-nil case, it would be up to the user to use "fontspec",
or whatever?

cheers, Greg



Re: LaTeX export: when is it more useful to use LuaTeX instead of pdfTeX?

2022-07-08 Thread Greg Minshall
Juan Manuel, et al.,

> TL;DR: A list of use cases where using LuaTeX is more advantageous than
> using pdfTeX

i'm guessing this would be a nice addtion to worg (if it's not already
there).

cheers, Greg



Re: Efficiently reuse code in org babel with R

2022-07-07 Thread Greg Minshall
Naresh,

> I want to source some data from databases, then use this data in
> various blocks.  I am looking for the most efficient way to achieve
> this.  In below blocks, is the code in block ``connection'' executed
> thrice (economy of code but no saving of time) or is it only executed
> once then used twice?  If the code is run thrice, is there another way
> to create code blocks so that the code is executed only once?

if you export this "file", the "connection" block will execute three
times.

Vikas suggested a session, which is something i often do for interactive
work.

or, the R code in "connection" could also use R variables to protect
itself against multiple executions.

or, i suppose you could invoke "connection" via a :var variable (rather
than via =<>), and use the :cache keyword to restrict
connection's evaluation to "every now and then" (for a very
precisely-defined, if not always intuitively definition of "every now
and then").  you'd have to be careful to not get bitten by the code
*not* being evaluated, and by it being evaluated too often.  (probably
too clever by half.)

hth, cheers, Greg



Re: C-SPC works; C-u C-SPC doesn't. How could be?

2022-06-24 Thread Greg Minshall
Ypo,

fwiw, [C-h k C-SPC] has a paragraph that says

With prefix argument (e.g., C-u C-SPC), jump to the mark, and set the mark from
position popped off the local mark ring (this does not affect the global
mark ring).  Use C-x C-@ to jump to a mark popped off the global
mark ring (see ‘pop-global-mark’).


i don't know if that helps at all.

cheers, Greg



Re: [DISCUSSION, default settings] Using mailcap as default handler for opening file links (was: [PATCH v3] Re: Bug in 9.5.3 org--file-default-apps)

2022-06-04 Thread Greg Minshall
hi, Ihor,

> It appears that using mailcap is giving us more trouble than benefits.
> I am not sure about the situation on Windows and Mac though.

> Should we change the default file handlers to Emacs globally (unless
> user customizes otherwise)? Should we continue efforts to work around
> mailcap issues? Maybe there is yet another alternative generic way to
> open files?

do you, or anyone else who might chime in, have a sense to what extent
"mainline emacs development" is committed to pushing the mailcap
solution?  and, to what extent are they running up against, and trying
to solve, problems similar to the ones you mention?

if "commitment + yes, trying", it might make sense to have, at least,
the *goal* of going mailcap.

my 2c.

cheers, Greg



Re: [PATCH] Re: tangle option to not write a file with same contents?

2022-06-01 Thread Greg Minshall
Ihor,

> The patch is attached.

great -- thanks very much!  this will be very helpful.

cheers, Greg



Re: Fwd: Help with my first elisp

2022-05-24 Thread Greg Minshall
Ypo,

> > but, using whatever the name of the logos-focus mode map, pointing at
> > your functions?
...
> I think "logos" doesn't have a map, is it possible?

certainly possible (i don't use logos).

in fact,

https://gitlab.com/protesilaos/logos/-/blob/main/logos.el


has the lines


;; Logos does not define any key bindings.  Try something like this:
;;
;; (let ((map global-map))
;;   (define-key map [remap narrow-to-region] #'logos-narrow-dwim)
;;   (define-key map [remap forward-page] #'logos-forward-page-dwim)
;;   (define-key map [remap backward-page] #'logos-backward-page-dwim))
;;
;; By default those key bindings are: C-x n n, C-x ], C-x [.


which certainly implies no map.  and, iiuc, *these* =define-key= lines
are global, i.e., remain true whether you are in, or out of, logos mode.

cheers, Greg



Re: Help with my first elisp

2022-05-23 Thread Greg Minshall
Ypo,

> (defun salto ()
>   (interactive)
>   (if posicion 1
> (posicion2)
>   (if posicion 2
>   (posicion3)
> (if posicion 3
> (posicion1)

your function =salto= may be using =if= incorrectly.  try marking that
=defun= and hitting TAB to justify it.  my guess is, that's not what you
want.

> ;; (define-key global-map (kbd "SPC") #'salto)
> (local-set-key "j" 'posicion1)
> (local-set-key "k" 'posicion2)
> (local-set-key "l" 'posicion3)
> ))

maybe use something like

>>  (define-key mh-letter-mode-map
>>   (kbd "C-c s")
>>   'ggm-mh-sentaddrs-completion)

but, using whatever the name of the logos-focus mode map, pointing at
your functions?

cheers, Greg



Re: Help with my first elisp

2022-05-22 Thread Greg Minshall
Ypo,

> Additional problem: I don't know how to recover keys 1, 2 and 3 to
> their normal functioning, right now I can't type 1, 2 or 3 on my
> Emacs. xD

you have, e.g.,

> (define-key global-map (kbd "1") #'posicion1)
> (define-key global-map (kbd "2") #'posicion2)
> (define-key global-map (kbd "3") #'posicion3)

but, that is in the global map.  for a given mode, i sometimes do
something like that:

> (add-hook 'mh-show-mode-hook #'(lambda ()
>  (local-set-key "q" 'mh-show-execute-commands)))

or, closer to what you have, sometimes like

> (define-key mh-letter-mode-map
>  (kbd "C-c s")
>  'ggm-mh-sentaddrs-completion)

i am no elisp expert, and so those are just random things i've found
that work.  but, hopefully this may give you a hint of a direction to
follow.

cheers, Greg



Re: Tips on using Org-mode to manage a reading list

2022-05-16 Thread Greg Minshall
hi, Sébastien,

> I got to many books and articles for a table...

hmm.  why too many?  each column would be an attribute (title, author,
score, publisher, ...), or a status (unread, finished, ...) and each row
would be a book.  that should scale.

the downside of a table (though that is almost certainly what i would
have suggested) is the "notes", i.e., the freeform text that would
follow the property table in a node in your scheme.  there's not a
"naive" way to do that.

cheers, Greg



Re: Regarding arbitrary Org blocks

2022-05-11 Thread Greg Minshall
Russell, the behavior you describe, that used to work, sounds reasonable
to me.  otoh, in case you haven't discovered =narrow-to-region= and
friends, (which i only recently did), that might also give you some of
what you want.  cheers, Greg



Re: leading superscript on a line for ODT export

2022-03-16 Thread Greg Minshall
Max and Eric, thanks for the explanation!  "hmm...", about manual
patches at the moment.



Re: leading superscript on a line for ODT export

2022-03-16 Thread Greg Minshall
hi.

> @@org:@@^1 blah

i'm not familiar with the '@@' construct.  in the manual, searching for
the string "@@", i see references to various =@@foo...=, but not, for
example, =@@org:@@=.

is there a general definition?  might the index (or, one of the indices)
usefully have references to various "special" characters (like "^", "|",
and "@" when used in TODOs, iiuc)?

cheers, Greg



Re: interleaving comment between rows of a table?

2022-03-07 Thread Greg Minshall
Juan Manuel,

> I find the annotate package useful for inserting comments and
> annotations in "difficult" places.

thanks -- annotate looks very applicable!

cheers, Greg



interleaving comment between rows of a table?

2022-03-07 Thread Greg Minshall
hi, all.

i don't remember anybody asking about this.

i'd sometimes find it useful to be able to interleave comments -- using
(almost) whatever syntax -- between rows in an org-mode table.
(normally, this would be to provide context/rationale for the subsequent
row(s).)

something like:

| column name | another name   |
|-+|
# i put this in early
| some data   | some more data |
# this helps with some issue
| a bit more  | on the way |


is there any known way to do this?  some switch, or an exposed regexp?

cheers, Greg



Re: quotation marks in table cell vs. org-babel-ref-resolve

2022-02-28 Thread Greg Minshall
i have a problem similar to this from a few months ago.  in this case,
it seems to be when trying to pass a column with a quoted-string inside
of it.  (this is on the "bugfix" branch.)  my e-lisp code seems to get
just the initial part of the string from the cell with "odd" contents.


#+name: xl
| this, "he said" | is where, | "you go in" there |

#+begin_src elisp :var xl=xl
  (message "%S" xl)
#+end_src


when i execute this, *Messages* says

(("this, \"he said\"" "is where," "you go in"))
Code block evaluation complete.

(my complaint: there's no there there. :)

in December, when i reported something similar, Tim pushed back, and
maybe i should elaborate:

> The key question is what is the use case for having this 'mixed'
> content in a table cell?

for better or worse, i most often use org-mode tables as (storage and
data entry mechanisms for) simple data bases.  other than the pipe
symbol ('|'), i assume i can put "anything" in a cell, and extract it
later.  i find this very valuable.

normally, i pass such tables to some R code (this example, btw, breaks
passing to R code).  but occasionally i do other things with them.

the behavior i'm seeing seems to me inconsistent, indicating it is maybe
not intentional.  exporting, for example, at least to html. i see the
full contents of the third column.

cheers, Greg



Re: including one double quote in an anonymous footnote?

2022-02-28 Thread Greg Minshall
Nicolas and Juan Manuel,

thanks very much.  the bugfix branch seems to work for my case.

cheers, Greg



Re: including one double quote in an anonymous footnote?

2022-02-26 Thread Greg Minshall
Juan Manuel,

> I can confirm that behavior. One possible solution is to use an entity
> (M-x org-entities-help):

thanks very much -- that does the trick for my case.

cheers, Greg



including one double quote in an anonymous footnote?

2022-02-26 Thread Greg Minshall
hi.  experimenting [after significant confusion!], it appears that
including a single (unpaired) double quote inside an anonymous footnote
eliminates the recognition of the footnote.  is this intentional?

this works:

this is a test.[fn:: a very long footnote]


whereas this doesn't:

this is a test.[fn:: "a very long footnote]


i notice that for purposes of exporting, i can have the single double
quote accepted by escaping it with a backslash:

this is a test.[fn:: \"a very long footnote]

but,
- the backslash itself shows up in both latex and html exporting
- the footnote doesn't get displayed in the org buffer as a footnote
  (the separate colors; this is "font locking"?)

Org mode version 9.5.2 (9.5.2-gbb6830 @ 
/home/minshall/.emacs.d/straight/build/org/)

cheers, Greg



Re: How to enforce sub-scripts with {} only for HTML export?

2022-02-20 Thread Greg Minshall
Edgar,

one of my .org files has this

#  ^:{}: disable super/subscripting: https://stackoverflow.com/a/698791/1527747
#+options: ^:{}


ymmv.



Re: Bug: SCHEDULED's end time wrong [9.5.2 (9.5.2-gfbff08 @ /Users/liutos/.emacs.d/elpa/org-9.5.2/)]

2022-02-20 Thread Greg Minshall
Ihor,

> Which is perfectly fine. 24:29 is one of the expected time formats for
> org-agenda. If I recall correctly, this kind of time range is used in
> the wild. See https://orgmode.org/list/874l3w7woq@gmail.com

ah, i see.  thanks for the correction!

cheers, Greg



Re: Bug: SCHEDULED's end time wrong [9.5.2 (9.5.2-gfbff08 @ /Users/liutos/.emacs.d/elpa/org-9.5.2/)]

2022-02-20 Thread Greg Minshall
Ihor,

i tried Liutos' example, and ended up with

> * a simple entry
>   SCHEDULED: <2022-02-20 Sun 23:59-24:29>

i think it is the "-24:29" that is of concern.



Re: [PATCH] lisp/org-capture.el: Add hook & hook options to org-capture (Valentin Herrmann)

2022-02-10 Thread Greg Minshall
fwiw...

> I've implemented what you're proposing here (and much more) in a 
> package you may find useful a couple years ago. I pitched adopting 
> some of the ideas into org-mode proper and was willing to do the 
> work. My proposal was met with enthusiastic silence:
> 
> https://www.github.com/progfolio/doct

i've been using doct for a while, and have been very happy with it.

(thanks for implementing it.)

cheers, Greg



Re: Unable to get current or via use-package

2022-02-09 Thread Greg Minshall
Loris, et al.,

> Thanks, that did the trick.  I was hoping that when I use the same
> init.el on a different machine I wouldn't have to remember anything and
> use-package would automatically install the latest version.  Seemingly
> not :-/

this is maybe an appropriate time to insert a plug for straight.el:

https://github.com/raxod502/straight.el

though, in reality, it has its own rough edges.  yremv ("your rough
edges may vary" :).

cheers, Greg



Re: [BUG] bug in 'ox-man?

2022-01-31 Thread Greg Minshall
> #+begin_src bash :results output :exports code :eval never-export
>   echo 'lf "\n"'
> #+end_src

it seems that `.man` files are in troff(1) format, which uses backslash
escapes up the wazoo (however that is spelled).  it seems that (one way)
to getting a backslash character through troff is representing it as
"\e".

for my *particular* instance, where the backslash is in an org src
block, the below modification to `(org-man-src-block)` may work.

presumably one might have backslash sequences in example blocks, or in
the main text, or ...?  i don't know enough to have any idea if there is
some general mechanism that might solve all those.

cheers, Greg


From 0d0dadc6b4e7f3358612f056a9eb032c1eb4145f Mon Sep 17 00:00:00 2001
From: Greg Minshall 
Date: Mon, 31 Jan 2022 16:08:35 -0800
Subject: [PATCH] lisp/ox-man.el: escape backslashes from org src blocks

---
 lisp/ox-man.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index e808edcdf..6eb6b5ff8 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -748,7 +748,9 @@ CONTENTS holds the contents of the item.  INFO is a plist 
holding
 contextual information."
   (if (not (plist-get info :man-source-highlight))
   (format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
- (org-export-format-code-default src-block info))
+  (replace-regexp-in-string
+   "" "e"
+  (org-export-format-code-default src-block info)))
 (let* ((tmpdir temporary-file-directory)
   (in-file  (make-temp-name (expand-file-name "srchilite" tmpdir)))
   (out-file (make-temp-name (expand-file-name "reshilite" tmpdir)))
--
2.34.1




[BUG] bug in 'ox-man?

2022-01-31 Thread Greg Minshall
hi, all.

this works when exporting as a .pdf or a .html.  but, not when
exporting to 'ox-man:

#+begin_src bash :results output :exports code :eval never-export
  echo 'lf "\n"'
#+end_src

(the result has a "0" in it, appears to have gotten confused by maybe
trying to substitute a newline character for the backslash-n, ???)

i'm running:
Org mode version 9.5.1 (9.5.1-g14ed65 @ 
/home/minshall/.emacs.d/straight/build/org/)


cheers, Greg



Re: Depreciating TeX-style LaTeX fragments

2022-01-16 Thread Greg Minshall
Colin,

> > Colin Baxter writes:
> >> Ah, LaTeX3 - whatever happened to that?
...
> Yes, I know. My remark was tongue in cheek.

which leaves open whether your tongue was already in your cheek at:

> Indeed. Compare something like
> 
> $g=\lim_{\delta m\to 0}(\delta F/\delta m)$
> 
> with
> 
> \(g=\lim_{\delta m\to 0}(\delta F/\delta m)\)

?

additionally, fwiw, i was a long time '$...$'-user.  at one point i was
betrayed, and switched to '\(...\)'.  it may be more to type (i hadn't
noticed the suggestion Eric just sent in), but i liked the
repeatability.  and, in terms of parsing, i'm very sympathetic to having
"directional" end markers.

cheers, Greg



Re: Question Regarding Creating Workflow For Automatic Formulas For Finance Based Org Spreadsheet

2022-01-10 Thread Greg Minshall
> I'm wondering if your opinion about Ledger isn't influenced by the fact
> that it uses basic accounting principles, like the idea of double-entry
> accounting.  For me, it's /very/ simple and intuitive, but I graduated
> in economics many years ago and had a (basic, but still) course on
> accounting.  If that is your problem, I'd suggest spending some time on
> understanding that - even if you don't end up using Ledger but some
> other software, you might find learning about accounting useful.  (Also,
> it's fascinating.  No, really!  It's an extremely clever abstract
> system with a real-life use-case.)

i agree that learning the principles of double-entry is worthwhile,
actually interesting, and of a very interesting history!



Re: [BUG] Eval src block does not redisplay inline image [9.5.1 (9.5.1-g36086a @ /Users/rob/.emacs.d/elpa/org-9.5.1/)]

2021-12-09 Thread Greg Minshall
Robert,

i have the following commented out in my .emacs.  i have no memory of
it, why i put it in, why i took it out, or if it might provide you any
clue.  but, with all those caveats...

;; in org-mode, display images inline after execution
;; except, after a while, this gets tiresome.  one can C-c C-x C-v
;; (add-hook 'org-babel-after-execute-hook 'org-display-inline-images)


cheers, Greg



Re: On zero width spaces and Org syntax

2021-12-06 Thread Greg Minshall
Robert,

> Thereʼs no need to modify Emacs: see
> `glyphless-char-display-control'. ZWS falls under 'format-control'.

very nice.  thanks!

cheers, Greg



Re: Concrete suggestions to improve Org mode third-party integration :: an afterthought following Karl Voit's Orgdown proposal

2021-12-06 Thread Greg Minshall
Ihor,

> Search result is just an entrance for users to be curious about the
> new beast of "Org mode". The website front page is the means to make
> users try. And the Org mode itself is the way to make users fall in
> love with Org in one way or another (even unrelated to Emacs [at least
> initially]).

i *do* agree that our hope is that people will see the great benefit of,
and use, "emacs org mode".  however, along with others, i don't want
people to fall in love with "org mode" itself, but, rather with the full
"running org mode with emacs".

at the same time, i have a desire that "the general public" will be able
to "work with" "emacs org mode" *files*; i.e., treat them as somewhat
more than a collection of octets.  *how much* more is tbd; i sort of saw
Karl Voit's proposal of "level 1", ..., as being an attempt to define
ways of extracting (limited) utility from an org mode file.

cheers, Greg




Re: Concrete suggestions to improve Org mode third-party integration :: an afterthought following Karl Voit's Orgdown proposal

2021-12-06 Thread Greg Minshall
Juan Manuel (and, Tim, i think),

> On the other hand, we must not forget that Org, as part of Emacs, is
> part of GNU, and this is a mailing list from the GNU project. I think
> everything related to the (possible) extension of GNU Org Mode outside
> of GNU Emacs (even in software incompatible with the ethics and
> philosophy of the GNU project) should be considered offtopic here and
> be discussed in other forums. Otherwise it would only create confusion
> among users.

i hope we don't adopt such an "official policy" regarding discussions on
this list.  i don't think we've had any problems where non-FSF/GNU
topics have somehow swamped our discussions.

cheers, Greg



Re: quotation marks in table cell vs. org-babel-ref-resolve

2021-12-06 Thread Greg Minshall
sigh.

the following is pretty much a lie.  apologies.

> =org-babel-ref-resolve= is convenient to use (as you provide a REF,
> rather than create a [temp] buffer, visit the file, whatever).

the creating a temp buffer, visiting the file, are *not* provided by
=org-babel-ref-resolve=.

cheers (or, cheerless's :), Greg



Re: quotation marks in table cell vs. org-babel-ref-resolve

2021-12-05 Thread Greg Minshall
hi, Tim,

thanks for the reply.

> I don't know. It could be related to the spreadsheet capabilities or it
> could simply be an oversight in how the code extracts values from
> tables.

if anyone has any knowledge in this area, i'd be curious to hear.

> I tend to use the function org-table-to-list to extract the data from a
> table. It gives me a nested list which I can then process with elisp in
> any way I want. I don't know if that would help or how it will interpret
> a cell whic contains both quoted and unquoted data.

for the record, things -- lists and lisps -- being equal, the function
you presumably meant to write was =org-table-to-lisp=.

=org-babel-ref-resolve= is convenient to use (as you provide a REF,
rather than create a [temp] buffer, visit the file, whatever).  but, it
isn't clear to me what functions (=org-babel-ref-resolve= and/or
=org-table-to-lisp=) should be considered part of the "Emacs Org Mode
API". :)

(i've gotten "around" the issue by prepending my e-mail addresses with
[: SPACE].)

cheers, Greg



Re: quotation marks in table cell vs. org-babel-ref-resolve

2021-12-03 Thread Greg Minshall
hi, Tim,

> The key question is what is the use case for having this 'mixed' content
> in a table cell?

in my case, i am putting RFC822('ish) e-mail addresses in a column of an
org-mode table.  and, i want to extract them.

| oxymo...@example.com  |
| Greg Oxymoron   |
| "Greg G. Oxymoron"  |

for the third row returns =Greg G. Oxymoron=, rather than my desired
="Greg G. Oxymoron" =.

by the way, do you know the use case for the current behavior for
strings that start with a ="=?  i couldn't find anything in the manual.

i wonder if maybe the existing parameter =inhibit-lisp-eval= (which, in
the path i am exercising, is non-nil) could also be used to not do the
check for a ="=?  (maybe that's also a hack, but i think it would solve
my problem. :)

cheers, Greg



Re: On zero width spaces and Org syntax

2021-12-03 Thread Greg Minshall
Juan Manuel,

> however, I find it problematic that this character is part, more or
> less de facto, of the Org syntax. For two main reasons:

in fact, i am always queasy when i enter ZWNBSP in a .org (or any other)
file.  some sort of "visible" sequence would be great.  backwards
compatibility might be a problem.

your last example

: [''*literature*'']

seems a bit of sleight-of-hand, though.  iiuc, text inside square
brackets isn't highlighted currently, and ZWNBSP doesn't (afaict) turn
on highlighting.  (maybe there's been recent discussion, modifications
of this?)

i.e., if the goal is to *expand* the realm of highlighting, might that
not be a separate issue?

cheers, Greg



Re: quotation marks in table cell vs. org-babel-ref-resolve

2021-12-03 Thread Greg Minshall
fwiw, tracing, the problem appears to be this line

((eq (string-to-char cell) ?\") (read cell))

in =org-babel-read=.

presumably there are many cases where this is the right thing to do.

but, maybe look for a simple =^"[^"]*"$= (i.e., a quotation mark, some
other stuff, a quotation mark, and *nothing* else in the cell)?

or (heaven help us), something more complicated, with random escaped
quotation marks inside the "cell"?

cheers, Greg



quotation marks in table cell vs. org-babel-ref-resolve

2021-12-03 Thread Greg Minshall
hi.  i'm trying to use =org-babel-ref-resolve= to access the values of a
column in a table.  it all works fine for many cases.  however, if the
contents of an entry in the column starts with quotation marks, those
quotation marks disappear, and anything outside the quoted part of the
cell "disappears" (in the result).  see below.

would this be intentional?  a bug?

or, if there's a better way to retrieve the contents of a table column,
i'd love to hear.

cheers, Greg

ps -- it doesn't seem to matter that "35" can be considered an integer;
i.e., "a35" seems to behave the same.


#+name: foo
| this | is |  a | header   |
|--+++--|
|   33 | 42 | 32 | "35" |
|   33 | 42 | 32 | "35" thirtyfive  |
|   33 | 42 | 32 | 35 thirtyfive|
|   33 | 42 | 32 | thirtyfive "35"  |
|   33 | 42 | 32 | thirtyfive "35" post-thirty-five |

#+begin_src elisp
  (org-babel-ref-resolve "foo")
#+end_src

#+RESULTS:
| this | is |  a | header   |
|--+++--|
|   33 | 42 | 32 | 35   |
|   33 | 42 | 32 | 35   |
|   33 | 42 | 32 | 35 thirtyfive|
|   33 | 42 | 32 | thirtyfive "35"  |
|   33 | 42 | 32 | thirtyfive "35" post-thirty-five |



Re: Orgdown: negative feedback & attempt of a root-cause analysis

2021-12-02 Thread Greg Minshall
Karl,

thanks for all of this, and for writing and posting your blog entry
(words of caution for many).

my thoughts on your project are something like this:

- i think non-emacs tools to deal with org mode files is a Good Thing.

- for me, the main motivation is to allow *me* to share an org mode
  file with someone -- say via a git repo -- and have them be able to do
  something reasonable, if restricted, with it -- extract the code,
  query subtrees or tables, etc. -- without recourse to emacs.

- i think collaborative editing with non-emacs users should be not be a
  goal of *this* endeavor.

- for me, your main invention, and the place (non pro-versus-con)
  discussion should focus, is on your levels: what's at level 1, at what
  level is org-mode itself, etc.  there are some tricky things here
  (e.g., for tables, what to do with hlines, with column width
  specifications, at the various "conformance levels"?)

- and, sigh, i prefer some other name; like "org mode syntax (level 0)".
  maybe it will acronymize into omsl0 (gasp!).  who knows.  i do think
  "orgdown" was a clever choice, but i'm not a fan.

cheers, Greg



Re: Is M-j broken for you in Org on Emacs 27 and 28?

2021-11-28 Thread Greg Minshall
Richard,

i also see an error message when entering M-j running:
: emacs -Q foo.org

cheers, Greg


Org mode version 9.5 (9.5-gced2b3 @ /home/minshall/.emacs.d/straight/build/org/)

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27,
cairo version 1.17.4) of 2021-03-26



Re: [PATCH] Accept more :tangle-mode specification forms

2021-11-20 Thread Greg Minshall
Timothy,

> Just a quick note (see my long recent reply to Tim where I expand on this 
> more),
> but this isn’t new behaviour (isn’t actually affected by my recent changes) 
> and
> my concerns are with the viability of the necessary changes rather than 
> whether
> this would be good (we are of the same mind I think).

yes, i see.  i hadn't realized that.

maybe, though, we could start off by warning people who are writing
integer values; then deprecate it; then, N-releases from now, make it
illegal?

such a path might be worth it.  or, at least the warnings --
irrespective, i would say, of whether or not the decimal value turns
into some "reasonable" file mode value.

cheers, Greg



Re: [PATCH] Accept more :tangle-mode specification forms

2021-11-20 Thread Greg Minshall
hi, Timothy,

> I’ve just pushed three commits that
> 1. Add “o555” as an octal shorthand
> 2. Perform a simple check that integer modes are valid*
> 3. Make the ls-style regex stricter
> ...
> * For example, “:tangle-mode 755” will now produce the warning:
>   “1363 is not a valid file mode octal. Did you give the decimal value 755 by
>   mistake?”. Maybe it would be worth adding “if so try o755” or similar?

i'd push back, even here, on allowing decimal.  file modes are bit
masks.  to me, offering a way to set a bit mask via a *decimal* value
seems a mistake.

my +/- one cent.

cheers, Greg



Re: [PATCH] Accept more :tangle-mode specification forms

2021-11-19 Thread Greg Minshall
> Timothy  writes:

> I would just accept two formats, both being strings with either "o400"
> (or perhaps "#o400") and "u+rwx" symbolic form and anything else
> generates an error (a hard error, not a warning i.e. stop processing,
> don't tangle). 

+1.  (i'm neutral w.r.t. "o400" vs. "#o400".)

cheers, Greg



Re: Tables and org babel

2021-11-08 Thread Greg Minshall
sorry, in fact, =-Q= doesn't matter:

failing:
- Org mode version 9.5 (9.5-g531577 @ 
/home/minshall/.emacs.d/straight/build/org/)

succeeding:
- Org mode version 9.5 (9.5-gced2b3 @ 
/home/minshall/.emacs.d/straight/build/org/)

cheers, Greg



Re: Tables and org babel

2021-11-08 Thread Greg Minshall
my data point:

- emacs -Q: works as (i assume) expected
- emacs: i get an error, with this backtrace

Debugger entered--Lisp error: (wrong-type-argument markerp nil)
  #f(compiled-function () #)()
  org-babel-insert-result((1 2 3 4) ("replace") ("emacs-lisp" "data" ((:var 
data 1 2 3 4) (:colname-names) (:rowname-names) (:result-params "replace") 
(:result-type . value) (:results . "replace") (:exports . "code") (:session . 
"none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") 
(:lexical . "no")) "" nil 16920 "(ref:%s)") nil "emacs-lisp")
  org-babel-execute-src-block(nil ("emacs-lisp" "data" ((:var data 1 2 3 4) 
(:colname-names) (:rowname-names) (:result-params "replace") (:result-type . 
value) (:results . "replace") (:exports . "code") (:lexical . "no") (:tangle . 
"no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "none")) "" 
nil 16920 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)


i haven't noticed anything weird recently, but this may well be
something in my setup that's odder than "normal org mode" stuff.  so, a
grain of salt is warranted.

cheers, Greg



Re: typescript from org src buffer -- tide, lsp

2021-11-06 Thread Greg Minshall
Tim and Samuel, thanks.  :dir is a thought; and, links may yield
treasures.

cheers, Greg



typescript from org src buffer -- tide, lsp

2021-11-03 Thread Greg Minshall
hi.

i'm wondering if anyone programming in typescript might have run into,
and solved, this "problem", of tangling into a subdirectory, and tide
[1] not being able to resolve "relative" imports.

i have a file in path /a/b/foo.org.  it includes various source blocks,
and they do things like `:tangle c/d/bar.ts`.  another source block,
tangled into in c/d/fubar.ts, say, does something like:

import Bar from "./bar"


when i open an Org Src edit buffer from fubar.ts's source block, with
tide mode [1] enabled, i get a complaint

Cannot find module './bar' or its corresponding type declarations. [2307]

tide (or, really, iiuc, tsserver) appears to be, reasonably, looking for
/a/b/bar.ts, and not finding it.  but, i haven't been able to figure out
how to talk tide into looking elsewhere.

i've done things like add "rootDirs" to `tsconfig.json`, to no avail.  i
haven't been able to get lsp-mode [2] to work for this scenario, either.

anyway, in case anyone has done exactly that, i'm asking.

cheers, Greg

[1] tide: https://github.com/ananthakumaran/tide
[2] lsp:  https://github.com/emacs-lsp/lsp-mode/


ps -- scrounging around trying to deal with this, i stumbled on

https://github.com/justbur/emacs-which-key

which i find a treat.



Re: transclusion, tangling, flycheck/flymake, etc.

2021-11-03 Thread Greg Minshall
Ihor,

thanks for the clarification.

maybe, in that ideal world, <> might expand, optionally.

another point: watching Noboru's "most recent" (9?) video, i see another
feature of his transclusion: a way to say, "this is *exactly* like a
source block -- with language, :results, :tangle, :var, etc.,
... except, the actual code is in some other file: when i hit =C-c C-c=
here, please set up (based on language), include that source, execute
it".

that also might be interesting.  if i were to think of that, i'd say the
verb might *not* be =#+transclude=, but, rather, something source
specific (=#+src_ref=?).  but, it might allow a =:transclude yes=
property.

cheers, Greg



transclusion, tangling, flycheck/flymake, etc.

2021-11-03 Thread Greg Minshall
Ihor,

(Noboru Ota -- i do find transclusion very interesting.)

> 2. A much faster tangle system. If we can directly transclude and sync
>contents of source blocks with actual programming language buffer,
>C-c ' can trivially support flycheck-mode and provide a more
>IDE-like experience while still benefiting from literate
>programming style.

in general, i would like to keep bits of my code in a single .org file,
maybe broken into separate source blocks, with preceding/succeeding
commentary.  then, pulled together in a tangle by a =:tangle= property
(within a subtree) and/or =<>= references.

my thought about flycheck, flymake, whatever, is that (optionally) a
silent, background, =tangle= and/or =<> expansion= would take
place to produce a "full source file buffer"[*], then the narrowed
version of that (corresponding to the part where =C-c '= was issued)
buffer is presented for the user's editing convenience.

your thought here, iiuc, is that source files would live in the file
system, and be transcluded into the .org file.  i can see the utility of
that.  but, i would miss =<>= and also the ability to break the
source code into small chunks for purposes of documentation.

obviously, the two approaches are not mutually exclusive.  but, partly
to make sure i understand your suggestion, i thought i'd mention it.

cheers, Greg

[*] in my scenario, i would find it convenient for the buffer the user
edits to have a file name, with the tangled file's extension; i have a
'package-in-waiting' which has to do some head standing to figure out
the appropriate language [parser] to send to a program =prettier=.

https://git.sr.ht/~minshall/prettied-diff 



Re: tangle option to not write a file with same contents?

2021-10-30 Thread Greg Minshall
Max,

thanks for the reply.

> In the meanwhile I realized that check for modification by user should
> be performed *before* tangle, and hash to detect changes is
> appropriate for such purpose. I think, a copy of tangled file just to
> detect modification will cause some tension from users.

i guess you mean org's current "cache" stuff?

> Comparison of earlier and current tangle results should be done at the
> end, so implementation should be independent. There is no point to use 
> hash, size + byte to byte comparison is fast and reliable.

that makes sense.

cheers, Greg



Re: tangle option to not write a file with same contents?

2021-10-29 Thread Greg Minshall
Max,

> > i wonder if it would be reasonable to add an option such that, when
> > tangling, `org-babel-tangle` would not write a file with the
> > already-existing contents of the target file?
> 
> Are you going to celebrate a decade of the feature request?
> I agree with you, make is wide spread and fast tool that is really
> convenient in simple cases.

hah -- i should have waited a few weeks!

> Some hash-based build systems are mentioned in that thread. Since that
> time more more similar tools have appeared, e.g. buck,
> reimplementations of DJB's redo https://cr.yp.to/redo.html

i think different people will settle on different build tools.

> It seems `compare-buffer-substrings` has more logic than just byte to
> byte comparison. Is it to handle alternatives for unicode character
> alternatives? For tangled buffer it should be size that is checked
> first...

you are right, it definitely makes sense to look first at size.  (which
is what, e.g., rsync(1) does.)  also, probably i needn't have mentioned
`compare-buffer-substrings` -- i was really just trying to suggest
"simple" (which maybe i anti-did?).

cheers, Greg



tangle option to not write a file with same contents?

2021-10-27 Thread Greg Minshall
hi.

i wonder if it would be reasonable to add an option such that, when
tangling, `org-babel-tangle` would not write a file with the
already-existing contents of the target file?

this would be helpful, e.g., for those of us who use make(1)-based work
flows.

then, if this might generally be thought useful, i wonder if this should
be implemented as specifically this, or whether we might implement a
callback at the appropriate point in `org-babel-tangle` asking whether
or not to proceed.  (then, the user's callback routine could do the
comparison.)

if we do "specifically this", i would suggest that this comparison be
dead simple: read in the existing file's contents into some hidden
buffer, and use `compare-buffer-substrings` to compare point-{min,max}
of both.

cheers, Greg



Re: Bug: font-lock error with - in code-mode [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]

2021-10-26 Thread Greg Minshall
> Actually, when I told my daughter I was programming "Woof!" as a tool
> to ensure that important emails where receiving enough attention from
> the community, she suggested I should program something for the "poor
> unimportant emails" out there... of course she'd call it "Mew!"
> 
> And I'm seriously considering this: something like an auto-bumper for
> bug reports and help requests that didn't get any anwer...

:)



Re: Bug: font-lock error with - in code-mode [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]

2021-10-26 Thread Greg Minshall
Bastien,

> PS: I'm not sure how to do this with Woof! but I'm working on the next
> version of Woof! where this will be possible.

i hope you will call the next version: Woof, woof!

:)



Re: Fwd: errors when using org-agenda

2021-10-24 Thread Greg Minshall
Tim,

> The key point to remember is that a mized installation is not about
> loading org sources from two different org versions. The problem is
> about compilation of org where some of the source definitions are
> already loaded (from existing installation) and result in output which
> is a combination of some of the source from the new version mixed with
> definitions from the old version.

hah.  i think you or others have mentioned this before, but i hadn't
understood until now (albeit still vaguely).

thanks!

cheers, Greg



Re: Fwd: errors when using org-agenda

2021-10-23 Thread Greg Minshall
Tim,

i wonder if the emacs variable `load-history` might be of (approximate)
help?  i submit a starter routine below.  as the comments say: caveat,
caveat, caveat.

i don't think something as uncertain as this would be a candidate for
normal run-time checking (and, i'm not even sure when one would want to
run such a thing -- maybe as each module is loaded, if it were faster).
but, maybe it could be run as part of `M-x org-submit-bug-report`?
either to notify the user, or to include with the bug report?

wdyt?  (such a nice acronym!)

cheers, Greg


notice the canned list of files.  one could, i suspect, go find where
org.el came from, then use all the .el files there.  (or the union of
all the files in *all* the directories that loaded an org.el.)


(defun org--check-load-history ( where)
  "check to see if there *appears* to *maybe* have be a \"mixed
  installation\" of org-mode running.  if there appear to be more than
  one directory holding org package(-like) files, the names of those
  directories, along with the relevant files in each, are returned as
  a vector of explanatory strings.  

  this routine is subject to both type I and type II errors (false
  positives, false negatives).  we have a canned list of org .el file
  names, and we look to see if those files exist in more than one
  directory that has been loaded (using the `load-list` variable).

  if there does not appear to be the possibility of a \"mixed
  installation\", the if the optional argument WHERE is non-nil, and
  there is only one directory containing org package(-like) files,
  that directory name is returned.  if WHERE is nil, nil is returned."
  (require 'seq)
  (require 's)

  (let* ((org-files
  '("ob-lob.el" "oc-bibtex.el" "org-crypt.el" "org-persist.el"
"ob-C.el" "ob-lua.el" "oc-csl.el" "org-ctags.el" "org-plot.el"
"ob-R.el" "ob-makefile.el" "oc-natbib.el" "org-datetree.el" 
"org-protocol.el"
"ob-awk.el" "ob-matlab.el" "oc.el" "org-duration.el" "org-refile.el"
"ob-calc.el" "ob-maxima.el" "ol-bbdb.el" "org-element.el" 
"org-src.el"
"ob-clojure.el" "ob-ocaml.el" "ol-bibtex.el" "org-entities.el" 
"org-table.el"
"ob-comint.el" "ob-octave.el" "ol-docview.el" "org-faces.el" 
"org-tempo.el"
"ob-core.el" "ob-org.el" "ol-doi.el" "org-feed.el" "org-timer.el"
"ob-css.el" "ob-perl.el" "ol-eshell.el" "org-footnote.el" 
"org-version.el"
"ob-ditaa.el" "ob-plantuml.el" "ol-eww.el" "org-goto.el" 
"org-version.el~"
"ob-dot.el" "ob-processing.el" "ol-gnus.el" "org-habit.el" "org.el"
"ob-emacs-lisp.el" "ob-python.el" "ol-info.el" "org-id.el" 
"ox-ascii.el"
"ob-eshell.el" "ob-ref.el" "ol-irc.el" "org-indent.el" 
"ox-beamer.el"
"ob-eval.el" "ob-ruby.el" "ol-man.el" "org-inlinetask.el" 
"ox-html.el"
"ob-exp.el" "ob-sass.el" "ol-mhe.el" "org-install.el" 
"ox-icalendar.el"
"ob-forth.el" "ob-scheme.el" "ol-rmail.el" "org-keys.el" 
"ox-koma-letter.el"
"ob-fortran.el" "ob-screen.el" "ol-w3m.el" "org-lint.el" 
"ox-latex.el"
"ob-gnuplot.el" "ob-sed.el" "ol.el" "org-list.el" "ox-man.el"
"ob-groovy.el" "ob-shell.el" "org-agenda.el" "org-loaddefs.el" 
"ox-md.el"
"ob-haskell.el" "ob-sql.el" "org-archive.el" "org-loaddefs.el~" 
"ox-odt.el"
"ob-java.el" "ob-sqlite.el" "org-attach-git.el" "org-macro.el" 
"ox-org.el"
"ob-js.el" "ob-table.el" "org-attach.el" "org-macs.el" 
"ox-publish.el"
"ob-julia.el" "ob-tangle.el" "org-capture.el" "org-mobile.el" 
"ox-texinfo.el"
"ob-latex.el" "ob.el" "org-clock.el" "org-mouse.el" "ox.el"
"ob-lilypond.el" "oc-basic.el" "org-colview.el" "org-num.el"
"ob-lisp.el" "oc-biblatex.el" "org-compat.el" "org-pcomplete.el"))
 (possibles
  (seq-map (lambda (x)
 (cons (file-name-directory (car x))
   (list (file-name-base (car x)
   (seq-filter
(lambda (x)
  (let ((bn (file-name-nondirectory (car x
(seq-contains-p org-files bn
(lambda (e elt) (s-match (concat "^" e 
"$") elt)
load-history
(let ((uniques (seq-uniq (seq-map 'car possibles
  (if (eq 1 (length uniques))
  (if where ; this is the good outcome
  (car uniques))
(seq-map
 (lambda (dir)
   (let ((joined
  (s-join " "
  (seq-map 'cadr
   (seq-filter
(lambda (e)
  (progn
(equal (car e) dir)))
possibles)
 (s-lex-format "from ${dir} have: 

Re: Fwd: errors when using org-agenda

2021-10-23 Thread Greg Minshall
Tim,

thanks.  i see that it is more complicated.

(and, after fifteen years of vi, and now 25 of emacs, i guess i'll skip
the spacemacs experience.  :)

cheers, Greg



Re: org-capture broken?

2021-10-23 Thread Greg Minshall
Ihor,

> > make of org mode?  (remote possibility: emacs?)
> 
> Org mode build process is not standard.  Org mode needs to create
> autoload file and generate documentation in addition to normal
> byte-compilation.

thanks.  does that mean running "make" in the org directory?

cheers, Greg



Re: Fwd: errors when using org-agenda

2021-10-23 Thread Greg Minshall
Tim, et al.,

> These types of errors are frequently caused by a 'mixed' installation
> of org versions. This will happen if you upgrade org when org is
> already loaded in the instance of emacs used to perform the upgrade.

a question: is there any way that we can, as org starts up, detect
either the actuality, or possibility, of a mixed installation?
maybe something like

(assert (eq 1
(length
 (seq-filter
  (lambda (d) (file-exists-p (concat d "/" "org.el")))
  load-path

or some such?  (well, maybe fail in a more user-friendly way... :)

cheers, Greg



Re: org-capture broken?

2021-10-21 Thread Greg Minshall
Ihor,

> Fixed on current main (5315773e8).

confirmed.  thanks!

from a previous e-mail (but, for my future reference):

> Are you on Emacs 24?

i'm on

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27,
cairo version 1.17.4) of 2021-03-26


> Can you try to run make before your emacs -Q -L...?

make of org mode?  (remote possibility: emacs?)

cheers, Greg



Re: [BUG] "args out of range" on link heading completion [9.5 (9.5-gd361c7 @ /Users/carlos/.emacs.d/straight/build/org/)]

2021-10-21 Thread Greg Minshall
Carlos,

> > ps -- the org-version was
> > : Org mode version 9.5 (9.5-gdc154f @
> > /home/minshall/.emacs.d/straight/build/org/)

> What are these? Seemingly not git revisions. Can I checkout that
> version somehow? If not, pass me your git revision and I will rerun my
> recipe there.

my belief (fwiw) is that the "9.5" is the major release, and the
"dc154f" (after the "9.5-g") is the first 6 characters of the git commit
i happened to be running).

i see that Ihor has reproduced your problem.

cheers, Greg



org-capture broken?

2021-10-21 Thread Greg Minshall
hi.  with a recent org-mode (*), `org-capture` seems to crash with the
message:

Variable binding depth exceeds max-specpdl-size


this happens with (a suitably -L'd) `emacs -Q`
- M-x org-capture
- t
- then crashes

after this crash, i seem to be unable to enter the debugger, etc.
(`(setq debug-on-error t)`) doesn't work after this crash.  my only
recourse appears to be to exit emacs.

stepping through the code, the last routine
was`org-capture-fill-template`.

stepping through this routine, it gets as far as `(org-mode))` in (i
assume)

  (let ((org-inhibit-startup t)) 

and, in "that" routine, the (presumably) infinite recursion/loop
happens.

i'm loathe (intimidated) to follow the trail into the main code.  i
wonder if anyone might have any ideas?

cheers, Greg

(*)
Org mode version 9.5 (9.5-ga149fd @ /home/minshall/.emacs.d/straight/build/org/)



Re: [BUG] "args out of range" on link heading completion [9.5 (9.5-gd361c7 @ /Users/carlos/.emacs.d/straight/build/org/)]

2021-10-20 Thread Greg Minshall
Carlos,

fwiw, using

: emacs -Q -L ~/.emacs.d/straight/build/org foo.org

on my system, i don't seem to be able to recreate this problem.

cheers, Greg

ps -- the org-version was
: Org mode version 9.5 (9.5-gdc154f @ 
/home/minshall/.emacs.d/straight/build/org/)



Re: "begin_src R :session" opens R session when file first visited

2021-10-16 Thread Greg Minshall
Bill,

> I run Org from the source tree, and recently (a couple of weeks ago or
> so) something new started happening with my Org files with R source
> blocks:  when I open one up, an R session automatically starts,
> without me doing anything.

i don't see that behavior.  does it do this for 'emacs -Q' (suitably
tailored to load org mode, set `org-babel-load-languages`, etc.)?

cheers, Greg



Re: How to keep getting org updates

2021-10-13 Thread Greg Minshall
hi, Tim,

> I think it is always a mistake to google for answers without first
> checking what Emacs has in the built-in documentation and manual. What
> is in the Emacs manual or docstrings for variables and functions is
> guaranteed to be accurate for the version of Emacs your running. What
> you find googling and serching reddit, stack overflow, etc is more often
> than not outdated and from what I've seen, often incorrect. A little
> time getting to learn the help commands bound to C-h will save you much
> time in the long run.  

this is undoubtedly true, though i certainly find myself googling a fair
amount, comparing answers to see if there is consensus.  and, then,
often, using those results to dive into the manual (or the mailing list
archives) to see if i can find "official" guidance.

> Running C-h d v package-pinned-packages shows the following, which
> explains how to set the variable for pinning packages.

for example, i might google, and find that `package-pinned-packages` was
a variable of interest.

i strongly agree that staying an "out-of-the-box" user, setting options
with Emacs' customization interface (and, i guess, using ELPA), is the
way to go if you want to be spared of many details (which can be
daunting, and are approximately infinite :).

but, all that said, didn't some of us on the list (even, iiuc, "out of
the box" users) have problems upgrading from previous ELPA'ish versions
of org-mode to the 9.5 version, because of the confusion of ELPA (?)
non-semantic version numbers appearing to be greater than "9.5"?  that
was really what i was considering, and wondering how to document that
issue in the info pages, so the official documentation will, in fact,
help people upgrade.  (though maybe the answer here is, "stay with the
non-gnu ELPA [or base Emacs] version of org-mode you are currently using
until you upgrade to Emacs 28, at which point you will automatically
follow the box to org-mode 9.5"?)

cheers, Greg



Re: How to keep getting org updates

2021-10-13 Thread Greg Minshall
> The install instructions on the main org page were not very clear, to
> say the least.

yes, that does sound messy.  sorry your experience was so unfortunate.

i guess one question for the list: is there a general solution to the
"20200912" > "9.5" issue?  or, "now" that we are only distributing via
[git repository and] gnu elpa, will that issue disappear?  does this
new-fangled concept of "semantic versioning" come into play here?

possibly in the info pages we could have a section on
"re-installing/upgrading", to help people navigate this process.  (once
we, ourselves, have a map.)

cheers, Greg



Re: How to keep getting org updates

2021-10-11 Thread Greg Minshall
Lawrence,

in case it helps, my *straight.el* (not package.el) recipe looks like
this:

(org :type git :repo
 "https://git.savannah.gnu.org/git/emacs/org-mode.git; :local-repo "org"
 :depth full :pre-build (straight-recipes-org-elpa--build) :build (:not
 autoloads) :files (:defaults "lisp/*.el" ("etc/styles/"
 "etc/styles/*")))


cheers, Greg



  1   2   3   4   >