emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-mode version 6.32b; org-remember only indents first line of %i substitution
@ 2009-11-12 15:27 Andrew J. Korty
  2009-11-18 22:54 ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew J. Korty @ 2009-11-12 15:27 UTC (permalink / raw)
  To: Org Mode

When %i appears indented in an org-remember template, each line of the
text substituted is supposed to be indented.  In my case, only the first
line is being indented.

Emacs  : GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.0.0, NS apple- 
appkit-1038.11)
  of 2009-11-10 on phrygian
Package: Org-mode version 6.32b

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Org-mode version 6.32b; org-remember only indents first line of %i substitution
  2009-11-12 15:27 Org-mode version 6.32b; org-remember only indents first line of %i substitution Andrew J. Korty
@ 2009-11-18 22:54 ` Carsten Dominik
  2009-11-19 21:22   ` Andrew J. Korty
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2009-11-18 22:54 UTC (permalink / raw)
  To: Andrew J. Korty; +Cc: Org Mode

Hi Andrew, this works fine for me, I cannot reproduce
the problem you are describing.

- Carsten

On Nov 12, 2009, at 4:27 PM, Andrew J. Korty wrote:

> When %i appears indented in an org-remember template, each line of the
> text substituted is supposed to be indented.  In my case, only the  
> first
> line is being indented.
>
> Emacs  : GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.0.0, NS apple- 
> appkit-1038.11)
> of 2009-11-10 on phrygian
> Package: Org-mode version 6.32b
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Org-mode version 6.32b; org-remember only indents first line of %i substitution
  2009-11-18 22:54 ` Carsten Dominik
@ 2009-11-19 21:22   ` Andrew J. Korty
  2009-11-19 22:24     ` Sebastian Rose
  2009-11-19 22:47     ` Sebastian Rose
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew J. Korty @ 2009-11-19 21:22 UTC (permalink / raw)
  To: Org Mode

I've learned some more details.  The behavior I describe only occurs when remember is called via org-protocol.  When that happens, `initial' is nil, so the following code in org-remember.el doesn't run:

  (save-match-data
    (let* ((lead (buffer-substring
                  (point-at-bol) (match-beginning 0))))
      (setq v-i (mapconcat 'identity
                           (org-split-string initial "\n")
                           (concat "\n" lead)))))

I'm not sure of the best way to fix it.

ajk

On Nov 18, 2009, at 17:54 , Carsten Dominik wrote:

> Hi Andrew, this works fine for me, I cannot reproduce
> the problem you are describing.
> 
> - Carsten
> 
> On Nov 12, 2009, at 4:27 PM, Andrew J. Korty wrote:
> 
>> When %i appears indented in an org-remember template, each line of the
>> text substituted is supposed to be indented.  In my case, only the  
>> first
>> line is being indented.
>> 
>> Emacs  : GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.0.0, NS apple- 
>> appkit-1038.11)
>> of 2009-11-10 on phrygian
>> Package: Org-mode version 6.32b
>> 
>> 
>> 
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> - Carsten
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Org-mode version 6.32b; org-remember only indents first line of %i substitution
  2009-11-19 21:22   ` Andrew J. Korty
@ 2009-11-19 22:24     ` Sebastian Rose
  2009-11-19 22:47     ` Sebastian Rose
  1 sibling, 0 replies; 7+ messages in thread
From: Sebastian Rose @ 2009-11-19 22:24 UTC (permalink / raw)
  To: Andrew J. Korty; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

"Andrew J. Korty" <ajk@iu.edu> writes:

> I've learned some more details.  The behavior I describe only occurs when remember is called via org-protocol.  When that happens, `initial' is nil, so the following code in org-remember.el doesn't run:
>
>   (save-match-data
>     (let* ((lead (buffer-substring
>                   (point-at-bol) (match-beginning 0))))
>       (setq v-i (mapconcat 'identity
>                            (org-split-string initial "\n")
>                            (concat "\n" lead)))))
>
> I'm not sure of the best way to fix it.
>
> ajk


