[O] Error handling in org-make-link-string

2018-04-13 Thread Bob Newell
Aloha,

I've got a subsystem for capturing snippets of information (I mentioned
it here, scraps.el, quite some while back). Some information is captured
from w3m or eww browser buffers.

To do this I use org-w3m-copy-for-org-mode or
org-eww-copy-for-org-mode. This is nice in that links are converted to
org-mode links, using org-make-link-string.

The problem? When org-make-link-string encounters an empty link (it
doesn't happen often but it does happen), it uses the 'error' function
to say that the link is empty. This means that the entire call to
org-xxx-copy-for-org-mode is aborted, and consequently nothing is
captured.

Should this be the desired behavior?

It doesn't quite work for me, but I'm not sure about other uses, side
effects, etc. Someone more familiar with org-mode code would have to
decide. My workaround, since I don't want to modify org.el directly and
have to maintain the mod, is this fairly primitive idea:

(defun rjn-around-omls (orig-fun link  args)
  (if (org-string-nw-p link)
  (apply orig-fun link args)
  nil))
(advice-add 'org-make-link-string :around #'rjn-around-omls)

This works fine for me in that an empty link is simply returned as nil
and ignored. (I suppose I could add an error message.)

Any thoughts on (a) is the 'error' return the right thing, and (b) this
workaround?

Mahalo,

-- 
Bob Newell
Honolulu, Hawai`i
* Via Gnus/BBDB/Org/Emacs/Linux *



Re: [O] git push to Worg error

2018-04-13 Thread stardiviner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256


Jay Kamat  writes:

> I'm not sure if anything changed since you sent this, but I'm able to
> push to my forked repo on code.orgmode.org just fine.
>

You mean you forked https://code.orgmode.org/bzg/worg.git ? Not push to
this repo directly?

- --
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-BEGIN PGP SIGNATURE-

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrRUmEACgkQG13xyVro
msOXgwf+L5/aq3OVG45Q+BXU2ye6MYJepaPUnIcWikdKg6dpabvg1GKqV1TQwT2a
QFF+MkN64jBipVSHikVDsK3rU9tKqNbTbpGK4clYdB/Srg6CO8KZnA7GFhlTwMg5
V6nOFIBlHj69CjJXYM9eRs/OM9V22RgVwcEAdxX+UeQph+DqfeHwGGmGI8rf49Pp
qSjICclg5RvV2rhCCY3dXsVzZAMfIoR8PV27wUQ5Mgn63AuKy+LHUotNraLDGJdp
fF67CJJjK/Q6bRTy7I32jZO6jVwfoR53Q4pOWEmZefA8p0VvTdtuqSmhLZgqOScE
36/cRhTtaEfzXk6T5GYyxBTQQTXERQ==
=DX1F
-END PGP SIGNATURE-



Re: [O] How to set org-make-link-description-function

2018-04-13 Thread Eric Abrahamsen
John Kitchin  writes:

> Here is a globally defined version that would let you define a function for 
> any other kind of link I think. There are probably many
> variations on this theme, like storing functions in some variable as an 
> alist, etc. Something like that is what would happen if this was
> defined in the link parameters.

I do think putting this in the link parameters is the way to go. I'm
impressed you got a working solution together so quickly, but that's way
more than package authors should have to deal with!

Actually, it could be something as simple as: if the :complete function
returns a cons cell, use the `car' as the link and the `cdr' as the
description default. Surely that would be enough?

Eric




Re: [O] git push to Worg error

2018-04-13 Thread Jay Kamat
I'm not sure if anything changed since you sent this, but I'm able to
push to my forked repo on code.orgmode.org just fine. 

-Jay

stardiviner  writes:

> I got following error when I push to Worg repo.
>
>   0 git … remote set-url --add origin https\://code.orgmode.org/bzg/worg.git
>   0 git … remote set-url --delete origin 
> \^git\@code\\.orgmode\\.org\:bzg/worg\\.git\$
>   1 git … push -v origin master\:refs/heads/master
> Pushing to https://code.orgmode.org/bzg/worg.git
> Counting objects: 18, done.
> Writing objects: 100% (18/18), 5.87 KiB | 1.17 MiB/s, done.
> Total 18 (delta 13), reused 0 (delta 0)
> POST git-receive-pack (6160 bytes)
> Password for 'https://stardivi...@code.orgmode.org': 
> POST git-receive-pack (6160 bytes)
> error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403 
> Forbidden
> fatal: The remote end hung up unexpectedly
> fatal: The remote end hung up unexpectedly
> Everything up-to-date
>
> I have uploaded my SSH key to code.orgmode.org already.
>
> Magit prompt to ask for password: https://stardivi...@code.orgmode.org
> I inputted the password. But still upper error.


signature.asc
Description: PGP signature


Re: [O] How to set org-make-link-description-function

2018-04-13 Thread John Kitchin
Here is a globally defined version that would let you define a function for
any other kind of link I think. There are probably many variations on this
theme, like storing functions in some variable as an alist, etc. Something
like that is what would happen if this was defined in the link parameters.

#+BEGIN_SRC emacs-lisp
(defun my-comp ( arg)
  (format "fruit:%s"
  (completing-read "Choose a fruit: " '("apple" "orange" "grapes"
"kiwi"

(org-link-set-parameters "fruit"
 :complete 'my-comp)


(defun org-fruit-make-link-description (link desc)
  (replace-regexp-in-string "fruit:" "" link))


(setq org-make-link-description-function
  (lambda (link desc)
(let* ((link-type (car (s-split ":" link)))
   (make-func (intern (format "org-%s-make-link-description"
link-type
  (if (fboundp make-func)
  (funcall make-func link desc)
desc
#+END_SRC

John

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


On Fri, Apr 13, 2018 at 10:23 AM, Eric Abrahamsen 
wrote:

> John Kitchin  writes:
>
> > Not with the way I wrote it. It should only affect your links and pass
> everything else through I
> > think.
>
> I just meant, you can only have one of these functions set. So if I
> provide special behavior for ebdb links, no other function would be able
> to do the equivalent for some other type of link.
>
>
>


Re: [O] M4 support take#2

2018-04-13 Thread Nicolas Goaziou
Hello,

Brad Knotwell  writes:

> Given the code review from earlier, I've added a second file with the
> requested changes.

Thank you. Some minor comments follow.

> (defconst org-babel-header-args:m4
>   '((:cmd-line . :any)
> (:quote . :any)
> (:unquote . :any)
> (:list-start . :any)
> (:list-end . :any)
> (:prefix-builtins))

Missing allowed type for last header. Maybe :any ?

> (defun org-babel--m4-prefix (params)
>   "Prefix m4_ if :prefix-builtins is set"
>   (if (assq :prefix-builtins params) "m4_" ""))
>
> (defun org-babel--m4-changequote (params)
>   "Declare quoting behavior if start-quote and end-quote are set.  Otherwise, 
> return an empty string."

The line is too long. The second sentence should go onto another line.

>   (let ((prefix (org-babel--m4-prefix params))
>   (start-quote (cdr (assq :quote params)))
>   (end-quote (cdr (assq :unquote params
> (if (and start-quote end-quote) (format "%schangequote(%s,%s)%sdnl\n" 
> prefix start-quote end-quote prefix) "")))

See above.

> (defun org-babel--variable-assignment:m4_generic (params varname values)
>   "Build the simple macro definitions prepended to the script body."
>   (let ((prefix (org-babel--m4-prefix params)))
>   (format "%sdefine(%s,%s)%sdnl\n" prefix varname values prefix)))

The (format ...) is not correctly indented.

> (defun org-babel--variable-assignment:m4_list (params varname values)
>   "Build the complex macro definitions prepended to the script body."
>   (let ((prefix (org-babel--m4-prefix params))
>   (list-start (or (cdr (assq :list-start params)) "["))
>   (list-end (or (cdr (assq :list-end params)) "]")))
> (format "%sdefine(%s,%s%s%s)%sdnl\n" prefix varname list-start
>   (mapconcat
>(lambda (value)
>  ;; value could be a numeric table entry as well as a string
>  (if (= (length value) 1) (format "%s" (car value))
>(concat list-start (mapconcat (lambda (x) (format "%s" x)) 
> value ",")
>list-end))) values ",") list-end prefix)))

The line is too long. `values' should be below (lambda ...), so does
",". `list-end' and `prefix' should be below "%sdefine..."

> (defun org-babel--variable-assignments:m4 (params varnames values)
>   "Internal helper that converts parameters to m4 definitions."
>   (pcase values
> (`(,_ . ,_) (org-babel--variable-assignment:m4_list params varnames 
> values))
> (_ (org-babel--variable-assignment:m4_generic params varnames values
>
> (defun org-babel-variable-assignments:m4 (params)
>   "Interface function that converts parameters to m4 definitions."
>   (concat (org-babel--m4-changequote params)
> (apply #'concat (mapcar (lambda (pair) 
> (org-babel--variable-assignments:m4
> params (car pair) (cdr pair)))
> (org-babel--get-vars params)

(mapcar ...) should be below #'concat.

> ;; Required to make tangling work
> ;; The final "\n" is needed as GNU m4 errors out if a file doesn't end in a 
> newline.
> (defun org-babel-expand-body:m4 (body params)
>   "Expand BODY according to PARAMS, return the expanded body."
>   (concat (org-babel-variable-assignments:m4 params) body "\n"))
>
> (defun org-babel-execute:m4 (body params)
>   "Execute a block of m4 code with Org Babel.
> BODY is the source inside a m4 source block and PARAMS is an
> association list over the source block configurations.  This
> function is called by `org-babel-execute-src-block'."
>   (message "executing m4 source code block")
>   (let* ((result-params (cdr (assq :result-params params)))
>  (cmd-line (cdr (assq :cmd-line params)))
>(prefix-builtins (assq :prefix-builtins params))
>(code-file (let ((file (org-babel-temp-file "m4-")))
>   (with-temp-file file
>   (insert (org-babel-expand-body:m4 body params) file)) 
> file))

Last `file' should be below (let ((file ...))).

>(stdin (let ((stdin (cdr (assq :stdin params
>  (when stdin
>(let ((tmp (org-babel-temp-file "m4-stdin-"))
>  (res (org-babel-ref-resolve stdin)))
>  (with-temp-file tmp
>(insert res))
>  tmp
>  (cmd (mapconcat #'identity
>(remq nil
>  (list org-babel-m4-command
>cmd-line (if prefix-builtins "-P") "<" 
> code-file))

(and prefix-builtins "-P")

"<" and `code-file' should go below `#'identity'.

I cannot remember: do you plan to have it integrated into Org proper? If
so, have you started the process of signing FSF papers?

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] Org manual without correct org-version

2018-04-13 Thread Nicolas Goaziou
Hello,

Vladimir Lomov  writes:

> I'm using org-mode from git and found that now it is not show the
> 'git' version but simply 9.1 in Info file. In doc/ there is
> 'org-version.inc', it is included into 'orgguide.texi' but not in
> 'org.texi'.
>
> As I understand the 'org.texi' is generated from 'org-manual.org', so
> 'org-manual.org' should either somehow includes that file or provide
> other way to get version information.

Why should it include the exact commit? Manual is for users. I'm not
sure this has any value.

Actually, "org-manual.org" strips, on purpose, the bugfix number and the
commit release.

Regards,

-- 
Nicolas Goaziou



Re: [O] How to set org-make-link-description-function

2018-04-13 Thread Eric Abrahamsen
John Kitchin  writes:

> Not with the way I wrote it. It should only affect your links and pass 
> everything else through I
> think.

I just meant, you can only have one of these functions set. So if I
provide special behavior for ebdb links, no other function would be able
to do the equivalent for some other type of link.




[O] org-calc-default-modes not found!

2018-04-13 Thread AW
Dear list!

org-version: Org mode version 9.1.9 (9.1.9-8-gf05c2e-elpa @ .../.emacs.d/elpa/
org-20180409/)

[I shortened the path]

C-h v org-calc TAB

results in [No match]

Expected result: find variable org-calc-default-modes

But I'd like to set (float 8) to (float 16) in orgtbl-mode tables, because 
when I export them to LaTex, in my case I get some rounding errors I'd like to 
avoid. 

However, I'm really concerned about the fact that the whole variable isn't 
found.

org-table.el is there and it contains the variable. I loaded org-mode via 

(add-to-list 'package-archives
 '("org" . "https://orgmode.org/elpa/;) t)

No other org-mode around, as far as I can see. 

For testing  I inserted into my .emacs under custom-set-variables these lines:

'(org-calc-default-modes
   (quote
(calc-internal-prec 12 calc-float-format
(float 16)
calc-angle-mode deg calc-prefer-frac nil 
calc-symbolic-mode nil 
calc-date-format
( "-" MM "-" DD " " Www
  (" " hh ":" mm))
calc-display-working-message t)))

As far as I can see, the calculation is correct, Example:

| 105000200.77 |
| 105000400.05 |
|--|
| 21600.82 |
#+TBLFM: @3$1=@1$1+@2$1

But why is the variable not found?

Regards,

Alexander



Re: [O] How to display babel src block language on exported PDF code block?

2018-04-13 Thread John Kitchin
You can add an export menu of your own:

(defun my-src-block (src-block contents info)
  (concat "got you\n" (org-latex-src-block src-block contents info)))

(org-export-define-derived-backend 'my-latex 'latex
  :translate-alist '((src-block . my-src-block))
  :menu-entry
  '(?z "my special exporter"
   ((?o "pdf and open" (lambda ( args)
 (let ((texfile (org-export-output-file-name ".tex"))
   (pdffile (org-export-output-file-name ".pdf")))
   (org-export-to-file 'my-latex texfile)
   (ox-manuscript-latex-pdf-process texfile)  ;; scimax function, you
might do something else here.
   (org-open-file pdffile)))

Then: C-c C-e z o



John

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


On Thu, Apr 12, 2018 at 5:33 PM, stardiviner  wrote:

> I recently switched email client from Thunderbird to
> mu4e+getmail+procmail. Found missed many my related messages because my
> wrong procmail rules. Missed this too. I found on Thunderbird again.
>
> On 04/06/2018 11:32 AM, John Kitchin wrote:
>
> I have done soemthing like this before:
>
> ;; custom exporter
> (org-export-define-derived-backend 'my-latex 'latex
>   :translate-alist '((src-block . my-src-block)))
>
> (org-export-to-file 'my-latex "manuscript.tex" nil nil nil nil nil)
> (ox-manuscript-latex-pdf-process "manuscript.tex")
>
>
> Is it possible to not manually export file, I want it is integrated into
> Org-mode [C-c C-e l] seamlessly. Do I have to inherit `'latex` backend and
> create a new variant `'my-latex' backend? then export manually? Maybe use
> some kind of modification of default list values to replace or append?
> What do you think?
>
>
>
> John
>
> ---
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
> On Thu, Apr 5, 2018 at 7:01 PM, stardiviner  wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA256
>>
>> By default org-mode export to PDF file does not have language indicator
>> on code block.
>> How to setup to add a language string on exported PDF code block like
>> this HTML https://stardiviner.github.io/ ?
>> - --
>> [ stardiviner ] don't need to convince with trends.
>>Blog: https://stardiviner.github.io/
>>IRC(freenode): stardiviner
>>GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>>
>> -BEGIN PGP SIGNATURE-
>>
>> iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrG1RIACgkQG13xyVro
>> msP0UQf/aPrlTV1ZreOrTmKuqo9rA28u/vtX266EtmOFOwB/y50pazkT5YdFLHKW
>> HUGyFFrWxBtTTCA9KW6/OJ49AB6kXoHSdj98jyCkRroroaT9mqtWdY9Xi8DRogqA
>> SCWOjjybOSEGlWsmu1gwXs0yNgqQijJR03JbMZoTcuDFctdFSk4XnnebfLiN20Ix
>> 56fdVBMRotTFv6CCcvYZncyCp1POJQ6JtlwP3GDQufrgPy2uxZJGHUzPx9BUj4Bg
>> TDERPlDVjSZckc6uP6tIhzGm1PqklG34E770r3By66yeLEMaW1B6QX3IPrJ4oh7w
>> yhfty2UfsLQfiKyykqnt6+0SHM9IHg==
>> =cLnk
>> -END PGP SIGNATURE-
>>
>>
>
>


Re: [O] [OT] org-mode bindings in markdown-mode?

2018-04-13 Thread John Kitchin
I think lentic is the wrong tool for this. I think it is most useful with
mixed markups, e.g. code in some language, and comments in org/md/...

Your best solution in md is probably to create your own key-bindings that
are similar to what you use in org-mode, but that use functions from
https://jblevins.org/projects/markdown-mode/ to get something kind of close.

John

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


On Fri, Apr 13, 2018 at 7:38 AM, Marcin Borkowski  wrote:

>
> On 2018-04-13, at 15:14, Matt Price  wrote:
>
> > Hi eveyrone,
> >
> > I'm using markdown more and more in collaborative projects (sigh). I am
> > getting used to the syntax but it drives me crazy not to be able to edit
> > document structure with commands like C-return,, M-return, etc.  Does
> > anyone have a solution for this that works with recent versions of org?
> I'm
> > not up to date on the current status of various projects to extend org
> > bindings outside of org.
>
> Just wondering whether the lentic mode
> (https://github.com/phillord/lentic) with an org->md transformation
> could help.  (I haven't yet used lentic, so I might be competely wrong.)
>
> I'm CC'ing Phillip, who is the right person to comment on this idea.
>
> Best,
>
> --
> Marcin Borkowski
> http://mbork.pl
>
>


Re: [O] [OT] org-mode bindings in markdown-mode?

2018-04-13 Thread Marcin Borkowski

On 2018-04-13, at 15:14, Matt Price  wrote:

> Hi eveyrone,
>
> I'm using markdown more and more in collaborative projects (sigh). I am
> getting used to the syntax but it drives me crazy not to be able to edit
> document structure with commands like C-return,, M-return, etc.  Does
> anyone have a solution for this that works with recent versions of org? I'm
> not up to date on the current status of various projects to extend org
> bindings outside of org.

Just wondering whether the lentic mode
(https://github.com/phillord/lentic) with an org->md transformation
could help.  (I haven't yet used lentic, so I might be competely wrong.)

I'm CC'ing Phillip, who is the right person to comment on this idea.

Best,

-- 
Marcin Borkowski
http://mbork.pl



[O] git push to Worg error

2018-04-13 Thread stardiviner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

I got following error when I push to Worg repo.

  0 git … remote set-url --add origin https\://code.orgmode.org/bzg/worg.git
  0 git … remote set-url --delete origin 
\^git\@code\\.orgmode\\.org\:bzg/worg\\.git\$
  1 git … push -v origin master\:refs/heads/master
Pushing to https://code.orgmode.org/bzg/worg.git
Counting objects: 18, done.
Writing objects: 100% (18/18), 5.87 KiB | 1.17 MiB/s, done.
Total 18 (delta 13), reused 0 (delta 0)
POST git-receive-pack (6160 bytes)
Password for 'https://stardivi...@code.orgmode.org': 
POST git-receive-pack (6160 bytes)
error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403 
Forbidden
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

I have uploaded my SSH key to code.orgmode.org already.

Magit prompt to ask for password: https://stardivi...@code.orgmode.org
I inputted the password. But still upper error.

- -- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  
-BEGIN PGP SIGNATURE-

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrQwJUACgkQG13xyVro
msN2vQgAwWSMxiibEUO5SNNo71aDJLzueTfW70b+o13InkemuqmK4PV+bfJ5KcEF
SGUU96S98wBTOuQbnBoit9aBRVgFUYnO/pZEYwC+jNoAmW1dSrnT2YJlkVuyvIQY
kAGbRKKIH0qd4uWmnprv6zqEzTHlv+U48JUSMz7IqdYsrwXZqSxKQi0CupMLDpIV
+EGiiUGZv1+bCjLmGoKYqT9M12G1+TKW3ERHqUbYCkfuq2nREA28GMvqQNfo7mYb
GwZKjy1gx9hiuxbUHnFGLZjU1NT1HwzwGLQArWAPIgbxgj+Z5DIk+SNIph86+zFN
+TbhEem5oBaWj7j/XpfEs1ruC9jciQ==
=DCjZ
-END PGP SIGNATURE-



[O] Problems created by inlinetasks in agenda views

2018-04-13 Thread Alain . Cochard

Hello.  I have the file (with name 'bug.org'):

* foo :foofoofoo:
*** TODO an inlinetask
foo
*** END
barXXX


(1) 'C-c a m foofoofoo'

gives be

Headlines with TAGS match: foofoofoo
Press `M-0 r' to search again with new search string
  bug:foo:foofoofoo:
  bug:..TODO an inlinetask  :foofoofoo::
  bug:..END :foofoofoo::

which I do not find really normal.

(2) Similarly 'C-c a s barXXX'

gives me

Search words: barXXX
Press `[', `]' to add/sub word, `{', `}' to add/sub regexp, `M-0 r' to edit
  bug:END :foofoofoo::


I have:
Org mode version 9.1.2 (9.1.2-32-g271e58-elpa @
/home/cochard/.emacs.d/elpa/org-20171106/)

Regards,
Alain

PS: Also, is that normal that inlinetaks are virtually not documented
in the manual?

-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France| Fax:   +33 (0)3 68 85 01 25 



[O] Making a variable persistent when refreshing the agenda

2018-04-13 Thread Luke
I like to be able to view a list of tasks that need to be done today, 
along with warnings of any upcoming deadlines within the next few days. 
The number of "deadline warning days" that I require varies from time to 
time, so I have one of my agenda commands set up like so:


("d" "Daily Action List"
 ((agenda
   ""
   ((org-agenda-overriding-header "== TO BE DONE TODAY ==")
(org-agenda-span
 (quote day))
(org-agenda-skip-deadline-prewarning-if-scheduled t)
(org-agenda-sorting-strategy
 (quote
  (habit-up time-up todo-state-up deadline-up timestamp-up 
priority-down)))
(org-deadline-warning-days
 (string-to-number
  (read-string "Number of warning days [0]: " nil nil "0")))

This allows me to interactively specify the number of "deadline warning 
days" when creating the agenda. Sometimes I need to refresh the agenda 
(org-agenda-redo), but this means that I need to re-enter the "Number of 
warning days" each time the agenda refreshes.


What I would like to do is somehow store the value within the agenda, 
and use the stored value when refreshing the agenda (rather than 
re-entering it each time org-agenda-redo is called).


I know that agenda filters persist when the agenda is refreshed, so I'm 
looking to do something similar with my custom value. I've experimented 
with trying to set the variable as a buffer local value, but without 
success.


Is this possible? If so, any ideas how?

--
Luke




[O] [PATCH] ob-clojure.el and ob-clojure-literate.el support new header argument :ns

2018-04-13 Thread stardiviner

After about 5 times test, And about 4 times review. I decide to PR.

About new header argument :ns, I don't know how to write the test for it
with loading CIDER in ERT. So have not write test. But I load my patch
code, and run test on the following examples works fine.

#+begin_src clojure :results pp
;; (def greeting "hi there!")
*ns*
#+end_src

#+RESULTS[<2018-04-13 20:37:16> f6f68aecdefcfd1be88fb144d47f5881f47b95db]:
: #namespace[user]

#+begin_src clojure :results pp
(ns kk.test)
(def he "hi")
#+end_src

#+RESULTS[<2018-04-13 20:37:24> 0b564a90ba588ba72b622a217834057600ac6d07]:
: #'kk.test/he

Deeper testing:

#+begin_src emacs-lisp :results pp
(nrepl-sync-request:eval
 "(clojure.pprint/pprint (do (ns user)\n (ns kk.test)\n (def he 2)))"
 (cider-current-connection)
 "user"
 )
#+end_src

#+RESULTS[<2018-04-13 20:37:39> a05d9349d3b991a7fd47fb4ed268bf7e40f53e7a]:
: (dict "status"
:   ("done" "state")
:   "id" "20" "out" "#'user/he\n" "session" 
"72ab6c95-08d4-4873-b83b-31c66aa26d62" "ns" "kk.test" "value" "nil" 
"changed-namespaces"
:   (dict)
:   "repl-type" "clj")

#+begin_src clojure :results value :ns kk2
(def he "hi")
*ns*
#+end_src

#+RESULTS[<2018-04-13 20:38:09> 89b32544ad50101e9f6f529a9e87a7bb86235cd9]:
: nil#'kk2/he#namespace[kk2]

What about another src block without ~:ns~ specified after previous specified 
src block?

#+begin_src clojure :results value
(def he "hi")
*ns*
#+end_src

#+RESULTS[<2018-04-13 20:38:14> 85a2890ea59d198e2d1c771e2b80b1ae6335c416]:
: nil#'user/he#namespace[user]

More complex example:

#+begin_src clojure :results output :var he="hi" :ns kk
;; (def he "hi")
(prn he)
(prn *ns*)
#+end_src

#+RESULTS[<2018-04-13 20:38:19> 9f6d74be8c54e2bc1b5047b569ddc6514c789cf0]:
: "hi"
: #namespace[kk]

From 1a0d80c000384b929b84a3755669e0d44c662558 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 22 Mar 2018 01:21:22 +0800
Subject: [PATCH 1/6] * ob-clojure-literate.el: CIDER jack-in outside of
 project by default.

---
 contrib/lisp/ob-clojure-literate.el | 50 +
 1 file changed, 30 insertions(+), 20 deletions(-)

diff --git a/contrib/lisp/ob-clojure-literate.el b/contrib/lisp/ob-clojure-literate.el
index a7ab1894d..8d419b0b4 100644
--- a/contrib/lisp/ob-clojure-literate.el
+++ b/contrib/lisp/ob-clojure-literate.el
@@ -35,8 +35,10 @@ Don't auto jack in by default for not rude."
   :type 'boolean
   :group 'ob-clojure-literate)
 
-(defcustom ob-clojure-literate-project-location (concat user-emacs-directory "Org-mode/")
-  "The location for `ob-clojure-literate' scaffold project."
+(defcustom ob-clojure-literate-project-location nil
+  "The location for `ob-clojure-literate' scaffold project.
+If it is nil, then `cider-jack-in' will jack-in outside of Clojure project.
+If it is a directory, `ob-clojure-literate' will try to create Clojure project automatically."
   :type 'string
   :group 'ob-clojure-literate)
 
@@ -45,7 +47,7 @@ Don't auto jack in by default for not rude."
 (defvar ob-clojure-literate-session-ns nil)
 (defvar ob-clojure-literate-cider-connections nil)
 
-(defcustom ob-clojure-literate-default-session "*cider-repl ob-clojure*"
+(defcustom ob-clojure-literate-default-session "*cider-repl localhost*"
   "The default session name for `ob-clojure-literate'."
   :type 'string
   :group 'ob-clojure-literate)
@@ -104,23 +106,31 @@ Don't auto jack in by default for not rude."
 (defun ob-clojure-literate-auto-jackin ()
   "Auto setup ob-clojure-literate scaffold and jack-in Clojure project."
   (interactive)
-  (unless (file-directory-p (expand-file-name ob-clojure-literate-project-location))
-(make-directory ob-clojure-literate-project-location t)
-(let ((default-directory ob-clojure-literate-project-location))
-  (shell-command "lein new ob-clojure")))
-  (unless (or
-   (and (cider-connected-p)
-(if (not (null ob-clojure-literate-session))
-(seq-contains cider-connections (get-buffer ob-clojure-literate-session
-   cider-connections
-   (not (null ob-clojure-literate-session)))
-;; return back to original file.
-(if (not (and (= (length (ob-clojure-literate-get-session-list)) 1)
-  (-contains-p (ob-clojure-literate-get-session-list) ob-clojure-literate-default-session)))
-(save-window-excursion
-  (find-file (expand-file-name (concat ob-clojure-literate-project-location "ob-clojure/src/ob_clojure/core.clj")))
-  (with-current-buffer "core.clj"
-(cider-jack-in))
+  (cond
+   ;; jack-in outside of Clojure project.
+   ((null ob-clojure-literate-project-location)
+(if (member (get-buffer "*cider-repl localhost*") cider-connections)
+	(message "CIDER default session already launched.")
+  (cider-jack-in nil)))
+   ((not (null ob-clojure-literate-project-location))
+(unless (file-directory-p (expand-file-name ob-clojure-literate-project-location))
+  

[O] [OT] org-mode bindings in markdown-mode?

2018-04-13 Thread Matt Price
Hi eveyrone,

I'm using markdown more and more in collaborative projects (sigh). I am
getting used to the syntax but it drives me crazy not to be able to edit
document structure with commands like C-return,, M-return, etc.  Does
anyone have a solution for this that works with recent versions of org? I'm
not up to date on the current status of various projects to extend org
bindings outside of org.

Thank you!
Matt


Re: [O] How to get 'repeating footnotes' please?

2018-04-13 Thread Sharon Kimble
"Berry, Charles"  writes:

>> On Apr 10, 2018, at 5:42 AM, Sharon Kimble  
>> wrote:
>> 
>> Samuel Wales  writes:
>> 
>>> [fn:apples: ...]
>>> 
>>> [fn:apples]
>> 
>> I'm sorry Samuel, but it seems like you haven't read all of my initial
>> question, where I stated 'All my footnotes are 4 digits like
>> '[fn:0010]'.' I'm not going to change my habits of using numerical
>> footnotes that have been in documents for over ten years now to alpha
>> footnotes. Sorry, its just not going to happen!
>> 
>> But I am open to any other suggestions which involve numerical
>> footnotes?
>> 
>
>
> Numerical footnotes work the same as alpha AFAICS. So, Samuel's suggestion 
> works, but I think you
> may be asking a question about repeating the *text* of a footnote rather than 
> merely referencing it
> from a different location. If so, there may be a latex solution for you. 
> Perhaps this helps:
>
>   http://www.tex.ac.uk/FAQ-repfootnote.html
>
> and the fixfoot package is what you need.
> ??
>
> If not maybe you can elaborate on what the desired latex should be.

Thanks Chuck.

Yes it is 'repeating text' that I want in my reused footnotes.

The problem with the latex solutions that you've proposed is that they
rely on what I call 'static footnotes' meaning that the footnote number
always stays the same, whereas org-mode uses 'dynamic footnotes' meaning
that if you insert one between 3 and 4 they are automatically renumbered
to "3 and new one 4 and 5".

When you're writing a long document, be it a book or an article or even
a letter and you use footnotes, its very handy for them to be
recalibrated every time that you use or insert a footnote. This
recalibration or automatic renumbering is a godsend I've found, and is
one of the strengths of org-mode, especially when you're memory is
becoming increasingly problematic and you keep forgetting what you want
to say.

And that's why I'm trying to get repeat text in org-modes dynamic
footnotes. In every experiment that I've made using [fn:0001] as my
reference point it has failed, seemingly due to an inability to graft
latex commands into an org-mode dynamic footnote, which is then exported
and published as an latexed PDF.

To help in potentially debugging or getting this going I'm also
including my very minimalist totally nonsensical MWE -

--8<---cut here---start->8---
#+STARTUP: fnadjust
#+LaTeX_class: memoir

* Introduction
# \minitoc

You can also find information about your rights and choices, including refusing 
treatment, setting
down your wishes for your future treatment, and _how_ [fn:1] to give someone 
the legal right to make
decisions for you if you are no longer capable.

# \footnote{how is a banana\label{fn:repeat}}
[fn:1] how is a banana\label{1:how is a banana}

# [fn:1] \footnote{how is a banana\label{fn:repeat}}

** What is palliative care?

It can be delivered alongside particular treatments, such as chemotherapy or 
radiotherapy.
Palliative care helps people with advanced or terminal illnesses have the best 
possible _quality of
life_ [fn:2]. This also includes support for their families.

# Specialist palliative care is typically delivered by a team with diverse 
expertise in caring for
# people with progressive and life-limiting illness.

[fn:2] The individuals's ability to enjoy normal life activities.


*** What is palliative care?

End-of-life care includes palliative care. If you have an illness that can't be 
cured, palliative
care makes you as comfortable as possible, by managing your pain and other 
distressing symptoms. It
also involves psychological, social and spiritual support for you and your 
family or carers. This is
called a holistic approach, because it deals with you as a "whole" _person_. 
\footref{1:repeat}
--8<---cut here---end--->8---

Thanks
Sharon.


[fn:0001] http://www.tex.ac.uk/FAQ-repfootnote.html
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 9.4, fluxbox 1.3.7, emacs 25.3.4, org 9.1.9


signature.asc
Description: PGP signature