emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problems with org-docview
@ 2009-12-03 15:13 Matt Lundin
  2009-12-03 15:44 ` Matthew Lundin
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Lundin @ 2009-12-03 15:13 UTC (permalink / raw)
  To: Org Mode

I notice that org-docview.el was added to the repo on November 28 or
thereabouts.

I'm experiencing a few problems with it.

When calling the agenda for the first time after starting up org-mode, I
get the following message:

,----
| Problems while trying to load feature `org-docview'
`----

In addition, org-docview stores links to pdf files as absolute paths,
regardless of the setting of org-link-file-path-type. E.g, with
org-link-file-path-type set to relative, the resulting link remains an
absolute path:

,----
| [[docview:/home/matt/general.pdf::4][/home/matt/general.pdf]]
`----

Thanks,
Matt

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

* Re: Problems with org-docview
  2009-12-03 15:13 Problems with org-docview Matt Lundin
@ 2009-12-03 15:44 ` Matthew Lundin
  2009-12-04 11:22   ` [PATCH] respect org-link-file-path-type when inserting docview: links Jan Böcker
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Lundin @ 2009-12-03 15:44 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Matt Lundin <mdl@imapmail.org> writes:

> I notice that org-docview.el was added to the repo on November 28 or
> thereabouts.
>
> I'm experiencing a few problems with it.
>
> When calling the agenda for the first time after starting up org-mode, I
> get the following message:
>
> ,----
> | Problems while trying to load feature `org-docview'
> `----
>
> In addition, org-docview stores links to pdf files as absolute paths,
> regardless of the setting of org-link-file-path-type. E.g, with
> org-link-file-path-type set to relative, the resulting link remains an
> absolute path:
>
> ,----
> | [[docview:/home/matt/general.pdf::4][/home/matt/general.pdf]]
> `----

A couple of clarifications:

1) The first issue above results from the fact that org-docview.el is
missing from the Makefile.

2) The second issue occurs after I load org-docview.el by hand.

- Matt

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

* [PATCH] respect org-link-file-path-type when inserting docview: links
  2009-12-03 15:44 ` Matthew Lundin
@ 2009-12-04 11:22   ` Jan Böcker
  2009-12-09 10:44     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Böcker @ 2009-12-04 11:22 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: Org Mode

This patch is also in the docview branch at:
http://github.com/jboecker/org-docview

The function org-insert-link checks if it is inserting a "file:" link.
If this is the case, the path is manipulated according to the current
buffer file name and the variable 'org-link-file-path-type'.

I changed the regex to also match "docview:" links, and added a variable
to store the link type which is later re-attached to the path.

I do not know if there is a more elegant way, but this works.

Matthew: docview.el was missing from the Makefile because of my
inexperience with Org development, but I see that Carsten has already
fixed that one :)

---
 lisp/ChangeLog |    5 +++++
 lisp/org.el    |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f385b7c..a716042 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-04  Jan Böcker  <jan.boecker@jboecker.de>
+
+	* org.el (org-insert-link): respect org-link-file-path-type for
+	docview: links in addition to file: links.
+
 2009-12-03  Carsten Dominik  <carsten.dominik@gmail.com>

 	* org-exp.el (org-export-format-source-code-or-example): Avoid
diff --git a/lisp/org.el b/lisp/org.el
index 664bafc..4f699c9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7976,8 +7976,9 @@ Use TAB to complete link prefixes, then RET for
type-specific completion support
 	      (setq link search)))))

     ;; Check if we can/should use a relative path.  If yes, simplify
the link
-    (when (string-match "^file:\\(.*\\)" link)
-      (let* ((path (match-string 1 link))
+    (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link)
+      (let* ((type (match-string 1 link))
+	     (path (match-string 2 link))
 	     (origpath path)
 	     (case-fold-search nil))
 	(cond
@@ -7998,7 +7999,7 @@ Use TAB to complete link prefixes, then RET for
type-specific completion support
 		(setq path (substring (expand-file-name path)
 				      (match-end 0)))
 	      (setq path (abbreviate-file-name (expand-file-name path)))))))
-	(setq link (concat "file:" path))
+	(setq link (concat type path))
 	(if (equal desc origpath)
 	    (setq desc path))))

-- 
1.6.5.2

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

* Re: [PATCH] respect org-link-file-path-type when inserting docview: links
  2009-12-04 11:22   ` [PATCH] respect org-link-file-path-type when inserting docview: links Jan Böcker
@ 2009-12-09 10:44     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-12-09 10:44 UTC (permalink / raw)
  To: Jan Böcker; +Cc: Matthew Lundin, Org Mode

Hi Jan,

thanks for the fix, I have applied it.

- Carsten

On Dec 4, 2009, at 12:22 PM, Jan Böcker wrote:

> This patch is also in the docview branch at:
> http://github.com/jboecker/org-docview
>
> The function org-insert-link checks if it is inserting a "file:" link.
> If this is the case, the path is manipulated according to the current
> buffer file name and the variable 'org-link-file-path-type'.
>
> I changed the regex to also match "docview:" links, and added a  
> variable
> to store the link type which is later re-attached to the path.
>
> I do not know if there is a more elegant way, but this works.
>
> Matthew: docview.el was missing from the Makefile because of my
> inexperience with Org development, but I see that Carsten has already
> fixed that one :)
>
> ---
> lisp/ChangeLog |    5 +++++
> lisp/org.el    |    7 ++++---
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index f385b7c..a716042 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -1,3 +1,8 @@
> +2009-12-04  Jan Böcker  <jan.boecker@jboecker.de>
> +
> +	* org.el (org-insert-link): respect org-link-file-path-type for
> +	docview: links in addition to file: links.
> +
> 2009-12-03  Carsten Dominik  <carsten.dominik@gmail.com>
>
> 	* org-exp.el (org-export-format-source-code-or-example): Avoid
> diff --git a/lisp/org.el b/lisp/org.el
> index 664bafc..4f699c9 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -7976,8 +7976,9 @@ Use TAB to complete link prefixes, then RET for
> type-specific completion support
> 	      (setq link search)))))
>
>     ;; Check if we can/should use a relative path.  If yes, simplify
> the link
> -    (when (string-match "^file:\\(.*\\)" link)
> -      (let* ((path (match-string 1 link))
> +    (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link)
> +      (let* ((type (match-string 1 link))
> +	     (path (match-string 2 link))
> 	     (origpath path)
> 	     (case-fold-search nil))
> 	(cond
> @@ -7998,7 +7999,7 @@ Use TAB to complete link prefixes, then RET for
> type-specific completion support
> 		(setq path (substring (expand-file-name path)
> 				      (match-end 0)))
> 	      (setq path (abbreviate-file-name (expand-file-name path)))))))
> -	(setq link (concat "file:" path))
> +	(setq link (concat type path))
> 	(if (equal desc origpath)
> 	    (setq desc path))))
>
> -- 
> 1.6.5.2
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 4+ messages in thread

end of thread, other threads:[~2009-12-09 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-03 15:13 Problems with org-docview Matt Lundin
2009-12-03 15:44 ` Matthew Lundin
2009-12-04 11:22   ` [PATCH] respect org-link-file-path-type when inserting docview: links Jan Böcker
2009-12-09 10:44     ` Carsten Dominik

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