Hi Andrew,


the best way to fix it will be to fix the function
`org-protocol-remember'. If the behaviour occurs solely when called
through org-protocol, this is the place to fix it.

I'll take a look in it....
Hm - initial _should_ be set...

It is here actually. My `?w' template depends on it:



(setq org-remember-templates
  '(
    ;; ... more templates here... ;;

    ;; Default org-protocol:
    ( ?w "* %^{Title}\n\n  Quelle: %u, %c\n\n  %i" nil "Notizen"))






Ahhh - OK, patch is here - please test:



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-protocol-fix-initial.patch --]
[-- Type: text/x-diff, Size: 550 bytes --]

diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 5c65fb0..0684f7a 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -471,7 +471,7 @@ Now template ?b will be used."
              (type (if (string-match "^\\([a-z]+\\):" url)
                        (match-string 1 url)))
              (title (cadr parts))
-             (region (caddr parts))
+             (region (or (caddr parts) ""))
              (orglink (org-make-link-string url title))
              remember-annotation-functions)
         (setq org-stored-links

[-- Attachment #3: Type: text/plain, Size: 29 bytes --]




Best wishes

   Sebastian

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Org-mode version 6.32b; org-remember only indents first line of %i substitution
  2009-11-19 21:22   ` Andrew J. Korty
  2009-11-19 22:24     ` Sebastian Rose
@ 2009-11-19 22:47     ` Sebastian Rose
  2009-11-20  5:48       ` Carsten Dominik
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Rose @ 2009-11-19 22:47 UTC (permalink / raw)
  To: Andrew J. Korty; +Cc: Org Mode, carsten.dominik

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

"Andrew J. Korty" <ajk@iu.edu> writes:
> I've learned some more details.  The behavior I describe only occurs when remember is called via org-protocol.  When that happens, `initial' is nil, so the following code in org-remember.el doesn't run:
>
>   (save-match-data
>     (let* ((lead (buffer-substring
>                   (point-at-bol) (match-beginning 0))))
>       (setq v-i (mapconcat 'identity
>                            (org-split-string initial "\n")
>                            (concat "\n" lead)))))
>
> I'm not sure of the best way to fix it.


As `initial' was not set, so might `title' in some cases. Hence this
patch is better.

Carsten: Not sure about the link - but looking at
`org-make-link-string', a string that consists of spaces only, might
create a link like this: 

  [[url][ ]]


Test:


(let ((orglink (org-make-link-string
                "http://www.google.de" " ")))
  (insert orglink))

Which is invisible in Org-files!!!


 
My patch works around that, too.




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-protocol-remember: take users mistakes in account --]
[-- Type: text/x-diff, Size: 823 bytes --]

diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 5c65fb0..0d40c2c 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -470,9 +470,10 @@ Now template ?b will be used."
              (url (org-protocol-sanitize-uri (car parts)))
              (type (if (string-match "^\\([a-z]+\\):" url)
                        (match-string 1 url)))
-             (title (cadr parts))
-             (region (caddr parts))
-             (orglink (org-make-link-string url title))
+             (title (or (cadr parts) ""))
+             (region (or (caddr parts) ""))
+             (orglink (org-make-link-string
+		       url (if (string-match "[^[:space:]]" title) title url)))
              remember-annotation-functions)
         (setq org-stored-links
               (cons (list url title) org-stored-links))

[-- Attachment #3: Type: text/plain, Size: 31 bytes --]






Best wishes


  Sebastian

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Org-mode version 6.32b; org-remember only indents first line of %i substitution
  2009-11-19 22:47     ` Sebastian Rose
@ 2009-11-20  5:48       ` Carsten Dominik
  2009-11-20 22:10         ` Sebastian Rose
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2009-11-20  5:48 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org Mode

Hi Sebastian - I am confused - which is the patch I should apply?

- Carsten


On Nov 19, 2009, at 11:47 PM, Sebastian Rose wrote:

> "Andrew J. Korty" <ajk@iu.edu> writes:
>> I've learned some more details.  The behavior I describe only  
>> occurs when remember is called via org-protocol.  When that  
>> happens, `initial' is nil, so the following code in org-remember.el  
>> doesn't run:
>>
>>  (save-match-data
>>    (let* ((lead (buffer-substring
>>                  (point-at-bol) (match-beginning 0))))
>>      (setq v-i (mapconcat 'identity
>>                           (org-split-string initial "\n")
>>                           (concat "\n" lead)))))
>>
>> I'm not sure of the best way to fix it.
>
>
> As `initial' was not set, so might `title' in some cases. Hence this
> patch is better.
>
> Carsten: Not sure about the link - but looking at
> `org-make-link-string', a string that consists of spaces only, might
> create a link like this:
>
>  [[url][ ]]
>
>
> Test:
>
>
> (let ((orglink (org-make-link-string
>                "http://www.google.de" " ")))
>  (insert orglink))
> Which is invisible in Org-files!!!

I have fixed this also, in a diffeerent way.

- Carsten

>
>
>
> My patch works around that, too.
>
>
>
> diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
> index 5c65fb0..0d40c2c 100644
> --- a/lisp/org-protocol.el
> +++ b/lisp/org-protocol.el
> @@ -470,9 +470,10 @@ Now template ?b will be used."
>              (url (org-protocol-sanitize-uri (car parts)))
>              (type (if (string-match "^\\([a-z]+\\):" url)
>                        (match-string 1 url)))
> -             (title (cadr parts))
> -             (region (caddr parts))
> -             (orglink (org-make-link-string url title))
> +             (title (or (cadr parts) ""))
> +             (region (or (caddr parts) ""))
> +             (orglink (org-make-link-string
> +		       url (if (string-match "[^[:space:]]" title) title url)))
>              remember-annotation-functions)
>         (setq org-stored-links
>               (cons (list url title) org-stored-links))
>
>
>
>
>
> Best wishes
>
>
>  Sebastian

- Carsten

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Org-mode version 6.32b; org-remember only indents first line of %i substitution
  2009-11-20  5:48       ` Carsten Dominik
@ 2009-11-20 22:10         ` Sebastian Rose
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Rose @ 2009-11-20 22:10 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Sebastian - I am confused - which is the patch I should apply?


Sorry Carsten. The I CCed you with - the second one. It takes into
account, that the title could be empty too.

It's in the mail you're replying to.


>>  [[url][ ]]
>>
>>
>> Test:
>>
>>
>> (let ((orglink (org-make-link-string
>>                "http://www.google.de" " ")))
>>  (insert orglink))
>> Which is invisible in Org-files!!!
>
> I have fixed this also, in a diffeerent way.
>
> - Carsten


Great.



This patch:


>> diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
>> index 5c65fb0..0d40c2c 100644
>> --- a/lisp/org-protocol.el
>> +++ b/lisp/org-protocol.el
>> @@ -470,9 +470,10 @@ Now template ?b will be used."
>>              (url (org-protocol-sanitize-uri (car parts)))
>>              (type (if (string-match "^\\([a-z]+\\):" url)
>>                        (match-string 1 url)))
>> -             (title (cadr parts))
>> -             (region (caddr parts))
>> -             (orglink (org-make-link-string url title))
>> +             (title (or (cadr parts) ""))
>> +             (region (or (caddr parts) ""))
>> +             (orglink (org-make-link-string
>> +		       url (if (string-match "[^[:space:]]" title) title url)))
>>              remember-annotation-functions)
>>         (setq org-stored-links
>>               (cons (list url title) org-stored-links))



Best

  Sebastian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-20 22:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 15:27 Org-mode version 6.32b; org-remember only indents first line of %i substitution Andrew J. Korty
2009-11-18 22:54 ` Carsten Dominik
2009-11-19 21:22   ` Andrew J. Korty
2009-11-19 22:24     ` Sebastian Rose
2009-11-19 22:47     ` Sebastian Rose
2009-11-20  5:48       ` Carsten Dominik
2009-11-20 22:10         ` Sebastian Rose

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).