Re: [O] Scatter-gather idea

2017-04-06 Thread John Kitchin
I am sympathetic to not wanting to use tags here. It would be tedious to
tag them all, and then remove them (my opinion of course;). Here is some
code that you can "mark" headlines with a speed command (M on a headline
start) or interactively. This just stores a marker to the headline in a
global variable. Then, use M-x scatter-gather to put them all into one
temporary buffer. From there you can manipulate them any way you want,
and save the result anyway you want. You could modify scatter-gather to
either copy or move the headlines.

You could also use overlays to indicate a headline had been marked, and
make some convenience functions to remove headlines from the list, but I
leave those for exercises ;)

This code is lightly tested.

#+BEGIN_SRC emacs-lisp
(defvar scatter-gather-markers '()
  "List of markers where headlines are for gathering.")

(defun scatter-gather-mark-heading ()
  "Add the current headline to `scatter-gather-markers'."
  (interactive)
  (unless (org-at-heading-p)
(outline-previous-heading))
  (add-to-list 'scatter-gather-markers (point-marker)))


(defun scatter-gather ()
  "Gather marked headlines into a temporary buffer"
  (interactive)
  (when scatter-gather-markers
(switch-to-buffer-other-window (get-buffer-create "*scatter-gather*"))
(loop for marker in (reverse scatter-gather-markers)
  do
  (insert (with-current-buffer (marker-buffer marker)
(save-excursion
  (goto-char (marker-position marker))
  (org-mark-subtree)
  (buffer-substring (point) (mark))
(setq scatter-gather-markers '(

(add-to-list 'org-speed-commands-user (cons "M" 'scatter-gather-mark-heading))
#+END_SRC


Nick Dokos writes:

> Bob Newell  writes:
>
 mark them with tags, and do org-tags-view. Or, you can use regex or other
 criteria if you like.

>>>
>>> That was my first thought too: I didn't think any extra functionality is 
>>> needed.
>>
>> I looked into this earlier but agenda bulk marking doesn't seem to work
>> in an arbitrary org-mode buffer; it must be an agenda buffer, and you
>> can only mark certain entries.
>>
>> The tag idea may be the best way. Thanks to all for the replies.
>
> Yes, sorry: I was talking about tags, not about agenda bulk-marking. Although 
> you
> can add an arbitrary org file to the agend with `C-c [', do what you need to 
> do,
> and then remove it with `C-c ]'.


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



Re: [O] Evil-mode keymapping being overridden by org-mode

2017-04-06 Thread Brandon Amos

I have found a solution to this problem.

This keymapping was coming from the spacemacs org-mode layer:
https://github.com/syl20bnr/spacemacs/blob/bd7ef98e4c35fd87538dd2a81356cc83f5fdi02f3/layers/%2Bemacs/org/local/evil-org/evil-org.el#L134

In my init, this mapping can also be over-written to `evil-next-line`:

  (evil-define-key 'normal evil-org-mode-map "t" 'evil-next-line)

-Brandon.

signature.asc
Description: PGP signature


Re: [O] Scatter-gather idea

2017-04-06 Thread Nick Dokos
Bob Newell  writes:

>>> mark them with tags, and do org-tags-view.  Or, you can use regex or other
>>> criteria if you like.
>>>
>>
>> That was my first thought too: I didn't think any extra functionality is 
>> needed.
>
> I looked into this earlier but agenda bulk marking doesn't seem to work
> in an arbitrary org-mode buffer; it must be an agenda buffer, and you
> can only mark certain entries.
>
> The tag idea may be the best way. Thanks to all for the replies.

Yes, sorry: I was talking about tags, not about agenda bulk-marking. Although 
you
can add an arbitrary org file to the agend with `C-c [', do what you need to do,
and then remove it with `C-c ]'.
-- 
Nick




Re: [O] Scatter-gather idea

2017-04-06 Thread Bob Newell
>> mark them with tags, and do org-tags-view.  Or, you can use regex or other
>> criteria if you like.
>>
>
> That was my first thought too: I didn't think any extra functionality is 
> needed.

I looked into this earlier but agenda bulk marking doesn't seem to work
in an arbitrary org-mode buffer; it must be an agenda buffer, and you
can only mark certain entries.

The tag idea may be the best way. Thanks to all for the replies.

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




[O] Evil-mode keymapping being overridden by org-mode

2017-04-06 Thread Brandon Amos
Hi, I am mapping the "t" character in evil normal/motion modes to
`evil-next-line` with the following. I am doing this mapping
for reasonable navigation with the Dvorak layout.

  (define-key evil-normal-state-map "t" 'evil-next-line)
  (define-key evil-motion-state-map "t" 'evil-next-line)

This works well, except in one case when org mode over-rides
my mapping with `org-todo`:

  1. Open Emacs and an org file
  2. In normal mode, `C-h k t` shows that `t` is bound to evil-next-line.
  3. Open the agenda with `C-a a`
  4. Close the agenda buffer with `C-x 0`
  5. In normal mode, `C-h k t` shows that `t` is bound to `org-todo`

How can I prevent opening the agenda buffer from
over-writing this key mapping like this?

I've tried searching for ways to unset this org-mode keyboard mapping
and ways to define keyboard mappings that can't be over-ridden,
but I haven't been able to find anything that works.

If it is helpful, I am using this version of spacemacs:
https://github.com/syl20bnr/spacemacs/tree/c2774bc0dea3dbc63621709d54685fbbe9212d55
My (near-vanilla) spacemacs init file is here.
I set the evil keymappings in dotspacemacs/user-config:
https://github.com/bamos/dotfiles/blob/master/.spacemacs.d/init.el

-Brandon.



Re: [O] Viewing pdf images

2017-04-06 Thread Julian M. Burgos
So if I have an org file with links to pdfs, your function will convert
those pdfs to images and also will replace the link to the pdf for the
link to the newly created png?

Kaushal Modi writes:

> On Wed, Apr 5, 2017, 5:21 AM Julian M. Burgos 
> wrote:
>
>> Can you clarify the purpose of this function?  I understand that
>> produces an image of each pdf linked to the file.
>
>
> That's correct, but the user can control when that happens by adding that
> function to the appropriate hook.
>
>  But
>
> the question in
>> emacs.stackexchange was about displaying pdf's as inline images.
>
>
> Yes, I forgot to change the hook when I updated the whole answer; I have
> fixed that now. Now the answer shows how to add this function to the
> before-save-hook.
>
>  Your
>
> function only converts the pdfs into images (and you have to do an
>> export to achieve that).
>
>
> Well, the function org-include-img-from-pdf is the workhorse here, and it
> doesn't depend on when you want the PDF to PNG conversion to happen. The
> "when" depends on the hook you add the function to.
>
>   You would still would have to add a link to
>> the image file in order to see it as an inline image.
>> add a link in order to see it, correct?
>>
>
> I didn't follow that. The user is already adding that. Example:
>
> # ()convertfrompdf:t
> # User needs to have a ./foo.pdf. That will be converted to the below
> referenced foo.png.
> [[./foo.png]]
>
> When I get to a computer, I'll confirm if the #+CAPTION: and/or #+NAME: is
> needed for the inline images to show. Above works fine for exports, so I
> assumed that the inline images should show fine too.


--
Julian Mariano Burgos, PhD
Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/
Marine and Freshwater Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian.bur...@hafogvatn.is