Re: [O] [BUG] Re: header argument :noweb-ref seems can't be resolved

2017-12-19 Thread Berry, Charles


> On Dec 19, 2017, at 11:00 AM, Nicolas Goaziou  wrote:
> 
> Since :noweb-ref is the only property that absolutely needs to be
> retrieved from definition, another option would be to write a specific
> function for that.
> 
> It implies some duplicated efforts with `org-babel-get-src-block-info',
> but it is faster when the source name doesn't match, which is the most
> common case, and avoids all side-effects from
> `org-babel-get-src-block-info'.
> 
> WDYT?

Looks pretty clean. I've not had time to try it out, however.

Chuck



Re: [O] possible to store a link to a specific entry in the *texinfo* file?

2017-12-19 Thread Yasushi SHOJI
Hi,

I'm sorry that I miss read your question.

No, org-store-link, or org-info-store-link to be precise, doesn't support
storing the index you just used or you are on.

I'm not sure how to figure out what a user is trying to store is either
the current node or the index.


You can, however, write a link by hand

[[info:elisp#define-minor-mode]]

and org is happy to open and jump to the entry
pointed by the index.

regards,
-- 
yashi



Re: [O] possible to store a link to a specific entry in the *texinfo* file?

2017-12-19 Thread Yasushi SHOJI
Hi,

On Tue, Dec 19, 2017 at 9:57 AM, Shiyao MA  wrote:
> However, org-store-link stores to the node : Stored:
> info:elisp#Defining Minor Modes
> Instead of the exact entry.

I'm not sure what version of Org mode you are using but
at least Org 8.3 supports info index as well as info node in
the same format.

http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=96e1971f0fac6db1ac133faab0f7ed3bc38d96e7
-- 
   yashi



[O] How to include diary anniversary entries into default org-agenda?

2017-12-19 Thread stardiviner

I have an org-mode file:

#+begin_src org
,* Anniversary

,** my first child anniversary

%%(diary-anniversary 10 26 2017)

,** Funeral Arrangement

,*** kk

%%(diary-anniversary 12 8 2007)
#+end_src

How to include and show them in default org-agenda day view by 
configuring org-mode?





Re: [O] [RFC] Dog food, anyone?

2017-12-19 Thread Thomas S. Dye
Aloha Jonathan,

Jonathan Leech-Pepin writes:

>>
>>Just to prevent miscommunication, I wasn't criticizing your work when
>>I wrote I had improved the back-end.
>>
>
> I didn’t take it as criticism, when I’d started working on it the new export 
> engine was still in it’s infancy and a lot of the work you’ve done to improve 
> performance and parsing hadn’t occurred yet.  I’m glad it was complete enough 
> to let Thomas start his work and give you a basis for improving to allow for 
> a full manual.

I remember that working with you, and with your software, was a real
pleasure.  Like you, I'm pleased our work provided some basis for
Nicolas' accomplishment.

All the best,
Tom

--
Thomas S. Dye
http://www.tsdye.com



Re: [O] [RFC] Dog food, anyone?

2017-12-19 Thread Jonathan Leech-Pepin
Hello,

On December 19, 2017 6:11:21 PM EST, Nicolas Goaziou  
wrote:
>Hello,
>
>Jonathan Leech-Pepin  writes:
>
>> As Thomas mentioned I had originally written the exporter.  
>
>I know. You are credited as the author of ox-texinfo.el. Did I mention
>otherwise?
>

It had partially sounded like you were saying both the backend and the work on 
manual.org were his. Might just have been a misinterpretation though.

>> I'd done my best to get it to work with the majority of the org.texi
>> however there were certain features that did not seem to be present
>at
>> the time in Org (or at least no convenient method to simulate them
>> without macros).
>
>Just to prevent miscommunication, I wasn't criticizing your work when
>I wrote I had improved the back-end.
>

I didn’t take it as criticism, when I’d started working on it the new export 
engine was still in it’s infancy and a lot of the work you’ve done to improve 
performance and parsing hadn’t occurred yet.  I’m glad it was complete enough 
to let Thomas start his work and give you a basis for improving to allow for a 
full manual.

>Regards,

-- 
Jonathan



Re: [O] [0] ob-rust, support for rust code blocks

2017-12-19 Thread Nicolas Goaziou
Hello,

Andrés Saraos Luna  writes:

> As a toy project I've written a simple ob-rust, mainly in order to
> prepare some simple demos using rust.

Thank you.

There is another "ob-rust.el" at
. Would it make sense to join
efforts with its author?

> Since I'm not completely sure of the submission protocol for new
> features, the new file lives in contrib for now, although it doesn't
> depend on anything outside of `ob' really so maybe it could be added
> to core?

You need to sign FSF papers for that. Even if it doesn't land in master,
I suggest to start the process as it could take some time, depending on
your country. It would be nice to sort out the issue about 

> As far as testing is concerned, since I don't know how to use the
> database used by `org-test-at-id' I hardcoded the name of the testing
> file, I'd be happy to change that if necessary.

You don't need to use `org-test-at-id'. I even suggest to stay away from
it, as it makes debugging harder. Instead, you could make tests
self-sufficient, e.g.:

(should
 (equal 42
(org-test-with-temp-text "
#+name: test-simple
#+BEGIN_SRC rust :results silent
  fn main() {
  let answer = 42;
  println!("{}", answer);
  }
#+END_SRC"
  (org-babel-execute-src-block

Note that `should' is in the outer part of the test.

> Here's hoping this is useful for others, and since this is my first
> time writing anything functional in elisp I'm gladly open for any
> hints to improve the code.

I have a few suggestion. In particular docstrings should start with one
(or two) sentence(s) filling the first line. Additional sentences need
to start on subsequent lines.

Also, you need to add two spaces at the end of sentences.

> * contrib/lisp/ob-rust.el: Support for limited rust source code in org
>   babel.
>
> * testing/examples/ob-rust-test.org: Test all implemented features of
>   ob-rust in the form of named Org source blocks.
>
> * testing/lisp/test-ob-rust.el: Defines the tests.
>
> TINYCHANGE

This is not a TINYCHANGE :)

> +;; Org-Babel support for evaluating rust code.

Babel support for...

> +;; A currently very limited implementation:
> +;;  - arrays, vecs, lists or tables are not yet supported as header
> +;;  arguments
> +;;  - no error handling
> +;;  - only :results output is supported
> +;;  - cargo is completely ignored
> +
> +(require 'ob)
> +
> +(defvar org-babel-tangle-lang-exts)
> +(add-to-list 'org-babel-tangle-lang-exts '("rust" . "rs"))
> +
> +(defcustom org-babel-rust-command "rustc"
> +  "Name of the rust command."
> +  :group 'org-babel
> +  :type 'string)
> +
> +(defun org-babel-execute:rust (body params)

This function is missing a docstring.

> +  (let* ((full-body (org-babel-expand-body:rust body params))
> + (cmpflag (or (cdr (assq :cmpflag params)) ""))
> + (cmdline (or (cdr (assq :cmdline params)) ""))
> + (default-directory org-babel-temporary-directory)
> + (src-file (org-babel-temp-file "rust-src-" ".rs"))
> + (exe-file (org-babel-rust-exe-file src-file cmpflag))
> + (results))
> +(with-temp-file src-file
> +  (insert full-body)
> +  (when (require 'rust-mode nil t)
> +(rust-format-buffer)))
> +(org-babel-eval
> + (format "%s %s %s" org-babel-rust-command cmpflag src-file) "")
> +(setq results (org-babel-eval (format "%s %s" exe-file cmdline) ""))
> +(org-babel-reassemble-table
> + (org-babel-result-cond (cdr (assq :result-params params))
> +   (org-babel-read results)
> +   (let ((tmp-file (org-babel-temp-file "rs-")))
> + (with-temp-file tmp-file (insert results))
> + (org-babel-import-elisp-from-file tmp-file)))
> + (org-babel-pick-name
> +  (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
> + (org-babel-pick-name
> +  (cdr (assq :rowname-names params)) (cdr (assq :rownames params))
> +
> +(defun org-babel-expand-body:rust (body params)
> +  "Expand a block of rust code with org-babel according to its
> +header arguments."

The sentence must fit on a single line.

Also "Org Babel"

> +(defun org-babel-prep-session:rust (_session _params)
> +  "This function does nothing as C is a compiled language with no
> +support for sessions"
> +  (error "no support for sessions"))

C -> Rust

> +(defun org-babel-load-session:rust (_session _body _params)
> +  "This function does nothing as C is a compiled language with no
> +support for sessions"
> +  (error "no support for sessions"))

Ditto.
> +  (let* ((var (car var-pairs))
> + (val (cdr var-pairs))
> + (value-type (org-babel-rust-val-to-rust-type val))
> + (var-s (symbol-name var))
> + (var-regexp "\\(^mut_\\)?\\([[:alnum:]_]+\\)\\(: ?[[:alnum:]]+\\)?[ 
> \t]*$")
> + (mut
> +  (progn
> +(string-match var-regexp var-s)
> +(match-string 1 

Re: [O] [RFC] Dog food, anyone?

2017-12-19 Thread Nicolas Goaziou
Hello,

Jonathan Leech-Pepin  writes:

> As Thomas mentioned I had originally written the exporter.  

I know. You are credited as the author of ox-texinfo.el. Did I mention
otherwise?

> I'd done my best to get it to work with the majority of the org.texi
> however there were certain features that did not seem to be present at
> the time in Org (or at least no convenient method to simulate them
> without macros).

Just to prevent miscommunication, I wasn't criticizing your work when
I wrote I had improved the back-end.

Regards,

-- 
Nicolas Goaziou



Re: [O] Scheme code evaluation in fresh Emacs

2017-12-19 Thread Nicolas Goaziou
Neil Jerram  writes:

> On 19/12/17 19:30, Nicolas Goaziou wrote:

>> I think it would be worth notifying upstream about it, if you have some
>> spare time.
>
> Sure, but which upstream do you mean?

Geiser. Maybe geiser-default-implementation should autoload geiser-impl
or some such.




Re: [O] [RFC] Dog food, anyone?

2017-12-19 Thread Jonathan Leech-Pepin
Hello Nicolas

On 17 December 2017 at 05:34, Nicolas Goaziou 
wrote:

> Hello,
>
> The task started by Thomas S. Dye a couple years ago is now complete.
> The "manual.org" file in "contrib/" directory is an up-to-date,
> sometimes enhanced, version of the Org manual. Org can now eat its own
> dog food.
>
> During the process, I had to re-organize some parts of the manual (e.g.,
> "Working with source code" section, the concept index...) and improve
> the "texinfo" export back-end, which was not up to the task when Thomas
> started it.
>

As Thomas mentioned I had originally written the exporter.  I'd done my best
to get it to work with the majority of the org.texi however there were
certain
features that did not seem to be present at the time in Org  (or at least no
convenient method to simulate them without macros).

I haven't had the chance to keep up with the exporter or the export engine
in
general, however I'm glad that the manual now can be entirely written in
Org.
That was part of the motivation behind writing the exporter in the first
place.

Regards,

--
Jonathan


Re: [O] [RFC] Dog food, anyone?

2017-12-19 Thread Thomas S. Dye
Aloha Nicolas,

Nicolas Goaziou writes:

> Hello,
>
> "Thomas S. Dye"  writes:
>
>> I find the en-dash with spaces more aesthetically pleasing, too.
>
> Unfortunately, Emacs manual thoroughly uses em-dash. We have to bite the
> bullet, IMO.
>
> I will change " -- " into "---" if there is no objection.

No objection here.

>> Agreed. This is one of the first things we might do if manual.org
>> becomes the official source of the Org manual.
>>
>> FYI, Phil Rooke's Documentation_Standards.org suggests title case for
>> chapter heads and sentence case for section and subsection headings.
>
> OTOH, Emacs manual seems to use title case at every level, barring some
> exceptions (e.g., "Terminal emulator").
>
> Maybe we should stick to title case to every heading that belong to
> a menu, i.e., we can use sentence case for "notoc" headings.
>
> Since Texinfo node names are derived from headlines, it means external
> references to Org manual, if such thing exists, are going to break.
>
> WDYT?

I think we should identify and follow the appropriate style guide, but
I'm confused about what *is* the appropriate style guide.

The style guide for GNU documentation seems more about teaching coders
how to communicate with other humans and less about the nitty-gritty
style issues that send an editor to a guide like the Chicago Manual of
Style. See:

https://www.fsf.org/gnu-press/GNU-Press-styleguide.pdf

Note that the GNU style guide uses sentence case for section heads, and
em-dashes with spaces (" --- ")!

Of course, the TexInfo style guide I cited in an earlier post appears to
have conflicting advice about dashes :(

In the end, the important thing is consistency.  A good document
"trains" its readers how to read it by hewing to a consistent standard.

My recommendation at this point is to follow Phil Rooke's style guide
and augment it where possible. If manual.org becomes the official source
for Org documentation, then it would be useful to "translate" Rooke's
guide to show how to achieve its style prescriptions using Org markup.

hth,
Tom

--
Thomas S. Dye
http://www.tsdye.com



Re: [O] Scheme code evaluation in fresh Emacs

2017-12-19 Thread Neil Jerram

On 19/12/17 19:30, Nicolas Goaziou wrote:

Hello,

Neil Jerram  writes:


When I try to evaluate Scheme code in an Emacs where I haven't yet
done any Geiser/Scheme work, I get an error about
geiser-default-implementation being undefined.  The attached patch
fixes that, but I am not sure if it is the most minimal fix possible.
WDYT?

Thank you. I applied the patch.

I think it would be worth notifying upstream about it, if you have some
spare time.


Sure, but which upstream do you mean?

    Neil




Re: [O] master: org-complete-expand-structure-template gone?

2017-12-19 Thread Uwe Brauer

   > Uwe Brauer  writes:

   > $ git log --grep=org-complete-expand-structure-template
thanks this was the command I was looking for
I tried git log | grep org-complete-expand-structure-template

Which was less powerful

   > There's been a lot of back-and-forth on the list about this.

I frankly never see the benefit of removing  a well known function.




Re: [O] Scheme code evaluation in fresh Emacs

2017-12-19 Thread Nicolas Goaziou
Hello,

Neil Jerram  writes:

> When I try to evaluate Scheme code in an Emacs where I haven't yet
> done any Geiser/Scheme work, I get an error about
> geiser-default-implementation being undefined.  The attached patch
> fixes that, but I am not sure if it is the most minimal fix possible. 
> WDYT?

Thank you. I applied the patch.

I think it would be worth notifying upstream about it, if you have some
spare time.

Regards,

-- 
Nicolas Goaziou



Re: [O] [RFC] Dog food, anyone?

2017-12-19 Thread Nicolas Goaziou
Hello,

"Thomas S. Dye"  writes:

> I find the en-dash with spaces more aesthetically pleasing, too.

Unfortunately, Emacs manual thoroughly uses em-dash. We have to bite the
bullet, IMO.

I will change " -- " into "---" if there is no objection.

> Agreed. This is one of the first things we might do if manual.org
> becomes the official source of the Org manual.
>
> FYI, Phil Rooke's Documentation_Standards.org suggests title case for
> chapter heads and sentence case for section and subsection headings.

OTOH, Emacs manual seems to use title case at every level, barring some
exceptions (e.g., "Terminal emulator").

Maybe we should stick to title case to every heading that belong to
a menu, i.e., we can use sentence case for "notoc" headings.

Since Texinfo node names are derived from headlines, it means external
references to Org manual, if such thing exists, are going to break.

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] Error message triggered by fill.

2017-12-19 Thread Nicolas Goaziou
Hello,

Richard Fieldsend  writes:

> However, I have hit a problem which only occurs in org-mode. On my laptop
> and one of my desktop PCs the org-mode stuff works fine.  But on my main
> work machine when I have an org file I can add text, but when a line gets
> long enough to word-wrap to the next line I get an error:
>
> org-element--cache-find: avl-tree--dummyroot accessing a non-avl-tree-
>
> the line doesn't wrap and the line continues.

Do you have `org-element-use-cache' set to a non-nil value? By default,
Org shouldn't call this function.

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] Re: header argument :noweb-ref seems can't be resolved

2017-12-19 Thread Nicolas Goaziou
Hello,

"Berry, Charles"  writes:

> I guess I was unclear. There are two ways to fix this.
>
> 1) let bind org-babel-current-src-block-location in
> org-babel-expand-noweb-references in the loop that scans for
> noweb-ref'ed src blocks. This fixes the bug, but contradicts the
> docstring for o-b-c-s-b-l, which says it is the location of the
> currently executing src block. Maybe not a big deal, since
> `org-babel-exp-src-block' can export blocks that are not actually
> executed which is another contradiction of the docstring. Maybe change
> the docstring.
>
> 2) rewrite org-babel-params-from-properties to add an optional arg
> `src-block-location' and use it when provided to govern where to look
> up properties. Modify `org-babel-get-src-block-info' accordingly to
> add that arg when calling o-b-p-f-p. This honors the use of
> o-b-c-s-b-l as the location of the executing src block, but inflates
> the code to accommodate just the `noweb-ref' case.
>
> I think `2' is better as it makes clearer where o-b-p-f-p is looking
> for properties when reading the code of org-babel-get-src-block-info.

Since :noweb-ref is the only property that absolutely needs to be
retrieved from definition, another option would be to write a specific
function for that.

It implies some duplicated efforts with `org-babel-get-src-block-info',
but it is faster when the source name doesn't match, which is the most
common case, and avoids all side-effects from
`org-babel-get-src-block-info'.

WDYT?

Regards,

-- 
Nicolas Goaziou
>From ea24f751fd4ec91857d59e2c287754d3d6dc33f1 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Tue, 19 Dec 2017 19:55:51 +0100
Subject: [PATCH] ob-core: Correctly find  Noweb reference

* lisp/ob-core.el (org-babel--noweb-reference): New function.
(org-babel-expand-noweb-references): Use new function.
---
 lisp/ob-core.el | 41 +
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index ade39ec67..bc3c255f5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2662,6 +2662,36 @@ CONTEXT may be one of :tangle, :export or :eval."
 (cl-some (lambda (v) (member v allowed-values))
 	 (split-string (or (cdr (assq :noweb params)) "")
 
+(defun org-babel--noweb-reference (element)
+  "Return Noweb reference for ELEMENT.
+ELEMENT is a source block.  Return value from `:noweb-ref',
+possibly inherited from properties, or nil."
+  (let ((language (org-element-property :language element)))
+(cdr
+ (or (assq :noweb-ref		;from block itself
+	   (org-babel-parse-header-arguments
+		(mapconcat #'identity
+			   (cons (org-element-property :parameters element)
+ (org-element-property :header element))
+			   " ")))
+	 (assq :noweb-ref		;from properties
+	   (org-babel-parse-header-arguments
+		(org-trim
+		 (concat
+		  (and language
+		   (org-entry-get (point)
+  (concat "header-args:" language)
+  'inherit))
+		  " "
+		  (org-entry-get (point) "header-args" 'inherit)
+	 (and language
+	  (let ((lang-headers
+		 (intern (concat "org-babel-default-header-args:"
+ language
+		(and (boundp lang-headers)
+		 (assq :noweb-ref (symbol-value lang-headers)
+	 (assq :noweb-ref org-babel-default-header-args)
+
 (defun org-babel-expand-noweb-references ( info parent-buffer)
   "Expand Noweb references in the body of the current source code block.
 
@@ -2777,11 +2807,14 @@ block but are passed literally to the \"example-block\"."
 			;; those with a matching Noweb reference.
 			(let ((expansion nil))
 			  (org-babel-map-src-blocks nil
-			(let ((i (org-babel-get-src-block-info 'light)))
+			(let ((element (org-element-at-point)))
 			  (when (equal source-name
-	   (cdr (assq :noweb-ref (nth 2 i
-(let ((sep (or (cdr (assq :noweb-sep (nth 2 i)))
-	   "\n")))
+	   (org-babel--noweb-reference element))
+(let* ((i (org-babel-get-src-block-info
+	   'light element))
+   (sep
+	(or (cdr (assq :noweb-sep (nth 2 i)))
+	"\n")))
   (setq expansion
 	(cons sep
 	  (cons (funcall expand-body i)
-- 
2.15.1



[O] Scheme code evaluation in fresh Emacs

2017-12-19 Thread Neil Jerram
When I try to evaluate Scheme code in an Emacs where I haven't yet done 
any Geiser/Scheme work, I get an error about 
geiser-default-implementation being undefined.  The attached patch fixes 
that, but I am not sure if it is the most minimal fix possible.  WDYT?


Best wishes - Neil


>From adceb034b886d1c3624b31f83f8826869cd1b92c Mon Sep 17 00:00:00 2001
From: Neil Jerram 
Date: Tue, 19 Dec 2017 18:15:00 +
Subject: [PATCH] Fix Scheme evaluation in fresh Emacs

* lisp/ob-scheme.el: Require geiser-impl so that
  geiser-default-implementation is defined.  Otherwise, unless Geiser
  has previously been run (e.g. with `run-geiser'), you'll see an
  error that geiser-default-implementation is undefined.
---
 lisp/ob-scheme.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index f67080adf..7dbd78097 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -40,6 +40,7 @@
 ;;; Code:
 (require 'ob)
 (require 'geiser nil t)
+(require 'geiser-impl nil t)
 (defvar geiser-repl--repl) ; Defined in geiser-repl.el
 (defvar geiser-impl--implementation)   ; Defined in geiser-impl.el
 (defvar geiser-default-implementation) ; Defined in geiser-impl.el
-- 
2.15.1



Re: [O] [BUG] Re: header argument :noweb-ref seems can't be resolved

2017-12-19 Thread Berry, Charles


> On Dec 18, 2017, at 11:31 PM, stardiviner  wrote:
> 
> Confirmed. I don't know how to fix this problem, so maybe report to Org-mode 
> ML is the better way. (I changed the message title by prepend [BUG])

I guess I was unclear. There are two ways to fix this.

1) let bind org-babel-current-src-block-location in 
org-babel-expand-noweb-references in the loop that scans for noweb-ref'ed src 
blocks.  This fixes the bug, but contradicts the docstring for o-b-c-s-b-l, 
which says it is the location of the currently executing src block. Maybe not a 
big deal, since `org-babel-exp-src-block' can export blocks that are not 
actually executed which is another contradiction of the docstring. Maybe change 
the docstring. 

2) rewrite org-babel-params-from-properties to add an optional arg 
`src-block-location' and use it when provided to govern where to look up 
properties.  Modify `org-babel-get-src-block-info' accordingly to add that arg 
when calling o-b-p-f-p.  This honors the use of o-b-c-s-b-l as the location of 
the executing src block, but inflates the code to accommodate just the 
`noweb-ref' case.  

I think `2' is better as it makes clearer where o-b-p-f-p is looking for 
properties when reading the code of org-babel-get-src-block-info.

Chuck



Re: [O] Restore old easy template feature (Re: function for inserting a block)

2017-12-19 Thread Matt Price
On Tue, Dec 19, 2017 at 5:04 AM, Rasmus  wrote:

> Matt Price  writes:
>
> > On Wed, Nov 8, 2017 at 9:08 AM, Bastien Guerry  wrote:
> >
> >> Hi Kaushal,
> >>
> >> Kaushal Modi  writes:
> >>
> >> > I am suggesting to have a minor mode that simply binds "<" to do the
> >> > template insertion (only when that is typed at BOL with optional
> >> > leading whitespace, or if a region is selected).
> >>
> >> I think this is a great suggestion and brings the best of both the new
> >> and the old system.
> >>
> >> I cannot test this myself until this week-end, but I'd happy too then.
> >>
> >
> > I guess I missed this ocnversation while I was busy wiht other stuff  --
> > the old easy templating has been removed? I am certainly very sorry to
> see
> > it go, esp. as I have found yasnippet to work only intermittently in
> > org-mode buffers (at least for me).   I see Kaushal has added it back in
> > his config files, but if someone has a slightly less specialized solution
> > for restoring it I would love to see it.
> >
> > I see Nicolas's point that this functionality exists elsewhere, but maybe
> > someone can point to a ready-made replacement for those of us who rely on
> > 
> (require ’org-tempo)
>
> At the moment you can only use one character after the "<"
> cf. ‘org-structure-template-alist’.  Perhaps this will change in the
> future.
>
> ah ok, thank you both for the clarification, this helps a lot.

m


Re: [O] master: org-complete-expand-structure-template gone?

2017-12-19 Thread Nick Dokos
Uwe Brauer  writes:

> Hi
>
> I just pulled the actual master (the last time I did this was in July).
> It seems that the function org-complete-expand-structure-template is
> gone.
>
> Is this true? If so
>
> -  what is the substitute.
>
> -  what is the rationale to break backward compatibility?
>
> -  couldn't there be a file announcing deleted or renamed functions.
>I tried to search the logs but could not find any reference to
>when I was deleted and why.
>

--8<---cut here---start->8---
$ git log --grep=org-complete-expand-structure-template
commit c04e357f3d5d93484277a7e439847b1233b872bd
Author: Eric Abrahamsen 
Date:   Sun Nov 5 09:25:15 2017 +0100

Replace easy templates with org-insert-structure-template

* lisp/org.el (org-insert-structure-template): New function for
  wrapping region (or element at point) in a begin/end block.
  (org-structure-predefined-blocks): New option holding predefined
  blocks, for completion.
  (org-try-structure-completion,
  org-complete-expand-structure-template): Remove functions.
* doc/org.texi (Inserting structure templates): Document.
* testing/lisp/test-org.el (test-org/insert-template): New test.

...
--8<---cut here---end--->8---

There's been a lot of back-and-forth on the list about this.

-- 
Nick




Re: [O] master: org-complete-expand-structure-template gone?

2017-12-19 Thread Rasmus
Uwe Brauer  writes:

> Hi
>
> I just pulled the actual master (the last time I did this was in July).
> It seems that the function org-complete-expand-structure-template is
> gone.
>
> Is this true? If so
>
> -  what is the substitute.

org-tempo.el and ‘org-insert-structure-template’.  It’s still work in
progress.

> -  what is the rationale to break backward compatibility?

There’s a long thread about it.  I don’t remember the main argument for
removing it.

> -  couldn't there be a file announcing deleted or renamed functions.
>I tried to search the logs but could not find any reference to
>when I was deleted and why.

It’s noted in ORG-NEWS:

 *** ~org-try-structure-completion~
 Org Tempo may be used as a replacement.  See details above.

Rasmus

-- 
In theory, practice and theory are the same. In practice they are not




[O] master: org-complete-expand-structure-template gone?

2017-12-19 Thread Uwe Brauer

Hi

I just pulled the actual master (the last time I did this was in July).
It seems that the function org-complete-expand-structure-template is
gone.

Is this true? If so

-  what is the substitute.

-  what is the rationale to break backward compatibility?

-  couldn't there be a file announcing deleted or renamed functions.
   I tried to search the logs but could not find any reference to
   when I was deleted and why.


Uwe Brauer 




Re: [O] org dev repo?

2017-12-19 Thread Eric S Fraga
On Tuesday, 19 Dec 2017 at 11:03, Nick Dokos wrote:

[...]

> git clone http://orgmode.org/org-mode.git
>
> still worked as of yesterday (albeit slowly: be patient).

"git pull" with git: does not work but with http: does work, but slowly
as Nick says.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b


signature.asc
Description: PGP signature


Re: [O] org dev repo?

2017-12-19 Thread Uwe Brauer

   > Uwe Brauer  writes:

   > git clone http://orgmode.org/org-mode.git

   > still worked as of yesterday (albeit slowly: be patient).

Right, I really had to be patient.





Re: [O] org dev repo?

2017-12-19 Thread Nick Dokos
Uwe Brauer  writes:

> Hi
>
> I have cloned successfully the devoloper version of org in the past via
> http://orgmode.org/org-mode.git
>
> Now it seem to need ages to pull
>
> I tried according to http://orgmode.org/worg/dev/
>
>
> git clone orgm...@orgmode.org:org-mode.git
>
> But obtained
> ,
> | 
> | Cloning into 'org-mode'...
> | Permission denied (publickey).
> | fatal: Could not read from remote repository.
> | 
> | Please make sure you have the correct access rights
> | and the repository exists.
> `
>
> So  this seems to be for people with write access. I just want clone the
> actual master. Where is it?
>

git clone http://orgmode.org/org-mode.git

still worked as of yesterday (albeit slowly: be patient).

-- 
Nick




Re: [O] use a src block's result as input of another src block report error: the input device is not a TTY

2017-12-19 Thread Neil Jerram
Remove the -it options, which I believe you don't need for executing a simple 
command like pwd.

(-it is what you use to execute a shell or other interactive command in a 
container, and requires there to be a tty.)

Best wishes - Neil


On 19 December 2017 12:59:19 GMT+00:00, "numbch...@gmail.com" 
 wrote:
>Here is my example:
>
>#+NAME: get-container-name
>#+begin_src shell :results output
>echo $(docker ps --format="{{.Names}}")
>#+end_src
>
>#+RESULTS: get-container-name
>: elastic_thompson
>
>#+begin_src shell :var container_name=get-container-name :noweb yes
>docker exec -it $container_name pwd
># docker exec -it <> pwd
>#+end_src
>
>#+RESULTS:
>
>But I got error:
>
>#+begin_example
>the input device is not a TTY
>#+end_example
>
>
>[stardiviner] GPG key ID: 47C32433
>IRC(freeenode): stardiviner Twitter:  @numbchild
>Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
>Blog: http://stardiviner.github.io/


[O] Error message triggered by fill.

2017-12-19 Thread Richard Fieldsend
Hi All,
Recently I declared Emacs bankruptcy and rebuilt my initialisation files
from the ground up.

For a while now I have managed my initialisation files by having everything
in a folder (~/emacsLisp) which contains the .emacs file which calls a
series of 'themed' initialisation files for things like LaTeX, appearance,
programming etc. I then have a .emacs in my home directory which is just a
soft link to the .emacs in the folder.

This time I decided to build Emacs from source and to do the same with the
various plugins.  The source for these is stored in a separate folder,
respectively pulled from GitHub and linked into the files as appropriate.
The ~/emacsLisp folder is in a GitHub repository which means I can keep my
various computers in sync.

I have a laptop at home, and two desktops at work (I work in two separate
buildings) so this syncronising is useful.

However, I have hit a problem which only occurs in org-mode. On my laptop
and one of my desktop PCs the org-mode stuff works fine.  But on my main
work machine when I have an org file I can add text, but when a line gets
long enough to word-wrap to the next line I get an error:

org-element--cache-find: avl-tree--dummyroot accessing a non-avl-tree-

the line doesn't wrap and the line continues.

I have updated all the repositories and rebuilt the code where appropriate,
and the problem persists.  Both systems have the same version of Linux (I
have just updated both to Mint 18.3).

Looking in the lisp directory for org-mode there doesn't seem to be a match
for avl. Looking at the lisp directory under the Emacs build there is
(including entries in the changelog).

Any thoughts would be gratefully received.

Best wishes

Richard


[O] specify different agenda item colors for different custom agenda views

2017-12-19 Thread Rainer Stengele

Hi all,

I cannot seem to find a way how to customise colors in custom org agenda blocks.
I have 2 agenda views, both drawing from different set of org files.
I would like to have different org-agenda-done faces for the 2 views.

Can anyone give me a hint please.

Thank you.
Regards, Rainer




[O] use a src block's result as input of another src block report error: the input device is not a TTY

2017-12-19 Thread numbch...@gmail.com
Here is my example:

#+NAME: get-container-name
#+begin_src shell :results output
echo $(docker ps --format="{{.Names}}")
#+end_src

#+RESULTS: get-container-name
: elastic_thompson

#+begin_src shell :var container_name=get-container-name :noweb yes
docker exec -it $container_name pwd
# docker exec -it <> pwd
#+end_src

#+RESULTS:

But I got error:

#+begin_example
the input device is not a TTY
#+end_example


[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


Re: [O] ox-publish export subtree scopes?

2017-12-19 Thread Rasmus
Narendra Joshi  writes:

> Kaushal Modi  writes:
>
>> On Tue, Dec 5, 2017 at 7:31 AM Rasmus  wrote:
>>
>> If you have any suggestions on how to improve ox-publish to
>> better suit
>> please share them.
>>
>>
>> Hello Rasmus,
>>
>> I'd like to make the ox-publish based exporting working for my
>> ox-hugo[1] package but so far have been unsuccessful.
>>
>> The main reason is that org-foo-publish-to-bar functions take only
>> plist, filename and pub-dir as args. I miss the ability to first pick
>> a subtree scope from the specific Org file and then export only that.
>> Is something like that already possible which I am missing?
>>
>> In addition, when given a file name, I need to auto-decide (i) if I
>> need to cycle through "valid" subtrees (see more about that below)
>> and export those subtrees,or (ii) export the whole Org file if #
>> +TITLE is present.
>>
>> So I ended up with org-hugo-export-wim-to-md[2] ("wim" stands for
>> What I Mean). Below is a snippet from its doc string:
>>
>> =
>> - If the current subtree has the \"EXPORT_FILE_NAME\" property,
>> export
>>   that subtree.
>> - If the current subtree doesn't have that property, but one of its
>>   parent subtrees has, then export from that subtree's scope.
>> - If none of the subtrees have that property (or if there are no Org
>>   subtrees at all), but the Org #+TITLE keyword is present,
>>   export the whole Org file as a post with that title (calls
>>   `org-hugo-export-to-md' with its SUBTREEP argument set to nil).
>>
>> - If ALL-SUBTREES is non-nil, export all valid Hugo post subtrees
>>   \(that have the \"EXPORT_FILE_NAME\" property) in the current file
>>   to multiple Markdown posts.
>> - If ALL-SUBTREES is non-nil, and again if none of the subtrees have
>>   that property (or if there are no Org subtrees), but the Org #
>> +TITLE
>>   keyword is present, export the whole Org file.
>>
>> - If the file neither has valid Hugo post subtrees, nor has the
>>   #+TITLE present, throw a user error.  If NOERROR is non-nil, use
>>   `message' to display the error message instead of signaling a user
>>   error.
>> =
>>
>> And I use a Makefile[3] to find all Org files in the current directly
>> and call the above function, which then does the right thing as
>> explained in the conditions above.
>>
>> Is there any way to call org-publish to export either the entire file
>> or cycle through the file and export the subtrees matching a
>> predicate?
>>
>> [1]: https://github.com/kaushalmodi/ox-hugo
>> [2]: https://github.com/kaushalmodi/ox-hugo/blob/
>> 832a5d7424013f60b77354ec28613440afac0269/ox-hugo.el#L2424-L2448
>> [3]: https://github.com/kaushalmodi/ox-hugo/blob/master/Makefile
>> --
>>
>> Kaushal Modi
>
> I have faced something similar (or maybe not very similar) while using
> `org-publish' for my static blog. I wanted to wrap everything inside
> body in a container and a row (bootstrap classes). The functions
> provided do not let me do this conveniently. I can define `content',
> `preamble' and `postamble' but cannot wrap all three of them inside a
> `div' without overriding the whole export function.

For that you could use a filter, which may or may not be convinient.

(add-to-list
 'org-export-filter-final-output-functions
 (defun rasmus/div-body (body backend info)
   (when (and (org-export-derived-backend-p backend 'html)
  ;; Add something to identify your project if using same
  ;; init.el for "normal" usage and publishing usage.
  )
 (replace-regexp-in-string
  "" "\n"
  (replace-regexp-in-string ""
"\n" 
body)

Rasmus

-- 
Bang bang




Re: [O] Poll: new keybinding for org-insert-structure-template?

2017-12-19 Thread Rasmus
Eric Abrahamsen  writes:

> Eric Abrahamsen  writes:
>
>> Rasmus  writes:
>>
>>> Kaushal Modi  writes:
>>>
 On Fri, Dec 15, 2017 at 6:23 AM Rasmus  wrote:

> The only way it’s "bad" is in the sense it limits the flexibility of
> snippets, like " I can no longer have ">
>> I don't see any way around that. Any system that allows string keys of
>> arbitrary length is going to run into that problem.
>
> One possible fix, a bit arbitrary: in the default value, provide 
> as an artificial "stop key" in the sub-menus. So "s" starts the "source
> code" sub-menu, and a  after that simply inserts "#+begin_src", and
> leaves point after that.

Yeah, I tried to suggest that earlier (unless I didn’t say it), but I
might not have expressed the idea in an understandable manner :)

I think that would be the best approach, but there’s no infrastructure
that I know of that does this ATM (but I haven’t had a lot of time lately,
so my knowledge on this issue is limited!).

Rasmus

-- 
9000!




Re: [O] run shell command after publishing project

2017-12-19 Thread Rasmus
Hi,

Matt Price  writes:

> I'm setting up a new workflow using Kauhsal's ox-hugo.  I keep all my
> course materials in a few org files & publish to hugo-flavoured markdown.
> My source materials live in one git repo, and my website in another.  After
> exporting any of my my courses to the local hugo directory, I'd like to run
> a shell script that I'll keep in my org-files directory.

Do you mean commit or publish instead of export?  Otherwise you might have
to keep track of whether you are exporting to buffer as a buffer still has
a default-directory.  It would be easier to publish.

> That script
> - cds to the website repo directory, commits changes to the website master
> branch, - runs hugo,
> - switches to the "public" directory of compiled html pages, which has a
> worktree checked out to  the  gh-pages branch,
> - commits changes there as well, and then
> - pushes both branches to github.
>
> The script seems to work OK, and now I would like to run it every time I
> export from the appropriate projects. Is there a good way for me to do
> this? I guess a hook that only runs under certain conditions?

That is a sane approach with github pages, indeed.

I did something similar when I used github pages, but with ox-publish.  My
‘:preparation-function’ was

(defun project-prep-function ()
  (interactive)
  (or (zerop (shell-command (format "cd %s && git checkout master" 
project-main-dir)))
  (error (format "error checking out master in %s" project-main-dir

And my ‘:completion-function’ was as follows where ‘project-tmp-dir’ the
‘:publishing-directory’.

(defun project-completion-function ()
  (interactive)
  (let ((cd (format "cd %s && " project-main-dir)))
(shell-command (concat cd "git commit -am \"auto-check-in\""))
(or (zerop (shell-command (concat cd "git checkout gh-pages")))
(error (format "error checking out gh-pages in %s" project-main-dir)))
(or (zerop (shell-command (format "mv %s/*.html %s"
  project-tmp-dir project-main-dir)))
(error "error moving files"))
(or (zerop (shell-command
(concat cd "git add *.html && git commit -am 'updated html'")))
(error "error adding html files"))
(or (zerop (shell-command
(concat cd "git push origin gh-pages")))
(warn "error pushing gh-pages"))
(or (zerop (shell-command (concat cd "git checkout master")))
(error "error checking out master"

> If I can get this to work, and then also auto export every time I commit
> the org-files to master (maybe with a post-commit git hook of ~emacsclient
> -e '(org-publish-project "course1"~ ?), then I will maybe be almost happy!

If you use ox-publish you could auto-commit whenever you publish a
project.  But I guess you could also use a hook.  I use this to publish:

emacs --batch --no-init-file --load publish.el --funcall org-publish-all

I do it via Gitlab CI, though, as I only want to keep track of source
files.

pages:
  script:
- emacs --batch --no-init-file --load publish.el --funcall org-publish-all
  artifacts:
paths:
  - public

Rasmus

-- 
Enough with the blah blah!




[O] org dev repo?

2017-12-19 Thread Uwe Brauer
Hi

I have cloned successfully the devoloper version of org in the past via
http://orgmode.org/org-mode.git

Now it seem to need ages to pull

I tried according to http://orgmode.org/worg/dev/


git clone orgm...@orgmode.org:org-mode.git

But obtained
,
| 
| Cloning into 'org-mode'...
| Permission denied (publickey).
| fatal: Could not read from remote repository.
| 
| Please make sure you have the correct access rights
| and the repository exists.
`

So  this seems to be for people with write access. I just want clone the
actual master. Where is it?

Thanks

Uwe Brauer 




Re: [O] Git repository error

2017-12-19 Thread Achim Gratz
Nick Dokos writes:
> You might not have given it enough time. Here, it takes a long time,
> but it completes:
>
> $ time git clone http://orgmode.org/org-mode.git
> Cloning into 'org-mode'...

Yes, http:// works (if slowly), but git:// is really flakey and mostly
doesn't during the last few days at least.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] Restore old easy template feature (Re: function for inserting a block)

2017-12-19 Thread Rasmus
Matt Price  writes:

> On Wed, Nov 8, 2017 at 9:08 AM, Bastien Guerry  wrote:
>
>> Hi Kaushal,
>>
>> Kaushal Modi  writes:
>>
>> > I am suggesting to have a minor mode that simply binds "<" to do the
>> > template insertion (only when that is typed at BOL with optional
>> > leading whitespace, or if a region is selected).
>>
>> I think this is a great suggestion and brings the best of both the new
>> and the old system.
>>
>> I cannot test this myself until this week-end, but I'd happy too then.
>>
>
> I guess I missed this ocnversation while I was busy wiht other stuff  --
> the old easy templating has been removed? I am certainly very sorry to see
> it go, esp. as I have found yasnippet to work only intermittently in
> org-mode buffers (at least for me).   I see Kaushal has added it back in
> his config files, but if someone has a slightly less specialized solution
> for restoring it I would love to see it.
>
> I see Nicolas's point that this functionality exists elsewhere, but maybe
> someone can point to a ready-made replacement for those of us who rely on
> 

[O] [UPDATE] Re: ob-clojure evaluate error when Org-mode buffer has ns clojure code

2017-12-19 Thread stardiviner

I got new update on this issue.

I think it is caused by `(clojure-find-ns)`.
Here is my found:

I created a simple clojure project for used by all org-babel-clojure src 
blocks.

```elisp
(progn
  (find-file (expand-file-name 
"~/.emacs.d/Org-mode/ob-clojure/src/ob_clojure/core.clj"))

  (cider-jack-in))
```

I edebug the `org-babel-execute:clojure` process,

`org-babel-execute:clojure' has a step: ~(clojure-find-ns)~ .
This is from ~clojure-mode~. It will find current clojure buffer 
possible clojure namespace (even in org-mode). When I the following 
example org-mode buffer, it will return "namespace-not-found" error in 
nrepl response dict. Then src blcok has no error, not results.


```org
#+BEGIN_SRC clojure :session
(in-ns 'user-kk)
or
(ns user-kk)
#+END_SRC

#+BEGIN_SRC clojure :results output
(print "hi")
#+END_SRC
```

Here is a part of function `clojure-find-ns`:

  #+begin_src emacs-lisp
  (when (or (re-search-backward clojure-namespace-name-regex nil t)
    ;; Or any form at all.
    (and (goto-char (point-min))
 (re-search-forward clojure-namespace-name-regex 
nil t)))

    (match-string-no-properties 4))
  #+end_src

So I created an PR to disable find namespace in Org-mode buffer:
https://github.com/clojure-emacs/clojure-mode/pull/465