From mboxrd@z Thu Jan 1 00:00:00 1970 From: Todd Neal Subject: elisp: links Date: Sun, 21 May 2006 21:50:59 -0400 Message-ID: <87psi64ykc.fsf@tolchz.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FhzYe-0001ia-0i for emacs-orgmode@gnu.org; Sun, 21 May 2006 21:50:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FhzYb-0001iO-Hk for emacs-orgmode@gnu.org; Sun, 21 May 2006 21:50:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FhzYb-0001iL-CJ for emacs-orgmode@gnu.org; Sun, 21 May 2006 21:50:05 -0400 Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FhzcT-0005Qp-Ua for emacs-orgmode@gnu.org; Sun, 21 May 2006 21:54:06 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FhzYQ-0006Pl-MZ for emacs-orgmode@gnu.org; Mon, 22 May 2006 03:49:54 +0200 Received: from c-68-53-20-25.hsd1.ky.comcast.net ([68.53.20.25]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 22 May 2006 03:49:54 +0200 Received: from tolchz by c-68-53-20-25.hsd1.ky.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 22 May 2006 03:49:54 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= I checked the message archive and couldn't find anything regarding links that eval elisp so I wrote up a quick patch. Was there a reason that they weren't included before (unsafe, not needed, etc.)? Todd --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=org-elisp.patch Content-Description: Patch to support elisp: links --- ../org.el 2006-05-21 21:40:41.873116136 -0400 +++ org.el 2006-05-21 21:45:26.301876392 -0400 @@ -987,6 +987,26 @@ (const :tag "with y-or-n (faster)" y-or-n-p) (const :tag "no confirmation (dangerous)" nil))) + + +(defcustom org-confirm-elisp-links 'yes-or-no-p + "Non-nil means, ask for confirmation before executing elisp links. + Elisp links can be dangerous, just thing about a link + + [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] + +This link would show up in your Org-mode document as \"Google Search\" +but really it would remove your entire home directory. Dangerous indeed. +Therefore I *definitely* advise agains setting this varaiable to nil. +Just change it to `y-or-n-p' of you want to confirm with a single key press +rather than having to type \"yes\"." + :group 'org-link-follow + :type '(choice + (const :tag "with yes-or-no (safer)" yes-or-no-p) + (const :tag "with y-or-n (faster)" y-or-n-p) + (const :tag "no confirmation (dangerous)" nil))) + + (defconst org-file-apps-defaults-gnu '((t . mailcap)) "Default file applications on a UNIX or GNU/Linux system. @@ -2666,7 +2686,7 @@ (defconst org-non-link-chars "]\t\n\r<>") (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm" - "wl" "mhe" "rmail" "gnus" "shell")) + "wl" "mhe" "rmail" "gnus" "shell" "elisp")) (defconst org-link-re-with-space (concat " %s" cmd (eval (read cmd))) + (error "Abort")))) + (t (browse-url-at-point)))))) @@ -8022,6 +8052,7 @@ (delete-window (get-buffer-window "*BBDB*")) (error "No matching BBDB record"))))) + (defun org-follow-gnus-link (&optional group article) "Follow a Gnus link to GROUP and ARTICLE." (require 'gnus) @@ -12569,7 +12600,7 @@ (not descp)))) (concat "") (concat "" desc ""))))) - ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell")) + ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "elisp")) (setq rpl (concat "<" type ":" (save-match-data (org-link-unescape path)) ">")))) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--