Re: [O] FR: refile-and-link

2014-12-04 Thread Kyle Meyer
Adam Spiers  wrote:
> Forgive me if this has already been implemented, but I couldn't see
> it...

I don't know of a command that does this.

> I'm looking for something similar to the "extract method" operation
> which refactoring IDEs can perform on code.  You would select a
> headline (or maybe even region), hit `refile-and-link', and then after
> the normal refiling, a link to the refiled section would be inserted
> in the place where the refiled section previously lived.
>
> Thoughts?

The last refile location is stored in org-bookmark-names-plist. The
(lightly tested) function below uses that information to create a link
to the refiled heading.

#+begin_src emacs-lisp
  (defun org-refile-and-link ()
"Refile heading, adding a link to the new location.
  Prefix arguments are interpreted by `org-refile'."
(interactive)
(when (member current-prefix-arg '(3 (4) (16)))
  (user-error "Linking is incompatible with that prefix argument"))
(let ((heading  (org-get-heading t t))
  (orig-file (buffer-file-name)))
  (call-interactively #'org-refile)
  (let* ((refile-file
  (bookmark-get-filename
   (assoc (plist-get org-bookmark-names-plist :last-refile)
  bookmark-alist)))
 (same-file (string= orig-file refile-file))
 (link (if same-file
   (concat "*" heading)
 (concat refile-file "::*" heading)))
 (desc heading))
(open-line 1)
(insert (org-make-link-string link desc)
#+end_src

--
Kyle



[O] CLOCKSUM counts appointments excluded by tag

2014-12-04 Thread Myles English
Hello,

I am using git master from yesterday (commit 6d2a661f) and have found
that when the agenda is narrowed by tag (i.e. all appointments marked
with a certain tag are excluded), the clocksum still shows the
un-narrowed total.  Is this the correct behaviour, or a bug?

Selected variables:

org-agenda-columns-add-appointments-to-effort-sum is t
org-columns-default-format:
"%80ITEM(Task) %10Effort(Effort){:} %10Duration(Duration){:} %10CLOCKSUM"

org-global-properties:
(("Effort_ALL" . "0:00 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00 16:00 
24:00 32:00"))

Test org file:

;;,--
;;| * Nail org mode bug 
 
;;|   SCHEDULED: <2014-12-04 Thu 9:00-10:00>
 
;;| 
 
;;| * Earn money 
:spouse:
;;|   SCHEDULED: <2014-12-04 Thu 09:00-20:00>   
 
;;| 
 
;;| * Drink tea 
 
;;|   SCHEDULED: <2014-12-04 Thu 10:00-16:00>   
 
;;`--


C-c a < a   ;; get the agenda for the current test file
C-c C-x C-c ;; turn on column view

;;,--
;;| Thursday4 December 2014 | 18:00 |
;;|8:00..    
;;| * Nail org mode bug | 1:00  |
;;| * Earn money| 11:00 |
;;| * Drink tea | 6:00  |
;;`--


/ - TAB 'spouse' ;; narrow by excluding the item tagged 'spouse'

See how the 18:00 has counted the 11:00 that should have been excluded:

;;,--
;;| Thursday4 December 2014 | 18:00 |
;;|8:00..    
;;| * Nail org mode bug | 1:00  |
;;| * Drink tea | 6:00  |
;;`--

I would have expected something this:

;;,-
;;| Thursday4 December 2014 | 7:00 |
;;|8:00..    
;;| * Nail org mode bug | 1:00 |
;;| * Drink tea | 6:00 |
;;`-

and am therefore disappointed.

I haven't investigated if this happens for simple clocked time as well
as appointments yet.

Myles

P.S. Sorry for the ugly boxes, I can't remember how to get the nice
ones.




Re: [O] FR: refile-and-link

2014-12-04 Thread Thierry Pellé

+1

Since the destination is known after the refiling it may not be difficult.
I say this but I'am not an elisp literate ;-)

Thierry

Le 03/12/2014 13:46, Adam Spiers a écrit :

Hi all!

Forgive me if this has already been implemented, but I couldn't see it...

I'm looking for something similar to the "extract method" operation
which refactoring IDEs can perform on code.  You would select a
headline (or maybe even region), hit `refile-and-link', and then after
the normal refiling, a link to the refiled section would be inserted
in the place where the refiled section previously lived.

Thoughts?

Thanks!
Adam




--
Mon adresse mél changera à compter de début 2015
Celle-ci sera désormais (mutatis mutandis) *soliavos [AROBASE] 
thierry-pelle [POINT] eu*.


Re: [O] Conditionally export certain sections based on predefined types

2014-12-04 Thread Ista Zahn
On Thu, Dec 4, 2014 at 1:59 PM, Pete Ley  wrote:
> Not a great title, but I'm not sure how to explain what I want
> succinctly.
>
> I'm trying to write a resume, and I'd like to be able to export
> different versions of it for different things. For instance, I don't
> necessarily want to include my hourly job experience when applying for a
> programming job, and I'd like to exclude my programming and other
> technical experience for certain job applications.
>
> I'm thinking something like this
>
> * Work experience
> ** Some hourly job
>:PROPERTIES:
>:export-exclude: programming
>:END:
>
> * Programming languages
>   :PROPERTIES:
>   :export-exclude: hourly
>   :END:
>
> Obviously it doesn't have to be properties, but I thought that was the
> most clear way to explain what I'm looking for. So I'd like to be able
> to export a specific type of resume, like a "programming" resume which
> excludes hourly jobs or an "hourly" resume which excludes programming
> language proficiency.
>
> Is there a way to do this already? Is there a canonical way to create
> this functionality? I'd rather not start hacking without a good idea of
> how more knowledgeable users might tackle this.

There might be better ways, but I do
--8<---cut here---start->8-

# uncomment one of these before export.
# for hourly version:
# #+EXCLUDE_TAGS: programming
# for programming version
# #+EXCLUDE_TAGS: hourly

* Work experience:hourly:
** Some hourly job

* Programming languages :programming:

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

Best,
Ista
>



[O] Conditionally export certain sections based on predefined types

2014-12-04 Thread Pete Ley
Not a great title, but I'm not sure how to explain what I want
succinctly. 

I'm trying to write a resume, and I'd like to be able to export
different versions of it for different things. For instance, I don't
necessarily want to include my hourly job experience when applying for a
programming job, and I'd like to exclude my programming and other
technical experience for certain job applications. 

I'm thinking something like this

* Work experience
** Some hourly job
   :PROPERTIES:
   :export-exclude: programming
   :END:

* Programming languages
  :PROPERTIES:
  :export-exclude: hourly
  :END:

Obviously it doesn't have to be properties, but I thought that was the
most clear way to explain what I'm looking for. So I'd like to be able
to export a specific type of resume, like a "programming" resume which
excludes hourly jobs or an "hourly" resume which excludes programming
language proficiency.

Is there a way to do this already? Is there a canonical way to create
this functionality? I'd rather not start hacking without a good idea of
how more knowledgeable users might tackle this.



[O] Bug: header-args:C++ doesn't work

2014-12-04 Thread Puneeth Chaganti
Hello,

I was helping out "ablephar`" on IRC and they found that setting a
file property `header-args:C++` does not work.

After some edebug magic, I discovered that org has a feature that lets
you append property values! (Not the best way to discover a great
feature, I must say! :-)

The fix could either be a documentation fix. (I would've tried using
cpp instead of C++, if I knew that was supported). But, this would
still have some users seeing things broken and then looking up docs or
trying out the alternative.

OR

a "hacky" fix, (better for the users ?), could be to consider KEY+ to
be indicating appending, but KEY++ to not.  Thoughts?


Thanks,
Puneeth
diff --git a/lisp/org.el b/lisp/org.el
index e806440..fc850b8 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15415,7 +15415,8 @@ Being in this list makes sure that they are offered for completion.")
 (defun org--update-property-plist (key val props)
   "Associate KEY to VAL in alist PROPS.
 Modifications are made by side-effect.  Return new alist."
-  (let* ((appending (string= (substring key -1) "+"))
+  (let* ((appending (and (string= (substring key -1) "+")
+ (not (string= (substring key -2) "++"
 	 (key (if appending (substring key 0 -1) key))
 	 (old (assoc-string key props t)))
 (if (not old) (cons (cons key val) props)


Re: [O] unlinking links

2014-12-04 Thread Nicolas Goaziou
Hello,

Adam Spiers  writes:

> On Thu, Nov 06, 2014 at 08:30:08PM -0500, John Kitchin wrote:
>> Adam Spiers  writes:
>> > Is it just me or is there no quick way to remove the link from some
>> > hyperlinked text? If so, please consider this a feature request ;-)
>> 
>> Try this:
>> 
>> (defun unlinkify ()
>>   "replace an org-link with the path, or description."
>>   (interactive)
>>   (let ((eop (org-element-context)))
>> (when (eq 'link (car eop))

(when (eq (org-element-type eop) 'link)

>> (message "%s" eop)
>>   (let* ((start (org-element-property :begin eop))
>>   (end (org-element-property :end eop))
>>   (contents-begin (org-element-property :contents-begin eop))
>>   (contents-end (org-element-property :contents-end eop))
>>   (path (org-element-property :path eop))
>>   (desc (and contents-begin
>>  contents-end
>>  (buffer-substring contents-begin contents-end
>>  (setf (buffer-substring start end) (or desc path))
>
> Thanks, that worked great!  Can I suggest you submit this for
> inclusion in org itself? :-)  I guess it would need to be called
> `org-unlinkify'.

FWIW, I don't think it is useful enough for inclusion in core. It could
go in Worg however.


Regards,

-- 
Nicolas Goaziou



[O] navigation to ignore inline tasks

2014-12-04 Thread Andreas Leha
Hi all,

how can I make (the navigation) commands (e.g. C-c C-n, etc.) ignore
inlinetasks?

Thanks,
Andreas




Re: [O] unlinking links

2014-12-04 Thread Adam Spiers
On Thu, Nov 06, 2014 at 08:30:08PM -0500, John Kitchin wrote:
> Adam Spiers  writes:
> > Is it just me or is there no quick way to remove the link from some
> > hyperlinked text? If so, please consider this a feature request ;-)
> 
> Try this:
> 
> (defun unlinkify ()
>   "replace an org-link with the path, or description."
>   (interactive)
>   (let ((eop (org-element-context)))
> (when (eq 'link (car eop))
> (message "%s" eop)
>   (let* ((start (org-element-property :begin eop))
>(end (org-element-property :end eop))
>(contents-begin (org-element-property :contents-begin eop))
>(contents-end (org-element-property :contents-end eop))
>(path (org-element-property :path eop))
>(desc (and contents-begin
>   contents-end
>   (buffer-substring contents-begin contents-end
>   (setf (buffer-substring start end) (or desc path))

Thanks, that worked great!  Can I suggest you submit this for
inclusion in org itself? :-)  I guess it would need to be called
`org-unlinkify'.