Re: [O] wishful thinking: using SQL to process tables. in the meantime, use R

2016-07-21 Thread Thierry Banel

  
  
Le 21/07/2016 03:13, dmg a écrit :


  
Hi
  everybody,


I
  was wondering if there was a way to join two tables given
a
  common column. I searched but found nothing.


it
  would be awesome to be able to process tables in SQLITE.
something
  like this:


#+BEGIN_SRC
  sqlite :var a=table1 b=table2  :colnames yes
 
  select * from $a join $b using column;


  #+END_SRC
  
  
  I think it is not that hard. The infrastructure is there
already.
  It is just a matter of creating temp tables (this is the
major part missing
  which implies making a create statement from the table,
but given
  that sqlite is very type agnostic, it might not be
hard), 
  load them from the CSV files
  the execute the block. A db parameter might be needed
  for a scratch database file, but it could be a temporary
one if
  none is provided.
  
  
  But in the meantime, it occurred to me, it is simple in R
to do the join
  and might be useful to others:




  #+BEGIN_SRC
R :var a=table1 b=table2 :results value :colnames yes
  merge(a,b,by.x="column")
  #+END_SRC
  
  
  merge
can do left joins, right joins, full joins, joins, 
  
  
  https://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html
  
  

  but
  there is nothing like the power of SQL to process tables,
  though.



-- 
--dmg
  
  ---
  Daniel M. German
  http://turingmachine.org

  


You may want to try orgtbl-join
  https://github.com/tbanel/orgtbljoin
Available on Melpa (M-x package-install orgtbl-join)
It is pure Emacs (no external dependencies)



  




Re: [O] convert rmarkdown (rmd) files to orgmode?

2016-07-21 Thread Charles C. Berry

On Wed, 20 Jul 2016, Xebar Saram wrote:


Hi again

Chuck:

is there a way to modify you nice code regex code snippet to simultaneously
change all example blocks to R blocks in a converted rmd>org file?
so when executing the block all example blocks:


#+BEGIN_EXAMPLE
help.search("rnorm")
#+END_EXAMPLE

will turn into R blocks

#+BEGIN_SRC R :session Rorg  :results none
help.search("rnorm")
#+END_SRC



The obvious thing is to do this with two additional `replace' operations.

Interactively, you can use `replace-string' to do this, since those are 
fixed strings and there are no backreferences to worry about. I think 
there is a dired-mode incantation that would allow you to do this on all 
files in a directory if you wanted.


But see the docstring for 'replace-string' which shows a better 
incantation for programmatically doing the changes.


IMO, you would be better served by doiing this in a scripting language 
like bash or python, but even R could do it.


One reason for using a scripting language is that unless you are a wiz at 
elisp, it is easier to report back the changes that are made in context; 
if you convert something that truly *is* an example block, you want to 
know about it so you can back out that change. Also, it is possible that 
the R code in the file you are converting will contain characters that 
will foil the regexp matching and you really need to catch those.


I'd be tempted to do it in R - at least in part - so I could parse() the 
result to check that it is valid code. The ESS suite has some parsing 
capabilities, but if you do not already know them using R will be a lot 
easier. An example block that does not produce valid code might be 
something you should leave as an example block.


Write a script that does all the conversion including the pandoc 
bit. Then run that at the command line.


Chuck




Re: [O] orgmode read/source all options from a template file?

2016-07-21 Thread Kaushal Modi
I prefer #+SETUPFILE because the beauty is that that option is specific to
loading a common org setup file.

I have my config.org beautifully organized as:

