From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Branham Subject: Re: [PATCH] protocol: allow users to disable warning about old style links Date: Fri, 16 Jun 2017 13:31:31 +0200 Message-ID: <878tksb23w.fsf@utexas.edu> References: <8737b2bwg9.fsf@utexas.edu> <8737b0h33u.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLpTZ-0008Aw-NN for emacs-orgmode@gnu.org; Fri, 16 Jun 2017 07:31:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLpTV-0005VO-LZ for emacs-orgmode@gnu.org; Fri, 16 Jun 2017 07:31:41 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:34391) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLpTV-0005SZ-82 for emacs-orgmode@gnu.org; Fri, 16 Jun 2017 07:31:37 -0400 Received: by mail-lf0-x22a.google.com with SMTP id v20so23817135lfa.1 for ; Fri, 16 Jun 2017 04:31:35 -0700 (PDT) In-reply-to: <8737b0h33u.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, thanks for the reply. On Fri 16 Jun 2017 at 06:13, Nicolas Goaziou wrote: > Hello, > > Alex Branham writes: > >> This patch allows org mode users to disable the warning issued about >>old org protocol style links. This is important because sometimes (e.g. >>browser extensions), we don’t have easy control over the format >>specified. > > Thank you. > > Wouldn't it be better to report it upstream as a bug? I don't think > there are many Org protocols applications out there and the conversion > to the new syntax is easy. I did report it upstream as a bug. The maintainer is (understandably, I think) hesitant to change since 1) old style links continue to be supported and 2) there’s no way for a browser extension to detect the version of org-mode to install. Since new style links aren’t supported in older org versions (like what comes shipped with Emacs), that could create issues. > >> Issuing the warning is annoying because it pops up in a new window. > > I think this variable should go in "org-compat.el", so that we can > remove it when we drop old syntax. It also need > proper :version, :package-version and :safe keywords. > > Another option is to make it a simple `defvar' and have the warning > message suggesting to set it. I changed it to a defvar and modified the warning. That seems simpler to me. I wasn’t sure if defvars should go into org-compat.el (that file says it’s for compatibility issues with older Emacs versions?) or stay where it is. I’ve left it where it is for now but I can move it to org-compat.el if you want me to. New patch attached and pasted below. > > WDYT? > >> From 8bfc951308324de8e455128950193c046691f1f8 Mon Sep 17 00:00:00 2001 >> From: Alex Branham >> Date: Wed, 14 Jun 2017 14:06:18 +0200 >> Subject: [PATCH] protocol: allow user to disable warning about old style links >> >> --- >> lisp/org-protocol.el | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el >> index 825435674..2eb1094e9 100644 >> --- a/lisp/org-protocol.el >> +++ b/lisp/org-protocol.el >> @@ -271,6 +271,12 @@ This should be a single regexp string." >> :package-version '(Org . "8.0") >> :type 'string) >> >> +(defcustom org-protocol-warn-about-old-links t >> + "If non-nil (the default), issue a warning when org protocol >> +receives old style links." > > When non-nil, warn when Org protocol receives old style link. > > > Regards, >From 5d04e3a9404b2109751da6e43fba24a7cace00a8 Mon Sep 17 00:00:00 2001 From: Alex Branham Date: Fri, 16 Jun 2017 13:24:44 +0200 Subject: [PATCH] org-protocol: add option to surpress warning about old links --- lisp/org-protocol.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 825435674..531345b58 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -271,6 +271,10 @@ This should be a single regexp string." :package-version '(Org . "8.0") :type 'string) +(defvar org-protocol-warn-about-old-links t + "If non-nil (the default), issue a warning when org protocol +receives old style links.") + ;;; Helper functions: (defun org-protocol-sanitize-uri (uri) @@ -618,8 +622,9 @@ CLIENT is ignored." (if new-style (funcall func (org-protocol-parse-parameters result new-style)) - (warn "Please update your Org Protocol handler \ -to deal with new-style links.") + (when org-protocol-warn-about-old-links + (warn "Please update your Org Protocol handler \ +to deal with new-style links.\n You may set `org-protocol-warn-about-old-links' to nil to surpress this message.")) (funcall func result)))) ;; Greedy protocol handlers are responsible for ;; parsing their own filenames. -- 2.13.1 -- J. Alexander Branham PhD Candidate Department of Government University of Texas at Austin https://www.jabranham.com --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-org-protocol-add-option-to-surpress-warning-about-ol.patch >From 5d04e3a9404b2109751da6e43fba24a7cace00a8 Mon Sep 17 00:00:00 2001 From: Alex Branham Date: Fri, 16 Jun 2017 13:24:44 +0200 Subject: [PATCH] org-protocol: add option to surpress warning about old links --- lisp/org-protocol.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 825435674..531345b58 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -271,6 +271,10 @@ This should be a single regexp string." :package-version '(Org . "8.0") :type 'string) +(defvar org-protocol-warn-about-old-links t + "If non-nil (the default), issue a warning when org protocol +receives old style links.") + ;;; Helper functions: (defun org-protocol-sanitize-uri (uri) @@ -618,8 +622,9 @@ CLIENT is ignored." (if new-style (funcall func (org-protocol-parse-parameters result new-style)) - (warn "Please update your Org Protocol handler \ -to deal with new-style links.") + (when org-protocol-warn-about-old-links + (warn "Please update your Org Protocol handler \ +to deal with new-style links.\n You may set `org-protocol-warn-about-old-links' to nil to surpress this message.")) (funcall func result)))) ;; Greedy protocol handlers are responsible for ;; parsing their own filenames. -- 2.13.1 --=-=-=--