emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* PATCH: org-open-at-point curation
@ 2011-01-30 16:13 Dan Davison
  2011-02-12 22:59 ` [Accepted] " Bastien Guerry
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Davison @ 2011-01-30 16:13 UTC (permalink / raw)
  To: emacs org-mode mailing list

While fiddling with the way babel uses org-open-at-point, I noticed a
coupe of things:

1. There's a bug when using the prefix arg with a text search
   link. E.g. try C-u C-c C-o on [[foo]]
2. The prefix arg is used in three different ways (two of them
   undocumented), not all of which correspond to the variable name used
   for the prefix arg. I'm leaving the extra uses undocumented, but have renamed the
   prefix arg with a more generic name.

Dan

~~~~~~~~~~~~~

    Some curation of `org-open-at-point'
    
    * lisp/org.el (org-open-at-point): Fix bug when using prefix arg to
    construct `org-link-search' call. Rename prefix arg with a more
    generic name, to reflect its diverse uses in this function.


#+begin_src diff
diff --git a/lisp/org.el b/lisp/org.el
index a49d3e2..186af9d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9084,12 +9084,12 @@ Functions in this hook must return t if they identify and follow
 a link at point.  If they don't find anything interesting at point,
 they must return nil.")
 
-(defun org-open-at-point (&optional in-emacs reference-buffer)
+(defun org-open-at-point (&optional arg reference-buffer)
   "Open link at or after point.
 If there is no link at point, this function will search forward up to
 the end of the current line.
 Normally, files will be opened by an appropriate application.  If the
-optional argument IN-EMACS is non-nil, Emacs will visit the file.
+optional prefix argument ARG is non-nil, Emacs will visit the file.
 With a double prefix argument, try to open outside of Emacs, in the
 application the system uses for this file type."
   (interactive "P")
@@ -9107,7 +9107,7 @@ application the system uses for this file type."
 		       org-angle-link-re "\\|"
 		       "[ \t]:[^ \t\n]+:[ \t]*$")))
 	 (not (get-text-property (point) 'org-linked-text)))
-    (or (org-offer-links-in-entry in-emacs)
+    (or (org-offer-links-in-entry arg)
 	(progn (require 'org-attach) (org-attach-reveal 'if-exists))))
    ((run-hook-with-args-until-success 'org-open-at-point-functions))
    ((org-at-timestamp-p t) (org-follow-timestamp-link))
@@ -9212,7 +9212,7 @@ application the system uses for this file type."
 	  (browse-url (concat type ":" path)))
 
 	 ((string= type "tags")
-	  (org-tags-view in-emacs path))
+	  (org-tags-view arg path))
 
 	 ((string= type "tree-match")
 	  (org-occur (concat "\\[" (regexp-quote path) "\\]")))
@@ -9226,7 +9226,7 @@ application the system uses for this file type."
 		      path (substring path 0 (match-beginning 0)))))
 	  (if (string-match "[*?{]" (file-name-nondirectory path))
 	      (dired path)
-	    (org-open-file path in-emacs line search)))
+	    (org-open-file path arg line search)))
 
 	 ((string= type "shell")
 	  (let ((cmd path))
@@ -9258,14 +9258,14 @@ application the system uses for this file type."
 		'org-open-link-functions path)))
 
 	 ((string= type "thisfile")
-	  (if in-emacs
+	  (if arg
 	      (switch-to-buffer-other-window
 	       (org-get-buffer-for-internal-link (current-buffer)))
 	    (org-mark-ring-push))
 	  (let ((cmd `(org-link-search
 		       ,path
-		       ,(cond ((equal in-emacs '(4)) 'occur)
-			      ((equal in-emacs '(16)) 'org-occur)
+		       ,(cond ((equal arg '(4)) ''occur)
+			      ((equal arg '(16)) ''org-occur)
 			      (t nil))
 		       ,pos)))
 	    (condition-case nil (eval cmd)
#+end_src

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

* [Accepted] PATCH: org-open-at-point curation
  2011-01-30 16:13 PATCH: org-open-at-point curation Dan Davison
@ 2011-02-12 22:59 ` Bastien Guerry
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien Guerry @ 2011-02-12 22:59 UTC (permalink / raw)
  To: emacs-orgmode

Patch 564 (http://patchwork.newartisans.com/patch/564/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3Cm1lj22z7wo.fsf%40gmail.com%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] PATCH: org-open-at-point curation
> Date: Sun, 30 Jan 2011 21:13:43 -0000
> From: Dan Davison <dandavison7@gmail.com>
> X-Patchwork-Id: 564
> Message-Id: <m1lj22z7wo.fsf@gmail.com>
> To: emacs org-mode mailing list  <emacs-orgmode@gnu.org>
> 
> While fiddling with the way babel uses org-open-at-point, I noticed a
> coupe of things:
> 
> 1. There's a bug when using the prefix arg with a text search
>    link. E.g. try C-u C-c C-o on [[foo]]
> 2. The prefix arg is used in three different ways (two of them
>    undocumented), not all of which correspond to the variable name used
>    for the prefix arg. I'm leaving the extra uses undocumented, but have renamed the
>    prefix arg with a more generic name.
> 
> Dan
> 
> ~~~~~~~~~~~~~
> 
>     Some curation of `org-open-at-point'
>     
>     * lisp/org.el (org-open-at-point): Fix bug when using prefix arg to
>     construct `org-link-search' call. Rename prefix arg with a more
>     generic name, to reflect its diverse uses in this function.
> 
> 
> #+begin_src diff
> #+end_src
> 
> 
> diff --git a/lisp/org.el b/lisp/org.el
> index a49d3e2..186af9d 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -9084,12 +9084,12 @@ Functions in this hook must return t if they identify and follow
>  a link at point.  If they don't find anything interesting at point,
>  they must return nil.")
>  
> -(defun org-open-at-point (&optional in-emacs reference-buffer)
> +(defun org-open-at-point (&optional arg reference-buffer)
>    "Open link at or after point.
>  If there is no link at point, this function will search forward up to
>  the end of the current line.
>  Normally, files will be opened by an appropriate application.  If the
> -optional argument IN-EMACS is non-nil, Emacs will visit the file.
> +optional prefix argument ARG is non-nil, Emacs will visit the file.
>  With a double prefix argument, try to open outside of Emacs, in the
>  application the system uses for this file type."
>    (interactive "P")
> @@ -9107,7 +9107,7 @@ application the system uses for this file type."
>  		       org-angle-link-re "\\|"
>  		       "[ \t]:[^ \t\n]+:[ \t]*$")))
>  	 (not (get-text-property (point) 'org-linked-text)))
> -    (or (org-offer-links-in-entry in-emacs)
> +    (or (org-offer-links-in-entry arg)
>  	(progn (require 'org-attach) (org-attach-reveal 'if-exists))))
>     ((run-hook-with-args-until-success 'org-open-at-point-functions))
>     ((org-at-timestamp-p t) (org-follow-timestamp-link))
> @@ -9212,7 +9212,7 @@ application the system uses for this file type."
>  	  (browse-url (concat type ":" path)))
>  
>  	 ((string= type "tags")
> -	  (org-tags-view in-emacs path))
> +	  (org-tags-view arg path))
>  
>  	 ((string= type "tree-match")
>  	  (org-occur (concat "\\[" (regexp-quote path) "\\]")))
> @@ -9226,7 +9226,7 @@ application the system uses for this file type."
>  		      path (substring path 0 (match-beginning 0)))))
>  	  (if (string-match "[*?{]" (file-name-nondirectory path))
>  	      (dired path)
> -	    (org-open-file path in-emacs line search)))
> +	    (org-open-file path arg line search)))
>  
>  	 ((string= type "shell")
>  	  (let ((cmd path))
> @@ -9258,14 +9258,14 @@ application the system uses for this file type."
>  		'org-open-link-functions path)))
>  
>  	 ((string= type "thisfile")
> -	  (if in-emacs
> +	  (if arg
>  	      (switch-to-buffer-other-window
>  	       (org-get-buffer-for-internal-link (current-buffer)))
>  	    (org-mark-ring-push))
>  	  (let ((cmd `(org-link-search
>  		       ,path
> -		       ,(cond ((equal in-emacs '(4)) 'occur)
> -			      ((equal in-emacs '(16)) 'org-occur)
> +		       ,(cond ((equal arg '(4)) ''occur)
> +			      ((equal arg '(16)) ''org-occur)
>  			      (t nil))
>  		       ,pos)))
>  	    (condition-case nil (eval cmd)
> 

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

end of thread, other threads:[~2011-02-12 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-30 16:13 PATCH: org-open-at-point curation Dan Davison
2011-02-12 22:59 ` [Accepted] " Bastien Guerry

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