=
* Latex Setup
** Change default font
Note that fontspec works with only xelatex (not pdflatex).
#+LaTeX_HEADER: \usepackage{fontspec}
#+LaTeX_HEADER: \setmainfont[Ligatures=TeX]{Linux Libertine O}
#+LaTeX_HEADER: \setmonofont[Scale=0.8]{Inconsolata-g}
** Sans serif fonts for section titles
#+LaTeX_HEADER: \usepackage{titlesec}
*** Formatting =section= titles
#+LaTeX_HEADER: \titleformat{\section}
#+LaTeX_HEADER:   [hang] % titleformat shape
#+LaTeX_HEADER:   {\usefont{T1}{qhv}{b}{n}\selectfont\Large} % titleformat
format "qhv" - TeX Gyre Heros, "b" - bold
#+LaTeX_HEADER:   {\thesection} % titleformat label
#+LaTeX_HEADER:   {0.6em} % titleformat separation
#+LaTeX_HEADER:   {} % code preceeding title body
*** Formatting =subsection= titles
#+LaTeX_HEADER: \titleformat{\subsection}
#+LaTeX_HEADER:   [hang]   % titleformat shape
#+LaTeX_HEADER:   {\bfseries\large}  % titleformat format
#+LaTeX_HEADER:   {\thesubsection} % titleformat label
#+LaTeX_HEADER:   {0.4em}  % titleformat separation
#+LaTeX_HEADER:   {}   % code preceeding title body
*** TODO Look into using the =sectsty= package instead of =titlesec=
because of its compatibility issues with =hyperref=
[[http://tex.stackexchange.com/a/74517/52678][Reference]]

=

The awesome thing is that org will load only the "setup" stuff from a
SETUPFILE file.. so it will pick up the #+LaTeX_HEADER lines from above,
but not "* Latex Setup" or "** Change default font" or other things.

Basically, only special comments will be read from SETUPFILE.


On Thu, Jul 21, 2016 at 11:24 AM Eric S Fraga  wrote:

> #+include: settings.org


On Thu, Jul 21, 2016 at 7:10 AM Xebar Saram  wrote:

> Ok got it, you can "source" a template file by using the SETUPFILE option
> , ie;
>
> #+SETUPFILE: /home/zeltak/org/files/Uni/Courses/templates/
> org.options.reveal.org
>
-- 

Kaushal Modi


Re: [O] orgmode read/source all options from a template file?

2016-07-21 Thread Eric S Fraga
On Thursday, 21 Jul 2016 at 11:15, Xebar Saram wrote:
> Hi all
>
> i was wondering if orgmode had a simple way to read/source all options
> from a template file. for example instead of adding all this to every
> presentation file i create:

#+include: settings.org

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.2-164-g50a182



[O] bug#23917: Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks)

2016-07-21 Thread Eli Zaretskii
> From: npost...@users.sourceforge.net
> Cc: 23...@debbugs.gnu.org,  nljlistb...@gmail.com,  jwieg...@gmail.com,  
> rpl...@gmail.com,  monn...@iro.umontreal.ca,  alex.ben...@linaro.org
> Date: Wed, 20 Jul 2016 23:00:59 -0400
> 
> > Please also make sure bug#23869 is still fixed after this.
> 
> Following the recipe in
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23869#11 gives me 'Lisp
> error: (error "Match data clobbered by buffer modification hooks")',
> that indicates it's still fixed, right?

Yes, but I thought we want to remove the error-out code.  Since we now
protect ourselves from clobbered data, we don't need that extra
protection, and I think leaving it in place will cause false positives
(as a few people already reported).  That's because the adjustment of
the search registers in the new function you introduce will itself
trigger the error message, won't it?

Perhaps we should error out only if the number of registers changed,
because that can never be valid, I think.





[O] bug#23917: 25.0.95; commit 3a9d6296b35e5317c497674d5725eb52699bd3b8 causing org-capture to error out

2016-07-21 Thread N. Jackson
At 10:19 +0200 on Thursday 2016-07-21, Robert Pluim wrote:
>
> nljlistb...@gmail.com (N. Jackson) writes:
>
>> At 20:56 -0400 on Wednesday 2016-07-20, npost...@users.sourceforge.net wrote:
>>>
>>> From: Noam Postavsky 
>>> Subject: [PATCH v1] Adjust match data before calling after-change-funs
>>
>> It puzzles me that your patch doesn't work for the emacs -Q recipe but
>> does work for my normal configuration, so much so that I suspected that
>> I had made a mistake, but I have reset and reapplied the patch three
>> times and I continue to see the same results.
>
> You're not alone: this patch doesn't fix the issue for me either with
> emacs -Q or with my normal capture templates.

FWIW, taking into account that I needed to rebuild Org Mode using the
patched Emacs, I redid my tests of Noam's patch and got the same
puzzling results as before. That is the patch *does* fix the problem for
me with my normal caputure templates, but it does not fix the problem
with the simple recipe in emacs -Q.

N.





[O] bug#23917: 25.0.95; commit 3a9d6296b35e5317c497674d5725eb52699bd3b8 causing org-capture to error out

2016-07-21 Thread N. Jackson
At 10:08 +0200 on Thursday 2016-07-21, Robert Pluim wrote:
>>
> nljlistb...@gmail.com (N. Jackson) writes:
>
>> At 21:09 +0300 on Monday 2016-07-18, Eli Zaretskii wrote:
>>
>>> diff --git a/lisp/subr.el b/lisp/subr.el
>>> index e9e19d3..1bb1cb3 100644
>>> --- a/lisp/subr.el
>>> +++ b/lisp/subr.el
>>> @@ -3466,7 +3466,7 @@ save-match-data
>>>;; if you need to recompile all the Lisp files using interpreted code.
>>>(declare (indent 0) (debug t))
>>>(list 'let
>>> -   '((save-match-data-internal (match-data)))
>>> +   '((save-match-data-internal (match-data 'integers)))
>>> (list 'unwind-protect
>>>   (cons 'progn body)
>>>   ;; It is safe to free (evaporate) markers immediately here,
>>
>> FWIW on my system applying this patch does not resolve the org-capture
>> issue. I'm testing with org-20160718 from GNU Elpa and latest Emacs 25
>> branch from the git (Repository revision: 
>> 4157159a37b43712440da91a45a6d5f71eb96e8a).
>
> save-match-data is a macro. Did you recompile org with the modified
> emacs?

Thanks Robert. I failed to take that into account.

After re-applying Eli's patch above and then rebuilding Org Mode from
GNU Elpa (now org-20160719), the org-capture match-data-clobbered
error/abort no longer occurs, neither with the simple recipe in emacs -Q
nor with my own capture templates with my full config loaded.

Sorry for the noise.

[For completeness, I should say that I then removed the patch and
rebuilt org-20160719 again, and confirmed that it does trigger the bug
in both emacs -Q and with my configuration.]

N.






Re: [O] orgmode read/source all options from a template file?

2016-07-21 Thread Xebar Saram
Ok got it, you can "source" a template file by using the SETUPFILE option ,
ie;

#+SETUPFILE: /home/zeltak/org/files/Uni/Courses/templates/
org.options.reveal.org


best

z

On Thu, Jul 21, 2016 at 1:15 PM, Xebar Saram  wrote:

> Hi all
>
> i was wondering if orgmode had a simple way to read/source all options
> from a template file. for example instead of adding all this to every
> presentation file i create:
>
>  #+OPTIONS: reveal_center:t reveal_progress:t reveal_history:nil
>  reveal_control:t
>  #+OPTIONS: reveal_center:t
>  #+OPTIONS: reveal_rolling_links:t reveal_keyboard:t reveal_overview:t
> num:nil
>  #+OPTIONS: reveal_width:1200 reveal_height:800
>   #+OPTIONS: toc:nil
>   # #+REVEAL: split
>   #+REVEAL_MARGIN: 0.1
>   #+REVEAL_MIN_SCALE: 0.5
>
> i would just source a file (txt or orgmode?) with all the pre definitions
>
> any clue?
>
> thx
>
> Z
>


Re: [O] Bug? Date calculation in table fail with locale "de"

2016-07-21 Thread Ulrich J. Herter
Am Donnerstag, den 21.07.2016, 11:50 +0200 schrieb Nicolas Goaziou:
> "Ulrich J. Herter"  writes:
> 
> > 
> > Is this a bug? I'm trying to do some date calculations in a table,
> > however, when on German language settings I'm getting the
> > following:
> > 
> > > 
> > > <2016-07-07 Do> | <2016-07-08 Fr> | #ERROR |
> > #+TBLFM: $3=$2-$1
> > 
> > Debugger output:
> > Substitution history of formula
> > Orig:   ?
> > $xyz->  $2-$1
> > @r$c->  $2-$1
> > $1->(<2016-07-08 Fri>)-(<2016-07-07 Do>)
> > ^
> > Error:  Bad word in date: "Do"
> 
> Fixed in development version. Thank you.
Awesome, thank you!

Regards, Uli




[O] orgmode read/source all options from a template file?

2016-07-21 Thread Xebar Saram
Hi all

i was wondering if orgmode had a simple way to read/source all options from
a template file. for example instead of adding all this to every
presentation file i create:

 #+OPTIONS: reveal_center:t reveal_progress:t reveal_history:nil
 reveal_control:t
 #+OPTIONS: reveal_center:t
 #+OPTIONS: reveal_rolling_links:t reveal_keyboard:t reveal_overview:t
num:nil
 #+OPTIONS: reveal_width:1200 reveal_height:800
  #+OPTIONS: toc:nil
  # #+REVEAL: split
  #+REVEAL_MARGIN: 0.1
  #+REVEAL_MIN_SCALE: 0.5

i would just source a file (txt or orgmode?) with all the pre definitions

any clue?

thx

Z


Re: [O] capture with iceweasel/firefox -- nothing works

2016-07-21 Thread Adam Porter
Samuel Wales  gmail.com> writes:
 
> however, i never found any good instructions on what to do to add js
> to bookmarks.
> i have a menu bar and a location bar + icons.  i'd like a button or
> icon on the latter if possible.  my previous thrashing around caused a
> >> symbol which is a drop down menu which contains the bookmarks.
> i'll settle for that if nec.  but that is extra clicking i'd rather
> avoid, and one of them brings up a page with js on it.
> 
> is this knowledge something that everybody except me possesses?  :)

Sorry for the late reply; I haven't been watching the list lately and I
missed this thread.  But in case this helps Samuel or anyone else:

When I was putting together org-protocol-capture-html, I spent some time
testing and refining the instructions to set up org-protocol correctly. 
They can be found here:

https://github.com/alphapapa/org-protocol-capture-html#org-protocol-instructions

Also, Samuel, you said elsewhere in the thread that you wanted to be able to
capture to Org like this:

* [[link][title]]
Selected text

And that's exactly what org-protocol-capture-html does.  You said you only
have a limited amount of time and weren't sure if it was worth trying. 
Well, I think it is, but of course I am biased.  ;)  But if you have any
problems, just post an issue on the tracker and I'll be glad to help you if
I can.




