From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sGJuJLE8LWCRWgAA0tVLHw (envelope-from ) for ; Wed, 17 Feb 2021 15:56:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 0LNHILE8LWCnfgAA1q6Kng (envelope-from ) for ; Wed, 17 Feb 2021 15:56:33 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E008814A12 for ; Wed, 17 Feb 2021 16:56:32 +0100 (CET) Received: from localhost ([::1]:46186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCPBo-0005kj-46 for larch@yhetil.org; Wed, 17 Feb 2021 10:56:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCPB6-0005kN-8g for emacs-orgmode@gnu.org; Wed, 17 Feb 2021 10:55:48 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:32826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCPB3-0004Fm-Q2 for emacs-orgmode@gnu.org; Wed, 17 Feb 2021 10:55:47 -0500 Received: by mail-ot1-x32c.google.com with SMTP id c16so12452124otp.0 for ; Wed, 17 Feb 2021 07:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HxJWnUHR6GUAJTnUyGXl/DMWzupUk3GJ6P8j2lAZ0qc=; b=rcTuI2u92M/PHHbt73FMaLbidYn+MdXzCePyZfwxMS0y+61h/c65vZaIdRffI5im8l wB+KdMz8Acd+GO5CbwuYlo86RWjWYRMP6jB3NitIjVqG/NxmGP6KYlXIRNACBRUt/7Fz jBbmB7fCqR1+UOS9uj/ueUM+s8WpUYAc05o4n2xvMroVw4n7e0A6V8OJru108UhPP99D LOYdL5edc7HdxQMIoXElPdxbflVoW1Y1e7b5+AsR3PPYzJrMtFO5iDR6fX+q+N3yRuda UrcY6fWLwYlDtQ/kF5JLs82ScTh28ePtrK/L4iLbflSQHaEcjR+SqcBH9H0Vrz4BKniQ xd/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HxJWnUHR6GUAJTnUyGXl/DMWzupUk3GJ6P8j2lAZ0qc=; b=TsG4UMirRuRUwKxrHuII0V8ACK5sZuAWV7qdnHzbzBM4Zr8VKz3bnlOZHGNjwJYj6E vKnenSV1CPFcX50mf7gY21+gokUm2WtACD7/h/m7mzobtsfe6FBrIExT40Kmfkablc8o Mc496br0TvSTw114i0BMRCHjQQVETJ4aifNl0UEmEULsyb+IarTtil/PtQXOlDBzwXJP 3+IkEM+cVi0MGtEO9oyyCBMLiTA3DPrRvvJetzcfsewaxcBFNH2Yhc3qDeiC82p8ePRx 083yHF4G7GuVHGo84slVer/b0c2Zedk/6D3TnJxRVUhhNlqRihs+VVKXkCvGJHnK/i1p ffSQ== X-Gm-Message-State: AOAM5311XZ0LiAEJqF4TzJwrXZ2ZsX+t2u2SUGsjXy8NncVlPAtlMX+D jYkRmoxQy225heBAJcAVotVH0YRimNHj7Q== X-Google-Smtp-Source: ABdhPJzZy3P3LHGNi8BFY2iRvaCyVJAxXeEIF0BmVqIgI4v/4te4BA8ryfhMLULRLOD/UFdOW1gTjA== X-Received: by 2002:a05:6830:56e:: with SMTP id f14mr17877067otc.85.1613577343799; Wed, 17 Feb 2021 07:55:43 -0800 (PST) Received: from localhost.localdomain ([174.128.243.53]) by smtp.gmail.com with ESMTPSA id h21sm83581otm.45.2021.02.17.07.55.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Feb 2021 07:55:43 -0800 (PST) From: Aaron Jensen To: emacs-orgmode@gnu.org Subject: [PATCH] org-mac-link: Disable Evernote capture by default Date: Wed, 17 Feb 2021 09:53:32 -0600 Message-Id: <20210217155332.18162-1-aaronjensen@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=aaronjensen@gmail.com; helo=mail-ot1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aaron Jensen Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.94 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=rcTuI2u9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: E008814A12 X-Spam-Score: 1.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: ODlP4kfd9Ant The two `shell-command-to-string` invocations during eval are extremely slow. Users of Evernote should `org-mac-grab-Evernote-app-p` and `org-mac-evernote-path` explicitly. * contrib/lisp/org-mac-link.el (org-mac-grab-Evernote-app-p): Default to nil (org-mac-evernote-path): Default to nil and add a function of the same name that will either use the variable or a shell invocation to mdfind (org-mac-evernote-note-open): Use the function version of org-mac-evernote-path (org-as-get-selected-evernote-notes): Use the function version of org-mac-evernote-path --- contrib/lisp/org-mac-link.el | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el index e56354c4f..ec004d8b9 100644 --- a/contrib/lisp/org-mac-link.el +++ b/contrib/lisp/org-mac-link.el @@ -207,18 +207,13 @@ :group 'org-mac-flagged-mail :type 'string) -(defcustom org-mac-grab-Evernote-app-p - (< 0 (length (shell-command-to-string - "mdfind kMDItemCFBundleIdentifier == 'com.evernote.Evernote'"))) +(defcustom org-mac-grab-Evernote-app-p nil "Add menu option [e]vernote to grab note links from Evernote.app." :tag "Grab Evernote.app note links" :group 'org-mac-link :type 'boolean) -(defcustom org-mac-evernote-path (replace-regexp-in-string (rx (* (any " \t\n")) eos) - "" - (shell-command-to-string - "mdfind kMDItemCFBundleIdentifier == 'com.evernote.Evernote'")) +(defcustom org-mac-evernote-path nil "The path to the installed copy of Evernote.app. Do not escape spaces as the AppleScript call will quote this string." :tag "Path to Evernote" :group 'org-mac-link @@ -809,11 +804,21 @@ after heading." (org-link-set-parameters "mac-evernote" :follow #'org-mac-evernote-note-open) +(defun org-mac-evernote-path () + "Get path to evernote. +First consider the value of ORG-MAC-EVERNOTE-PATH, then attempt to find it. +Finding the path can be slow." + (or org-mac-evernote-path + (replace-regexp-in-string (rx (* (any " \t\n")) eos) + "" + (shell-command-to-string + "mdfind kMDItemCFBundleIdentifier == 'com.evernote.Evernote'")))) + (defun org-mac-evernote-note-open (noteid _) "Open a note in Evernote" (do-applescript (concat - "tell application \"" org-mac-evernote-path "\"\n" + "tell application \"" (org-mac-evernote-path) "\"\n" " set theNotes to get every note of every notebook where its local id is \"" (substring-no-properties noteid) "\"\n" " repeat with _note in theNotes\n" " if length of _note is not 0 then\n" @@ -828,7 +833,7 @@ after heading." "AppleScript to create links to selected notes in Evernote.app." (do-applescript (concat - "tell application \"" org-mac-evernote-path "\"\n" + "tell application \"" (org-mac-evernote-path) "\"\n" " set noteCount to count selection\n" " if (noteCount < 1) then\n" " return\n" -- 2.28.0