Re: [O] Insert org-id Link at Point via Outline Path Completion

2015-08-02 Thread Bernhard Pröll

Hi again,

my guess into the blue: You haven't set the directory as described in
the readme (it defaults to nil).

Since I don't use helm, I haven't considered it.

The purpose of this backend is avoiding the `find-file-noselect' as used
in `org-refile' and the `helm-org-agenda-headings' suggested by John.
It's somewhat in-between using `org-refile' and an indexing with
external tools (recoll for example as recently debated on this list).

Regards,
Bernhard Pröll

On Sat, 01. Aug 16:20, Xebar Saram wrote:

Thx so much Bernhard

this looks really promising. i never had luck with either company or
auto-complete t o get it to work reliably (it often stops working even though
its still in the mod bar).
anyway i tried it and added this to my config (after cloning from git):

(add-to-list 'load-path /home/zeltak/.emacs.g/company-org-headings)
(add-hook 'org-mode-hook
 (lambda () (set (make-local-variable 'company-backends)
    '((company-org-headings)

i dont see it completes on org heading, is there any keys i need to press or
anything else in need to config? does this work only when you try to insert a
link?

best and thx so much, this look awesome

P.S have you considered Helm for this as well?

best

Z



On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll bmutbuer...@gmail.com wrote:

   Hi Saram,

   I've been in the same boat and decided to write a company-backend for
   this purpose. So if you're already using company-mode, this may be worth
   looking into:

   https://github.com/mutbuerger/company-org-headings

   Keep in mind that I'm in the process of learning Elisp and
   there has been little to no testing done on the package. Furthermore it
   uses org-store-link instead of org-id-store-link.

   Regards,
   Bernhard Pröll


   On Fri, 31. Jul 09:43, Xebar Saram wrote:

   i also have a similar workflow and would love to hear Dominic if you
   found a
   solution for this or if anyone on the list has other suggestions?

   best

   Z

   On Tue, May 12, 2015 at 10:57 PM, Dominic Surano sk8ing...@gmail.com
   wrote:

      Hello,

      I use org-mode a lot like a wiki so links to other org-mode headings
   are
      very common. Currently, I navigate to the heading or pull it up in
   an
      agenda view, store the link with C-l, going back to where I want to
      insert the link, then insert the link with C-c C-l RET. This is a
   bit
      time consuming.

      Instead, I would prefer to map a key that allows me to insert a link
   at
      the current point using tab completion similar to org-refile (C-c
   C-w).
      Looking through org-id.el, it seems like
   org-id-get-with-outline-path
      completion was designed for this purpose. I tried:

      (global-set-key \C-ci (lambda () (interactive) (org-id-get-with
      outline-path-completion)))

      but it didn't work as intended. Anyone have any ideas?

      Thanks!
      -D

      For reference, I have the following set in my configuration:

      ;; Use global IDs
      (require 'org-id)
      (setq org-id-link-to-org-use-id t)

      ;; Update ID file .org-id-locations on startup
      (org-id-update-id-locations)

      ;; Targets include this file and any file contributing to the agenda
   -
      up to 9 levels deep
      (setq org-refile-targets (quote ((nil :maxlevel . 9)
                                       (org-agenda-files :maxlevel . 9
      (setq org-refile-use-outline-path 'file)
      (setq org-outline-path-complete-in-steps t)
      (setq org-refile-allow-creating-parent-nodes t)










[O] controlling how htmlize fontifies code

2015-08-02 Thread Eric S Fraga
Hello all,

I have to prepare a whole new set of lectures for a new course and I
thought I would play around with =ox-reveal= as an HTML export target
may actually be more appropriate for this course than my usual PDF
target.  And one of the best features of org is that most of the effort
is the same regardless of target so I won't be wasting much time
playing! :-)

In playing around with reveal, I realised that exporting code uses the
=ox-html= exporter (obvious, in hindsight).  This exporter uses emacs's
own fontifying engine to colour code for export.  My problem is that I
use a dark background theme for emacs but want presentations to be based
on a light background.  The code colouring, as a result, is completely
wrong.

Now, I can simply start up emacs with a light background, export my
slides and everything is fine.  However, it would be nice to not have to
start up a new emacs just for this.  Is there an easy way to pretend,
for export to HTML, that emacs is using a light background?  Maybe a way
to advise the exporter?  

Thanks,
eric

PS - ideally, code export to HTML would make use of CSS instead of
 hard-coding in the colours but that's a discussion for another
 day...
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3beta-1303-g3f0398



Re: [O] controlling how htmlize fontifies code

2015-08-02 Thread Kaushal
I export with my custom Leuven theme (a light theme) css and it works fine.
I also have my emacs theme as a dark theme by default.

;; (setq org-html-htmlize-output-type 'inline-css) ; default
(setq org-html-htmlize-output-type 'css)
;; (setq org-html-htmlize-font-prefix ) ; default
(setq org-html-htmlize-font-prefix org-)

Check out this link for the full solution including Leuven theme css:
http://emacs.stackexchange.com/a/7633/115

--
Kaushal Modi
On Aug 2, 2015 9:19 AM, Rick Frankel r...@rickster.com wrote:

 On Sun, Aug 02, 2015 at 10:24:25AM +0100, Eric S Fraga wrote:
  Now, I can simply start up emacs with a light background, export my
  slides and everything is fine.  However, it would be nice to not have to
  start up a new emacs just for this.  Is there an easy way to pretend,
  for export to HTML, that emacs is using a light background?  Maybe a way
  to advise the exporter?

  PS - ideally, code export to HTML would make use of CSS instead of
   hard-coding in the colours but that's a discussion for another
   day...

 Check the documentation for the variable `org-html-htmlize-output-type'.
 Since
 ox-reveal is derived from ox-html, it should work as specified. I
 personally
 use ox-deck (also derived from html), so YMMV.

 rick




Re: [O] controlling how htmlize fontifies code

2015-08-02 Thread Rick Frankel
On Sun, Aug 02, 2015 at 10:24:25AM +0100, Eric S Fraga wrote:
 Now, I can simply start up emacs with a light background, export my
 slides and everything is fine.  However, it would be nice to not have to
 start up a new emacs just for this.  Is there an easy way to pretend,
 for export to HTML, that emacs is using a light background?  Maybe a way
 to advise the exporter?

 PS - ideally, code export to HTML would make use of CSS instead of
  hard-coding in the colours but that's a discussion for another
  day...

Check the documentation for the variable `org-html-htmlize-output-type'. Since
ox-reveal is derived from ox-html, it should work as specified. I personally
use ox-deck (also derived from html), so YMMV.

rick



Re: [O] How to escape [ and ] characters in org-mode links

2015-08-02 Thread Ivanov Dmitry
 It works here on a recent Org.

Thank you. I have a little outdated version. It started to work after
I used the escaped percent as Kyle Meyer suggested.



Re: [O] [Feature Request] Let publishing-function decide :output-file and whether publishing is needed

2015-08-02 Thread Nicolas Goaziou
Hello,

Ruben Maher r...@rkm.id.au writes:

 I've been working on a derived exporter to publish a static blog, and
 I've run into some issues.  Say that `:publishing-directory' is
 ~/public_html and I have `:base-directory' with an Org file foo.org.

 foo.org has option keywords like this:

 #+title: foo.org
 #+date: 2015-07-25 Sat 17:21:41


 My derived exporter visits each Org file to get information from the
 keywords, and would export foo.org like so: foo.org -
 ~/public_html/2015/07/25/foo/index.html, using something like


 #+begin_src elisp
 (let ((pub-dir
(file-name-as-directory
 (concat (expand-file-name pub-dir)
 (format-time-string %Y/%m/%d/ date)
 (file-name-base filename)
   (org-publish-org-to
'rkm-html filename
(concat . (or (plist-get plist :html-extension)
org-html-extension html))
(org-combine-plists plist '(:output-file index)) pub-dir))
 #+end_src

Can't you simply use org-publish-after-publishing-hook to copy the
published file elsewhere?

Or, if you write your own exporter, do it à la ox-latex.el, i.e.,
publish in :base-directory and move it elsewhere with
`org-publish-attachment'?


 I have achieved this using the attached diff, which tells
 `org-export-output-file-name' to respect the property `:output-file' in
 the communications channel.

This doesn't sound right: if you know the file name beforehand, you
don't need to call `org-export-output-file-name' in the first place.

Regards,

-- 
Nicolas Goaziou



Re: [O] Insert org-id Link at Point via Outline Path Completion

2015-08-02 Thread Xebar Saram
Thx john

i evaled the code yet i cant see it under M-x, am i missing something?

best

Z

On Sat, Aug 1, 2015 at 10:03 PM, John Kitchin jkitc...@andrew.cmu.edu
wrote:

 usually it is pretty easy to add new functions in helm, but it is less
 easy in this case because the source is dynamically generated from a
 function. So, in this case I think we have to just redefine the function
 that generates the source. here is an example that I think makes an id
 link as a new action.

 #+BEGIN_SRC emacs-lisp
 (defun helm-org-insert-id-link-to-heading-at-marker (marker)
   (with-current-buffer (marker-buffer marker)
 (let ((file-name (buffer-file-name))
   (id (save-excursion (goto-char (marker-position marker))
   (org-id-get-create)
   (org-id-store-link

   (with-helm-current-buffer
 (org-insert-link
  file-name id)


 (cl-defun helm-source-org-headings-for-files (filenames
   optional (min-depth 1)
 (max-depth 8))
   (helm-build-sync-source Org Headings
 :candidates (helm-org-get-candidates filenames min-depth max-depth)
 :action '((Go to line . helm-org-goto-marker)
   (Refile to this heading . helm-org-heading-refile)
   (Insert link to this heading
. helm-org-insert-link-to-heading-at-marker)
   (Insert id link to this heading .
helm-org-insert-id-link-to-heading-at-marker

 #+END_SRC
 Xebar Saram writes:

  Hi again
 
  so excited over this had to ask 2 more questions ;-)
 
  1.can that function include/link to org-id  (so that it can keep the
 links
  even if the headers move around in/out of the files)
  2.i saw there are 3 options to that helm function. can this be customized
  to add more commands (can really think of which ones know but could see
  potential in future :))
 
  thx so much John as always you rock ;-)
 
  Z
 
  On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram zelt...@gmail.com wrote:
 
  John, this is superb!
 
  thx so much it answers all my needs, what a great find :)
 
  kind regards
 
  Z
 
  On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin jkitc...@andrew.cmu.edu
  wrote:
 
  (helm-org-agenda-files-headings) seems to do this already for all
  headlines in your agenda files. the third action is to insert a link to
  the selected headline.
 
  You can use let to temporarily define the org-agenda-files list to what
  you want, and just use the (helm-org-agenda-files-headings) command for
  non-agenda files.
 
  e.g.
 
  #+BEGIN_SRC emacs-lisp
  (defun insert-heading-link (dir)
select a headline from org-files in dir and insert a link to it.
(interactive  (list (read-directory-name Directory: )))
(let ((org-agenda-files (f-entries
 dir
 (lambda (f)
   (string=
org
(file-name-extension f)))
 t)))
  (helm-org-agenda-files-headings)))
  #+END_SRC
 
  gives me a helm buffer to select headlines from org-files in the
  directory I select and when I press f3 (for the third
  action), it inserts a link to the selected headline. It does the file
  finding recursively, so you might not want to run this on /  ;)
 
  You could bind it to a key for easy use.
 
  Xebar Saram writes:
 
   Thx so much Bernhard
  
   this looks really promising. i never had luck with either company or
   auto-complete t o get it to work reliably (it often stops working
 even
   though its still in the mod bar).
   anyway i tried it and added this to my config (after cloning from
 git):
  
   (add-to-list 'load-path /home/zeltak/.emacs.g/company-org-headings)
   (add-hook 'org-mode-hook
(lambda () (set (make-local-variable 'company-backends)
   '((company-org-headings)
  
   i dont see it completes on org heading, is there any keys i need to
  press
   or anything else in need to config? does this work only when you try
 to
   insert a link?
  
   best and thx so much, this look awesome
  
   P.S have you considered Helm for this as well?
  
   best
  
   Z
  
  
  
   On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll 
 bmutbuer...@gmail.com
   wrote:
  
   Hi Saram,
  
   I've been in the same boat and decided to write a company-backend
 for
   this purpose. So if you're already using company-mode, this may be
  worth
   looking into:
  
   https://github.com/mutbuerger/company-org-headings
  
   Keep in mind that I'm in the process of learning Elisp and
   there has been little to no testing done on the package.
 Furthermore it
   uses org-store-link instead of org-id-store-link.
  
   Regards,
   Bernhard Pröll
  
  
   On Fri, 31. Jul 09:43, Xebar Saram wrote:
  
   i also have a similar workflow and would love to hear Dominic if
 you
   found a
   solution for this or if anyone on the list has other suggestions?

Re: [O] Auto insert and change date in header?

2015-08-02 Thread Xebar Saram
Hi John

i tried it by evaluating it and then it works exactly as i needed:) the
only bizarre thing is that when i add it to my config emacs is frozen
during startup.
ive also tried adding the extra lines you suggested so now the lisp part
looks like this


#+BEGIN_SRC emacs-lisp
(defun update-last-edited (beg end length)
  (when
  (and
   (not (org-before-first-heading-p))
   (org-get-heading))
(org-entry-put nil LAST-EDITED (format-time-string
[%d-%m-%Y(%H:%M)]

(add-to-list 'after-change-functions 'update-last-edited)

(add-hook 'org-mode-hook (lambda ()
(add-to-list 'after-change-functions 'update-last-edited)))

#+END_SRC

any idea why it freezes emacs?

best

Z

On Sat, Aug 1, 2015 at 7:05 PM, John Kitchin jkitc...@andrew.cmu.edu
wrote:


 This seems to do what you want for the changes. The timestamp is
 automatically added when you make changes. It does not propagate
 timestamps up though, so if you change a subheading the timestamp there
 is updated, but the one in the parent for example. also, this will
 update every headline.

 You may need to add another (add-hook 'org-mode-hook (lambda ()
 (add-to-list 'after-change-functions 'update-last-edited))) kind of line
 to enable this in all org-files, the code below might be buffer local.

 #+BEGIN_SRC emacs-lisp
 (defun update-last-edited (beg end length)
   (when
   (and
(not (org-before-first-heading-p))
(org-get-heading))
 (org-entry-put nil LAST-EDITED (format-time-string [%Y-%m-%d %a
 %H:%M:%S]

 (add-to-list 'after-change-functions 'update-last-edited)
 #+END_SRC



 Xebar Saram writes:

  Hi all
 
  coming back to it after 3 years :)
 
  im wondering if anyone has a hook or anything like that that auto adds a
  date when he creates a header. and maybe also auto change the date each
  time  the text under the header is changed? kind of simulating a
 timestamp
  type function :)
 
  best
 
  Z
 
  On Fri, Jul 26, 2013 at 11:49 PM, Dave Marquardt davem...@us.ibm.com
  wrote:
 
  Xebar Saram zelt...@gmail.com writes:
 
   does any one know of a way to auto insert/change the date in each
  sections
   header when the section is edited?IE have a date in the header showing
   last edited date.
   Is this technically possible?
 
  Try setting before-save-hook.  See (elisp) Saving Buffers.
 
  -Dave
 
 
 

 --
 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



[O] Trouble with autofill mode

2015-08-02 Thread Vikas Rawal
I am inserting LaTeX \index{} commands in an org document to create an index. 
Almost everything works fine. But I am having trouble with auto-fill-mode. It 
often puts a line break in the middle of an index entry, and then it does not 
work. 

That is, \index{my name} is sometimes broken into \index{my
name}. This creates a problem for LaTeX.

I have disabled auto-fill-mode for now, but that is clearly a sub-optimal thing 
to do. Is there a way to tell it not to put line breaks in the middle of 
\index{} entries?

Vikas


[O] Trouble with auto-fill-mode

2015-08-02 Thread Vikas Rawal
I am inserting LaTeX \index{} commands in an org document to create an index. 
Almost everything works fine. But I am having trouble with auto-fill-mode. It 
often puts a line break in the middle of an index entry, and then it does not 
work. 

That is, \index{my name} is sometimes broken into \index{my
name}. This creates a problem for LaTeX.

I have disabled auto-fill-mode for now, but that is clearly a sub-optimal thing 
to do. Is there a way to tell it not to put line breaks in the middle of 
\index{} entries?

Vikas


Re: [O] How to escape [ and ] characters in org-mode links

2015-08-02 Thread Nicolas Goaziou
Hello,

Ivanov Dmitry usr...@gmail.com writes:

 Unfortunately URL encoding the [ and ] doesn't work for me. Try to
 reproduce it. Create 2 files:

 file.txt. Content:
 
 $form['text1']

 $form['text2']
 
 file.org. Content:
 
 [[./file.txt::$form%5B'text2'%5D][text2]]
 

 When I click the link, it says No match.

It works here on a recent Org.


Regards,

-- 
Nicolas Goaziou



[O] [ANN] Table optimizations

2015-08-02 Thread Nicolas Goaziou
Hello,

I committed some changes to org-table.el in order to make them slightly
more responsive in large buffers. I also refreshed some old code so as
to prepare for lexical binding switching.

Do not hesitate to report anything suspicious in this area. 

Thank you.


Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] Insert org-id Link at Point via Outline Path Completion

2015-08-02 Thread John Kitchin
You are, that code modifies the helm-org-agenda-files-headings function by
adding a new action to it. So, try:

M-x helm-org-agenda-files-headings

select a heading, press tab, and you should see a 4th, new action to insert
an org-id link.

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 Sun, Aug 2, 2015 at 2:20 PM, Xebar Saram zelt...@gmail.com wrote:

 Thx john

 i evaled the code yet i cant see it under M-x, am i missing something?

 best

 Z

 On Sat, Aug 1, 2015 at 10:03 PM, John Kitchin jkitc...@andrew.cmu.edu
 wrote:

 usually it is pretty easy to add new functions in helm, but it is less
 easy in this case because the source is dynamically generated from a
 function. So, in this case I think we have to just redefine the function
 that generates the source. here is an example that I think makes an id
 link as a new action.

 #+BEGIN_SRC emacs-lisp
 (defun helm-org-insert-id-link-to-heading-at-marker (marker)
   (with-current-buffer (marker-buffer marker)
 (let ((file-name (buffer-file-name))
   (id (save-excursion (goto-char (marker-position marker))
   (org-id-get-create)
   (org-id-store-link

   (with-helm-current-buffer
 (org-insert-link
  file-name id)


 (cl-defun helm-source-org-headings-for-files (filenames
   optional (min-depth 1)
 (max-depth 8))
   (helm-build-sync-source Org Headings
 :candidates (helm-org-get-candidates filenames min-depth max-depth)
 :action '((Go to line . helm-org-goto-marker)
   (Refile to this heading . helm-org-heading-refile)
   (Insert link to this heading
. helm-org-insert-link-to-heading-at-marker)
   (Insert id link to this heading .
helm-org-insert-id-link-to-heading-at-marker

 #+END_SRC
 Xebar Saram writes:

  Hi again
 
  so excited over this had to ask 2 more questions ;-)
 
  1.can that function include/link to org-id  (so that it can keep the
 links
  even if the headers move around in/out of the files)
  2.i saw there are 3 options to that helm function. can this be
 customized
  to add more commands (can really think of which ones know but could see
  potential in future :))
 
  thx so much John as always you rock ;-)
 
  Z
 
  On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram zelt...@gmail.com wrote:
 
  John, this is superb!
 
  thx so much it answers all my needs, what a great find :)
 
  kind regards
 
  Z
 
  On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin jkitc...@andrew.cmu.edu
  wrote:
 
  (helm-org-agenda-files-headings) seems to do this already for all
  headlines in your agenda files. the third action is to insert a link
 to
  the selected headline.
 
  You can use let to temporarily define the org-agenda-files list to
 what
  you want, and just use the (helm-org-agenda-files-headings) command
 for
  non-agenda files.
 
  e.g.
 
  #+BEGIN_SRC emacs-lisp
  (defun insert-heading-link (dir)
select a headline from org-files in dir and insert a link to it.
(interactive  (list (read-directory-name Directory: )))
(let ((org-agenda-files (f-entries
 dir
 (lambda (f)
   (string=
org
(file-name-extension f)))
 t)))
  (helm-org-agenda-files-headings)))
  #+END_SRC
 
  gives me a helm buffer to select headlines from org-files in the
  directory I select and when I press f3 (for the third
  action), it inserts a link to the selected headline. It does the file
  finding recursively, so you might not want to run this on /  ;)
 
  You could bind it to a key for easy use.
 
  Xebar Saram writes:
 
   Thx so much Bernhard
  
   this looks really promising. i never had luck with either company or
   auto-complete t o get it to work reliably (it often stops working
 even
   though its still in the mod bar).
   anyway i tried it and added this to my config (after cloning from
 git):
  
   (add-to-list 'load-path
 /home/zeltak/.emacs.g/company-org-headings)
   (add-hook 'org-mode-hook
(lambda () (set (make-local-variable 'company-backends)
   '((company-org-headings)
  
   i dont see it completes on org heading, is there any keys i need to
  press
   or anything else in need to config? does this work only when you
 try to
   insert a link?
  
   best and thx so much, this look awesome
  
   P.S have you considered Helm for this as well?
  
   best
  
   Z
  
  
  
   On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll 
 bmutbuer...@gmail.com
   wrote:
  
   Hi Saram,
  
   I've been in the same boat and decided to write a company-backend
 for
   this purpose. So if you're 

Re: [O] Org-mode exporters licensing

2015-08-02 Thread Nicolas Goaziou
Hello,

Marcin Borkowski mb...@mbork.pl writes:

 And I do not.  I suspect that many authors don't care, and use GPL (or
 BSD, or other license) just so that they don't have to write a license
 themselves.  Of course, this is only my suspicion, and I might be
 totally wrong.

As a data point, in order to clear any ambiguity, I _do_ care about the
GNU project, and, as a consequence, about the licensing.

Of course, this doesn't invalidate your suspicion.


Regards,

-- 
Nicolas Goaziou



Re: [O] How to escape [ and ] characters in org-mode links

2015-08-02 Thread Kyle Meyer
Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 Hello,

 Ivanov Dmitry usr...@gmail.com writes:

 Unfortunately URL encoding the [ and ] doesn't work for me. Try to
 reproduce it. Create 2 files:

 file.txt. Content:
 
 $form['text1']

 $form['text2']
 
 file.org. Content:
 
 [[./file.txt::$form%5B'text2'%5D][text2]]
 

 When I click the link, it says No match.

 It works here on a recent Org.

Hmm, that's weird.  I'm still seeing this with emacs -Q using
release_8.3beta-1312-g8094d0.

--
Kyle



Re: [O] Insert org-id Link at Point via Outline Path Completion

2015-08-02 Thread Xebar Saram
Perfect :D

thx so much, as always really appreciate it!

z

On Sun, Aug 2, 2015 at 9:31 PM, John Kitchin jkitc...@andrew.cmu.edu
wrote:

 You are, that code modifies the helm-org-agenda-files-headings function by
 adding a new action to it. So, try:

 M-x helm-org-agenda-files-headings

 select a heading, press tab, and you should see a 4th, new action to
 insert an org-id link.

 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 Sun, Aug 2, 2015 at 2:20 PM, Xebar Saram zelt...@gmail.com wrote:

 Thx john

 i evaled the code yet i cant see it under M-x, am i missing something?

 best

 Z

 On Sat, Aug 1, 2015 at 10:03 PM, John Kitchin jkitc...@andrew.cmu.edu
 wrote:

 usually it is pretty easy to add new functions in helm, but it is less
 easy in this case because the source is dynamically generated from a
 function. So, in this case I think we have to just redefine the function
 that generates the source. here is an example that I think makes an id
 link as a new action.

 #+BEGIN_SRC emacs-lisp
 (defun helm-org-insert-id-link-to-heading-at-marker (marker)
   (with-current-buffer (marker-buffer marker)
 (let ((file-name (buffer-file-name))
   (id (save-excursion (goto-char (marker-position marker))
   (org-id-get-create)
   (org-id-store-link

   (with-helm-current-buffer
 (org-insert-link
  file-name id)


 (cl-defun helm-source-org-headings-for-files (filenames
   optional (min-depth 1)
 (max-depth 8))
   (helm-build-sync-source Org Headings
 :candidates (helm-org-get-candidates filenames min-depth max-depth)
 :action '((Go to line . helm-org-goto-marker)
   (Refile to this heading . helm-org-heading-refile)
   (Insert link to this heading
. helm-org-insert-link-to-heading-at-marker)
   (Insert id link to this heading .
helm-org-insert-id-link-to-heading-at-marker

 #+END_SRC
 Xebar Saram writes:

  Hi again
 
  so excited over this had to ask 2 more questions ;-)
 
  1.can that function include/link to org-id  (so that it can keep the
 links
  even if the headers move around in/out of the files)
  2.i saw there are 3 options to that helm function. can this be
 customized
  to add more commands (can really think of which ones know but could see
  potential in future :))
 
  thx so much John as always you rock ;-)
 
  Z
 
  On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram zelt...@gmail.com wrote:
 
  John, this is superb!
 
  thx so much it answers all my needs, what a great find :)
 
  kind regards
 
  Z
 
  On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin jkitc...@andrew.cmu.edu
 
  wrote:
 
  (helm-org-agenda-files-headings) seems to do this already for all
  headlines in your agenda files. the third action is to insert a link
 to
  the selected headline.
 
  You can use let to temporarily define the org-agenda-files list to
 what
  you want, and just use the (helm-org-agenda-files-headings) command
 for
  non-agenda files.
 
  e.g.
 
  #+BEGIN_SRC emacs-lisp
  (defun insert-heading-link (dir)
select a headline from org-files in dir and insert a link to it.
(interactive  (list (read-directory-name Directory: )))
(let ((org-agenda-files (f-entries
 dir
 (lambda (f)
   (string=
org
(file-name-extension f)))
 t)))
  (helm-org-agenda-files-headings)))
  #+END_SRC
 
  gives me a helm buffer to select headlines from org-files in the
  directory I select and when I press f3 (for the third
  action), it inserts a link to the selected headline. It does the file
  finding recursively, so you might not want to run this on /  ;)
 
  You could bind it to a key for easy use.
 
  Xebar Saram writes:
 
   Thx so much Bernhard
  
   this looks really promising. i never had luck with either company
 or
   auto-complete t o get it to work reliably (it often stops working
 even
   though its still in the mod bar).
   anyway i tried it and added this to my config (after cloning from
 git):
  
   (add-to-list 'load-path
 /home/zeltak/.emacs.g/company-org-headings)
   (add-hook 'org-mode-hook
(lambda () (set (make-local-variable 'company-backends)
   '((company-org-headings)
  
   i dont see it completes on org heading, is there any keys i need to
  press
   or anything else in need to config? does this work only when you
 try to
   insert a link?
  
   best and thx so much, this look awesome
  
   P.S have you considered Helm for this as well?
  
   best
  
   Z
  
  
  
   On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll 
 

Re: [O] controlling how htmlize fontifies code

2015-08-02 Thread Rasmus
Eric S Fraga e.fr...@ucl.ac.uk writes:

 Now, I can simply start up emacs with a light background, export my
 slides and everything is fine.  However, it would be nice to not have to
 start up a new emacs just for this.  Is there an easy way to pretend,
 for export to HTML, that emacs is using a light background?  Maybe a way
 to advise the exporter?  

Check the functions disable-theme and load-theme in Emacs; maybe map
custom-enabled-themes over disable-theme. Check the hooks
org-export-before-processing-hook and org-export-before-parsing-hook in ox
to automate it.

Some people on SX seem to have used some JS coloring libraries.

 PS - ideally, code export to HTML would make use of CSS instead of
  hard-coding in the colours but that's a discussion for another
  day...

This would also solve the problem when exporting in batch.  Patches
welcome.

Rasmus

-- 
I feel emotional landscapes they puzzle me




Re: [O] Trouble with autofill mode

2015-08-02 Thread Nicolas Goaziou
Hello,

Vikas Rawal vikasli...@agrarianresearch.org writes:

 I am inserting LaTeX \index{} commands in an org document to create an
 index. Almost everything works fine. But I am having trouble with
 auto-fill-mode. It often puts a line break in the middle of an index
 entry, and then it does not work.

 That is, \index{my name} is sometimes broken into \index{my
 name}. This creates a problem for LaTeX.

 I have disabled auto-fill-mode for now, but that is clearly
 a sub-optimal thing to do. Is there a way to tell it not to put line
 breaks in the middle of \index{} entries?

Have you tried

 #+INDEX: my name

Regards,

-- 
Nicolas Goaziou



Re: [O] How to escape [ and ] characters in org-mode links

2015-08-02 Thread Nicolas Goaziou
Hello,

Kyle Meyer k...@kyleam.com writes:

 Hmm, that's weird.  I'm still seeing this with emacs -Q using
 release_8.3beta-1312-g8094d0.

Indeed, my bad. This should be fixed in cfe5bc9.

However, the current escaping mechanism for links in Org is not really
satisfactory. In the long run, we will need to change it.


Regards,

-- 
Nicolas Goaziou



Re: [O] Trouble with autofill mode

2015-08-02 Thread Vikas Rawal
 
 I am inserting LaTeX \index{} commands in an org document to create an
 index. Almost everything works fine. But I am having trouble with
 auto-fill-mode. It often puts a line break in the middle of an index
 entry, and then it does not work.
 
 That is, \index{my name} is sometimes broken into \index{my
 name}. This creates a problem for LaTeX.
 
 I have disabled auto-fill-mode for now, but that is clearly
 a sub-optimal thing to do. Is there a way to tell it not to put line
 breaks in the middle of \index{} entries?
 
 Have you tried
 
 #+INDEX: my name
 
 Regards,
 


I am sorry for not being clear. \index{} may have to be used inline in a para 
since the index has to pick up the right page where a term appears. So you want 
to put it as close as possible to the keywords.

Vikas


Re: [O] Trouble with autofill mode

2015-08-02 Thread Vicente Vera
Hello,
This StackExchange question might help you out:
https://emacs.stackexchange.com/questions/12392/prevent-fill-paragraph-from-breaking-latex-citations-in-org-mode
(Only if I got your question right...)



Re: [O] Latex index using makeidx

2015-08-02 Thread John Kitchin
maybe hippie-expand? otherwise, you can write your own code to search the
buffer for entries, and use them as the collection for completing-read.

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 Sat, Aug 1, 2015 at 8:08 PM, Vikas Rawal vikasli...@agrarianresearch.org
 wrote:

 I am adding index entries in an org document, to be used with makeidx
 latex package. While the usual \index commands are working without any
 problem, I was wondering if anyone knows of an existing emacs utility that
 would add an autocomplete kind of facility (on the basis of previous
 entries) while making new entries.

 Sorry, this is not strictly about orgmode but about emacs. Please excuse
 me for that.

 Vikas



Re: [O] Trouble with autofill mode

2015-08-02 Thread Vikas Rawal

 On 03-Aug-2015, at 8:37 am, Vicente Vera vicente...@gmail.com wrote:
 
 Hello,
 This StackExchange question might help you out:
 https://emacs.stackexchange.com/questions/12392/prevent-fill-paragraph-from-breaking-latex-citations-in-org-mode
 (Only if I got your question right...)

Thanks very much. This should work. Let me try to modify it to my use case.

Much appreciated.

Vikas




Re: [O] Auto insert and change date in header?

2015-08-02 Thread John Kitchin
 you probably only need this:

(add-hook 'org-mode-hook (lambda ()
(add-to-list 'after-change-functions 'update-last-edited)))

and not this:

(add-to-list 'after-change-functions 'update-last-edited)

I guess that this last line could be causing an issue in buffers like
*Messages* which change a lot, especially during startup.


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 Sun, Aug 2, 2015 at 2:34 PM, Xebar Saram zelt...@gmail.com wrote:

 Hi John

 i tried it by evaluating it and then it works exactly as i needed:) the
 only bizarre thing is that when i add it to my config emacs is frozen
 during startup.
 ive also tried adding the extra lines you suggested so now the lisp part
 looks like this


 #+BEGIN_SRC emacs-lisp
 (defun update-last-edited (beg end length)
   (when
   (and
(not (org-before-first-heading-p))
(org-get-heading))
 (org-entry-put nil LAST-EDITED (format-time-string
 [%d-%m-%Y(%H:%M)]

 (add-to-list 'after-change-functions 'update-last-edited)

 (add-hook 'org-mode-hook (lambda ()
 (add-to-list 'after-change-functions 'update-last-edited)))

 #+END_SRC

 any idea why it freezes emacs?

 best

 Z

 On Sat, Aug 1, 2015 at 7:05 PM, John Kitchin jkitc...@andrew.cmu.edu
 wrote:


 This seems to do what you want for the changes. The timestamp is
 automatically added when you make changes. It does not propagate
 timestamps up though, so if you change a subheading the timestamp there
 is updated, but the one in the parent for example. also, this will
 update every headline.

 You may need to add another (add-hook 'org-mode-hook (lambda ()
 (add-to-list 'after-change-functions 'update-last-edited))) kind of line
 to enable this in all org-files, the code below might be buffer local.

 #+BEGIN_SRC emacs-lisp
 (defun update-last-edited (beg end length)
   (when
   (and
(not (org-before-first-heading-p))
(org-get-heading))
 (org-entry-put nil LAST-EDITED (format-time-string [%Y-%m-%d %a
 %H:%M:%S]

 (add-to-list 'after-change-functions 'update-last-edited)
 #+END_SRC



 Xebar Saram writes:

  Hi all
 
  coming back to it after 3 years :)
 
  im wondering if anyone has a hook or anything like that that auto adds a
  date when he creates a header. and maybe also auto change the date each
  time  the text under the header is changed? kind of simulating a
 timestamp
  type function :)
 
  best
 
  Z
 
  On Fri, Jul 26, 2013 at 11:49 PM, Dave Marquardt davem...@us.ibm.com
  wrote:
 
  Xebar Saram zelt...@gmail.com writes:
 
   does any one know of a way to auto insert/change the date in each
  sections
   header when the section is edited?IE have a date in the header
 showing
   last edited date.
   Is this technically possible?
 
  Try setting before-save-hook.  See (elisp) Saving Buffers.
 
  -Dave
 
 
 

 --
 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