Re: [O] Bug? Date calculation in table fail with locale "de"

2016-07-21 Thread Nicolas Goaziou
Hello,

"Ulrich J. Herter"  writes:

> Is this a bug? I'm trying to do some date calculations in a table,
> however, when on German language settings I'm getting the following:
>
> | <2016-07-07 Do> | <2016-07-08 Fr> | #ERROR |
> #+TBLFM: $3=$2-$1
>
> Debugger output:
> Substitution history of formula
> Orig:   ?
> $xyz->  $2-$1
> @r$c->  $2-$1
> $1->(<2016-07-08 Fri>)-(<2016-07-07 Do>)
> ^
> Error:  Bad word in date: "Do"

Fixed in development version. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] bug#23917: 25.0.95; commit 3a9d6296b35e5317c497674d5725eb52699bd3b8 causing org-capture to error out

2016-07-21 Thread Robert Pluim
nljlistb...@gmail.com (N. Jackson) writes:

> At 20:56 -0400 on Wednesday 2016-07-20, npost...@users.sourceforge.net wrote:
>>
>> From a8098080dff5f83f7cbcbec2bc263f9db3b45ad9 Mon Sep 17 00:00:00 2001
>> From: Noam Postavsky 
>> Date: Wed, 20 Jul 2016 20:15:14 -0400
>> Subject: [PATCH v1] Adjust match data before calling after-change-funs
>>
>> * src/insdel.c (replace_range): Add new parameter ADJUST_MATCH_DATA, if
>> true.  Update all callers except Freplace_match to pass 0 for the new
>> parameter.
>> * src/search.c (update_search_regs): New function, extracted from
>> Freplace_match.
>> (Freplace_match): Remove match data adjustment code, pass 1 for
>> ADJUST_MATCH_DATA to replace_range instead.
> FWIW on my system applying this patch only partially resolves the
> org-capture issue. I'm testing with org-20160718 from GNU Elpa and
> latest Emacs 25 branch from the git (Repository revision:
> 4157159a37b43712440da91a45a6d5f71eb96e8a).
>
> The patch successfully eliminates the match-data-clobbered error/abort
> during org-capture with all my capture templates when I have my entire
> config loaded, but with a minimal recipe from emacs -Q the org-capture
> match-data-clobbered error still occurs.
>
> The minimal recipe I'm testing with is similar to that posted by Robert
> Pluim on 2016-07-18, specifically
>
>   src/emacs -Q
>
>   M-: (custom-set-variables '(package-selected-packages (quote 
> (org-20160718 RET
>   M-x package-initialize RET
>
>   C-x C-f ; find file.
>   C-S-backspace   ; kill-whole-line.
>   ~/.notes RET; Open the file expected by default capture 
> template.
>   M-x org-mode RET; put the buffer into Org Mode.
>   M-x org-capture RET t ; Run the default "Task" capture template bound to 
> the t key.
>
> With your patch I still get the error: 
>
>   org-capture: Capture template ‘t’: Match data clobbered by buffer 
> modification hooks
>
> .
>
> It puzzles me that your patch doesn't work for the emacs -Q recipe but
> does work for my normal configuration, so much so that I suspected that
> I had made a mistake, but I have reset and reapplied the patch three
> times and I continue to see the same results.

You're not alone: this patch doesn't fix the issue for me either with
emacs -Q or with my normal capture templates.

Regards

Robert





[O] bug#23917: 25.0.95; commit 3a9d6296b35e5317c497674d5725eb52699bd3b8 causing org-capture to error out

2016-07-21 Thread Robert Pluim
nljlistb...@gmail.com (N. Jackson) writes:

> At 21:09 +0300 on Monday 2016-07-18, Eli Zaretskii wrote:
>
>> diff --git a/lisp/subr.el b/lisp/subr.el
>> index e9e19d3..1bb1cb3 100644
>> --- a/lisp/subr.el
>> +++ b/lisp/subr.el
>> @@ -3466,7 +3466,7 @@ save-match-data
>>;; if you need to recompile all the Lisp files using interpreted code.
>>(declare (indent 0) (debug t))
>>(list 'let
>> -'((save-match-data-internal (match-data)))
>> +'((save-match-data-internal (match-data 'integers)))
>>  (list 'unwind-protect
>>(cons 'progn body)
>>;; It is safe to free (evaporate) markers immediately here,
>
> FWIW on my system applying this patch does not resolve the org-capture
> issue. I'm testing with org-20160718 from GNU Elpa and latest Emacs 25
> branch from the git (Repository revision: 
> 4157159a37b43712440da91a45a6d5f71eb96e8a).
>
> With these versions of Org and Emacs and your patch applied, with a
> recipe similar to that posted by Robert Pluim on 2016-07-18,
> specifically
>
>   src/emacs -Q
>
>   M-: (custom-set-variables '(package-selected-packages (quote 
> (org-20160718 RET
>   M-x package-initialize RET
>
>   C-x C-f ; find file.
>   C-S-backspace   ; kill-whole-line.
>   ~/.notes RET; Open the file expected by default capture 
> template.
>   M-x org-mode RET; put the buffer into Org Mode.
>   M-x org-capture RET t ; Run the default "Task" capture template bound to 
> the t key.
>
> I get the error: 
>
>   org-capture: Capture template ‘t’: Match data clobbered by buffer 
> modification hooks

save-match-data is a macro. Did you recompile org with the modified
emacs?

That patch works for me when using that version of org uncompiled.

Regards

Robert





[O] bug#23917: 25.0.95; commit 3a9d6296b35e5317c497674d5725eb52699bd3b8 causing org-capture to error out

2016-07-21 Thread N. Jackson
At 20:56 -0400 on Wednesday 2016-07-20, npost...@users.sourceforge.net wrote:
>
> From a8098080dff5f83f7cbcbec2bc263f9db3b45ad9 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky 
> Date: Wed, 20 Jul 2016 20:15:14 -0400
> Subject: [PATCH v1] Adjust match data before calling after-change-funs
>
> * src/insdel.c (replace_range): Add new parameter ADJUST_MATCH_DATA, if
> true.  Update all callers except Freplace_match to pass 0 for the new
> parameter.
> * src/search.c (update_search_regs): New function, extracted from
> Freplace_match.
> (Freplace_match): Remove match data adjustment code, pass 1 for
> ADJUST_MATCH_DATA to replace_range instead.
> ---
>  src/cmds.c|  2 +-
>  src/editfns.c |  6 +++---
>  src/insdel.c  | 10 --
>  src/lisp.h|  4 +++-
>  src/search.c  | 50 +-
>  5 files changed, 44 insertions(+), 28 deletions(-)
>
> diff --git a/src/cmds.c b/src/cmds.c
> index 1e44ddd..4003d8b 100644
> --- a/src/cmds.c
> +++ b/src/cmds.c
> @@ -447,7 +447,7 @@ internal_self_insert (int c, EMACS_INT n)
> string = concat2 (string, tem);
>   }
>  
> -  replace_range (PT, PT + chars_to_delete, string, 1, 1, 1);
> +  replace_range (PT, PT + chars_to_delete, string, 1, 1, 1, 0);
>Fforward_char (make_number (n));
>  }
>else if (n > 1)
> diff --git a/src/editfns.c b/src/editfns.c
> index 412745d..32c8bec 100644
> --- a/src/editfns.c
> +++ b/src/editfns.c
> @@ -3192,7 +3192,7 @@ DEFUN ("subst-char-in-region", Fsubst_char_in_region,
> /* replace_range is less efficient, because it moves the gap,
>but it handles combining correctly.  */
> replace_range (pos, pos + 1, string,
> -  0, 0, 1);
> +  0, 0, 1, 0);
> pos_byte_next = CHAR_TO_BYTE (pos);
> if (pos_byte_next > pos_byte)
>   /* Before combining happened.  We should not increment
> @@ -3405,7 +3405,7 @@ DEFUN ("translate-region-internal", 
> Ftranslate_region_internal,
> /* This is less efficient, because it moves the gap,
>but it should handle multibyte characters correctly.  */
> string = make_multibyte_string ((char *) str, 1, str_len);
> -   replace_range (pos, pos + 1, string, 1, 0, 1);
> +   replace_range (pos, pos + 1, string, 1, 0, 1, 0);
> len = str_len;
>   }
> else
> @@ -3446,7 +3446,7 @@ DEFUN ("translate-region-internal", 
> Ftranslate_region_internal,
>   {
> string = Fmake_string (make_number (1), val);
>   }
> -   replace_range (pos, pos + len, string, 1, 0, 1);
> +   replace_range (pos, pos + len, string, 1, 0, 1, 0);
> pos_byte += SBYTES (string);
> pos += SCHARS (string);
> cnt += SCHARS (string);
> diff --git a/src/insdel.c b/src/insdel.c
> index 4ad1074..fc3f19f 100644
> --- a/src/insdel.c
> +++ b/src/insdel.c
> @@ -1268,7 +1268,9 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t 
> from_byte,
>  /* Replace the text from character positions FROM to TO with NEW,
> If PREPARE, call prepare_to_modify_buffer.
> If INHERIT, the newly inserted text should inherit text properties
> -   from the surrounding non-deleted text.  */
> +   from the surrounding non-deleted text.
> +   If ADJUST_MATCH_DATA, then adjust the match data before calling
> +   signal_after_change.  */
>  
>  /* Note that this does not yet handle markers quite right.
> Also it needs to record a single undo-entry that does a replacement
> @@ -1279,7 +1281,8 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t 
> from_byte,
>  
>  void
>  replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
> -bool prepare, bool inherit, bool markers)
> +   bool prepare, bool inherit, bool markers,
> +   bool adjust_match_data)
>  {
>ptrdiff_t inschars = SCHARS (new);
>ptrdiff_t insbytes = SBYTES (new);
> @@ -1426,6 +1429,9 @@ replace_range (ptrdiff_t from, ptrdiff_t to, 
> Lisp_Object new,
>MODIFF++;
>CHARS_MODIFF = MODIFF;
>  
> +  if (adjust_match_data)
> +update_search_regs (from, to, from + SCHARS (new));
> +
>signal_after_change (from, nchars_del, GPT - from);
>update_compositions (from, GPT, CHECK_BORDER);
>  }
> diff --git a/src/lisp.h b/src/lisp.h
> index 6a98adb..25f811e 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -3516,7 +3516,7 @@ extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, 
> ptrdiff_t,
>ptrdiff_t, ptrdiff_t);
>  extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t,
>  ptrdiff_t, ptrdiff_t);
> -extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, 
> bool);
> +extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, 
> bool, bool);
>  extern 

[O] bug#23917: 25.0.95; commit 3a9d6296b35e5317c497674d5725eb52699bd3b8 causing org-capture to error out

2016-07-21 Thread N. Jackson
At 21:09 +0300 on Monday 2016-07-18, Eli Zaretskii wrote:

> My suggestion to fix this is below.  I ask for opinions on (1) whether
> this looks like TRT, (2) whether it is safe enough for emacs-25, and
> (3) whether someone has better ideas.  If someone thinks I've
> misunderstood the issue, don't hesitate to explain why, because
> frankly it feels very strange to find bugs that seem to have existed
> since 1990.
>
> diff --git a/lisp/subr.el b/lisp/subr.el
> index e9e19d3..1bb1cb3 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -3466,7 +3466,7 @@ save-match-data
>;; if you need to recompile all the Lisp files using interpreted code.
>(declare (indent 0) (debug t))
>(list 'let
> - '((save-match-data-internal (match-data)))
> + '((save-match-data-internal (match-data 'integers)))
>   (list 'unwind-protect
> (cons 'progn body)
> ;; It is safe to free (evaporate) markers immediately here,

FWIW on my system applying this patch does not resolve the org-capture
issue. I'm testing with org-20160718 from GNU Elpa and latest Emacs 25
branch from the git (Repository revision: 
4157159a37b43712440da91a45a6d5f71eb96e8a).

With these versions of Org and Emacs and your patch applied, with a
recipe similar to that posted by Robert Pluim on 2016-07-18,
specifically

  src/emacs -Q

  M-: (custom-set-variables '(package-selected-packages (quote 
(org-20160718 RET
  M-x package-initialize RET

  C-x C-f   ; find file.
  C-S-backspace ; kill-whole-line.
  ~/.notes RET  ; Open the file expected by default capture template.
  M-x org-mode RET  ; put the buffer into Org Mode.
  M-x org-capture RET t ; Run the default "Task" capture template bound to the 
t key.

I get the error: 

  org-capture: Capture template ‘t’: Match data clobbered by buffer 
modification hooks

. I also get a similar error with your patch and my full configuration
loaded and using my own capture templates:

  org-capture: Capture abort: (error Match data clobbered by buffer 
modification hooks)

.

The results above are same as I get if I do not apply your patch.

[On the other hand, with the same version of Org as above and Emacs from the
25.0.95 tarball, I do not see these error.]






Re: [O] convert rmarkdown (rmd) files to orgmode?

2016-07-21 Thread Xebar Saram
Hi again

Chuck:

is there a way to modify you nice code regex code snippet to simultaneously
change all example blocks to R blocks in a converted rmd>org file?
so when executing the block all example blocks:


 #+BEGIN_EXAMPLE
 help.search("rnorm")
 #+END_EXAMPLE

will turn into R blocks

 #+BEGIN_SRC R :session Rorg  :results none
 help.search("rnorm")
#+END_SRC


thx!

Z








On Wed, Jul 20, 2016 at 9:00 PM, Xebar Saram  wrote:

> ahh i see what you mean.
>
> thats a cool tip yet i find i have to find/replace also for images,
> find/replace to change example blocks to R code blocks etc which is quite
> tedious since i have about 50 of these converted Rmd to org files :)
> ill keep investigating this and report back
>
> thx so much for the tips! :)
>
> Z
>
> On Wed, Jul 20, 2016 at 8:42 PM, Charles C. Berry 
> wrote:
>
>> On Wed, 20 Jul 2016, Xebar Saram wrote:
>>
>> thx for the tips!
>>>
>>> when i try to run the source block :
>>>
>>> #+BEGIN_SRC emacs-lisp :results silent
>>>  (replace-regexp "^=[{]r \\([^}]*\\)[}]\\(.*\\)=$"
>>>  "#+name: \\1
>>>  ,#+begin_src R
>>>  \\2
>>>  ,#+end_src")
>>>
>>> #+END_SRC
>>>
>>> i just get a nil in the message area. what am i missing?
>>>
>>>
>>
>> Nothing!
>>
>> The `:results silent' should suppress any output.
>>
>> Anyway, what you should see is that the code chunks that pandoc placed
>> inside equal signs like
>>
>> : ={r my-name} code =
>>
>> are now in src blocks.
>>
>> I think you need to put the src block at the top or add a
>>
>> : (goto-char (point-min))
>>
>> as its first line to be sure it converts all the code chunks.
>>
>>
>> Chuck
>>
>
>