From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id G6eyEuHmyV64VAAA0tVLHw (envelope-from ) for ; Sun, 24 May 2020 03:15:45 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2APkDeHmyV4RTwAAbx9fmQ (envelope-from ) for ; Sun, 24 May 2020 03:15:45 +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 80EDF9404D9 for ; Sun, 24 May 2020 03:15:44 +0000 (UTC) Received: from localhost ([::1]:60810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jch6z-000370-RF for larch@yhetil.org; Sat, 23 May 2020 23:15:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jch6d-00036i-8C for emacs-orgmode@gnu.org; Sat, 23 May 2020 23:15:19 -0400 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]:40810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jch6Z-0003sh-Bn for emacs-orgmode@gnu.org; Sat, 23 May 2020 23:15:18 -0400 Received: by mail-qv1-xf31.google.com with SMTP id l3so6634026qvo.7 for ; Sat, 23 May 2020 20:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=vFSrng4/FYoPRkBbzkWyfJqRzmjsENuUH/WEtE7v1OI=; b=XF2Umg7VRXDOTvJdg3pJwPDJ7B/jpS23e208mBikn47jVQXV4maZMCjz4YRH3wCi2r yFjWhVDMlEPLN8NyLGPZ0jR4Vr4b4dKxkqqK0dM8al+DvA7sP30xXRKfA/F4wELKLL70 BtLkoXK2sPqm3yE74le2yZ/QCw/DjiSVtNudK4i7ho785uraANcVPIefAPezeUjAc7/8 jlPtG3MQnm0Zlnl+qyHYuzNnnqd82SF5IZyiJqFTgMMljcZcnbFpkr+XzUvCRIHVmDtP B05Fmr6A4lkIZDOn6XLHdzlWKks0Y5Dt2miyYP3UvtIHL3/HJAXxO011dCpGIvulqYWu z35Q== 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:in-reply-to:references:date :message-id:mime-version; bh=vFSrng4/FYoPRkBbzkWyfJqRzmjsENuUH/WEtE7v1OI=; b=ZowtNskICZZPgzE3CtZYZQbguI3dfIumUBizZprPHO/ITqx2BqxM9adtr85phwJHBV lJATw6l1aMLCrZIdyrE1GNYd7H96Xow2S9l3R5VskQffRsVSk7AwXkzhOaJ08dj4sH5d XYhFo+c97PDErv3gC5jYZly+WSSx+77dviqx/Ri1koTvs9xpOE2yN7g0IVDI10ozWPub gs1itn7j6b2+3/Ye8DLRhrLwhgjK1b/GwBtjWPni9RVGub9FUrusVOoCjHtskzQ9mzCV Re8Zwyr5nFDhJDL7yERFIhTcmcnSqIY48OKFPkY2zF3D59jo/zA1OcH/Yh4W/gCLqB3+ sIZw== X-Gm-Message-State: AOAM533OWECeqTrC3SNhjK/ZkeFuaP8d3BsUieGBWlQ+0KJIpNWbYOtk bjY9EEpnnTiZJOOSGG4JYQg= X-Google-Smtp-Source: ABdhPJwFEnNaRyz/BBkio96NS9RnsGn+pE41LRxBc9u3kJAakwBWvd6eGeHIP3WqTB4E77H9HgUR9Q== X-Received: by 2002:a0c:ba99:: with SMTP id x25mr10469533qvf.119.1590290114462; Sat, 23 May 2020 20:15:14 -0700 (PDT) Received: from localhost ([5.226.137.4]) by smtp.gmail.com with ESMTPSA id 4sm10724431qky.130.2020.05.23.20.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 20:15:13 -0700 (PDT) From: Ihor Radchenko To: numbchild@gmail.com, John Kitchin Subject: Re: [QUESTION] What's the ":desk" link parameter? In-Reply-To: <871rna5hvp.fsf@gmail.com> References: <877dx27sc6.fsf@gmail.com> <871rna5hvp.fsf@gmail.com> Date: Sun, 24 May 2020 11:10:38 +0800 Message-ID: <87pnauvxht.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::f31; envelope-from=yantar92@gmail.com; helo=mail-qv1-xf31.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=XF2Umg7V; 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-Spam-Score: 1.29 X-TUID: m1D2ya7fDn8z --=-=-= Content-Type: text/plain > I remember I found this code on emacs.stackexchange.com website. > > I did a Google search now, I found someone indeed proposed this feature. Here is > the email archive: > > https://lists.gnu.org/archive/html/emacs-orgmode/2019-08/msg00013.html > > I saw this thread is stopped. Seems no patch provided. Does anyone want to implement it? See the attached. Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-link-description.patch diff --git a/lisp/ol.el b/lisp/ol.el index 0cb1b0a7e..32a80ee56 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -138,6 +138,13 @@ link. Function that inserts a link with completion. The function takes one optional prefix argument. +`:description' + + Function to use for generating link descriptions from links. This + function must take two parameters: the first one is the link, the + second one is the description generated by `org-insert-link'. The + function should return the description to use. + `:display' Value for `invisible' text property on the hidden parts of the @@ -193,16 +200,6 @@ You can interactively set the value of this variable by calling :type 'boolean :safe #'booleanp) -(defcustom org-link-make-description-function nil - "Function to use for generating link descriptions from links. -This function must take two parameters: the first one is the -link, the second one is the description generated by -`org-insert-link'. The function should return the description to -use." - :group 'org-link - :type '(choice (const nil) (function)) - :safe #'null) - (defcustom org-link-file-path-type 'adaptive "How the path name in file links should be stored. Valid values are: @@ -1742,10 +1739,8 @@ If the LINK-LOCATION parameter is non-nil, this value will be used as the link location instead of reading one interactively. If the DESCRIPTION parameter is non-nil, this value will be used as the -default description. Otherwise, if `org-link-make-description-function' -is non-nil, this function will be called with the link target, and the -result will be the default link description. When called non-interactively, -don't allow to edit the default description." +default description. When called non-interactively, don't allow to +edit the default description." (interactive "P") (let* ((wcf (current-window-configuration)) (origbuf (current-buffer)) @@ -1890,17 +1885,27 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq desc path))))) (unless auto-desc - (let ((initial-input - (cond - (description) - ((not org-link-make-description-function) desc) - (t (condition-case nil - (funcall org-link-make-description-function link desc) - (error - (message "Can't get link description from %S" - (symbol-name org-link-make-description-function)) - (sit-for 2) - nil)))))) + (let* ((type (and (string-match "\\([^:]+\\):" link) + (match-string-no-properties 1 link))) + (initial-input + (cond + (description) + ((org-link-get-parameter type :description) + (condition-case nil + (funcall (org-link-get-parameter type :description) link desc) + (error + (message "Can't get link description from %S" + (symbol-name (org-link-get-parameter type :description))) + (sit-for 2) + nil))) + ((not org-link-make-description-function) desc) + (t (condition-case nil + (funcall org-link-make-description-function link desc) + (error + (message "Can't get link description from %S" + (symbol-name org-link-make-description-function)) + (sit-for 2) + nil)))))) (setq desc (if (called-interactively-p 'any) (read-string "Description: " initial-input) initial-input)))) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 635a38dcd..c17d888fc 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -376,6 +376,21 @@ See `org-link-parameters' for documentation on the other parameters." (make-obsolete 'org-add-link-type "use `org-link-set-parameters' instead." "Org 9.0") +(defcustom org-link-make-description-function nil + "Function to use for generating link descriptions from links. +This function must take two parameters: the first one is the +link, the second one is the description generated by +`org-insert-link'. The function should return the description to +use." + :group 'org-link + :type '(choice (const nil) (function)) + :safe #'null) + +(make-obsolete-variable + 'org-link-make-description-function + "use `org-link-set-parameters' to set :description link parameter instead." + "Org 9.3.6") + ;;;; Functions unused in Org core. (defun org-table-recognize-table.el () "If there is a table.el table nearby, recognize it and move into it." @@ -516,8 +531,10 @@ use of this function is for the stuck project list." (define-obsolete-variable-alias 'org-email-link-description-format 'org-link-email-description-format "Org 9.3") -(define-obsolete-variable-alias 'org-make-link-description-function - 'org-link-make-description-function "Org 9.3") +(make-obsolete-variable + 'org-make-link-description-function + "use `org-link-set-parameters' to set :description link parameter instead." + "Org 9.3.6") (define-obsolete-variable-alias 'org-from-is-user-regexp 'org-link-from-user-regexp "Org 9.3") --=-=-= Content-Type: text/plain stardiviner writes: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > > John Kitchin writes: > >> Where did you find that code? I recall this was some kind of prototype >> code, and maybe it never got fully developed. I think desk was shorthand >> for description. > > I remember I found this code on emacs.stackexchange.com website. > > I did a Google search now, I found someone indeed proposed this feature. Here is > the email archive: > > https://lists.gnu.org/archive/html/emacs-orgmode/2019-08/msg00013.html > > I saw this thread is stopped. Seems no patch provided. Does anyone want to implement it? > >> >> On Sat, May 23, 2020 at 8:24 AM stardiviner wrote: >> >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA256 >>> >>> >>> I found some examples setting org-link-parameters with ":desk", like this: >>> >>> #+begin_src emacs-lisp >>> (defun org-id-link-desk (link desk) >>> "Description function for id: link." >>> (let ((id (cadr (split-string link ":")))) >>> (org-with-point-at (org-id-find id 'marker) >>> (s-join "/" (org-get-outline-path 'with-self))))) >>> >>> (org-link-set-parameters "id" :desk #'org-id-link-desk) >>> #+end_src >>> >>> But I have not found any mention in help of variable >>> ~org-link-parameters~. Also I >>> checked org mode source code by search, no matching of ":desk" found. Did >>> I miss >>> something? >>> >>> - -- >>> [ stardiviner ] >>> I try to make every word tell the meaning that I want to express. >>> >>> Blog: https://stardiviner.github.io/ >>> IRC(freenode): stardiviner, Matrix: stardiviner >>> GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 >>> >>> -----BEGIN PGP SIGNATURE----- >>> >>> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7JFckUHG51bWJjaGls >>> ZEBnbWFpbC5jb20ACgkQG13xyVromsONBggAy0z465LkTx1EYBo4GWZdObWXct8O >>> Fjz24HGzin/ffISIhytm0r4w5GE2Rb2/m+BwAsfHEDDvLu1mwU3HvLugXmIk0OUA >>> u9qRLHJ4Po1/Y1CRR0o/OHHnbTjhA/7ppljRcN0klwd6J0PDrSE3K/XOhV94xyfK >>> k0fUBhtQeTdW/uzx49hs14QlNQ5i6+HJWd1g/viXI+v0EIYJDV3PLwS6CFJWnvo3 >>> Yi210RM87uKi8vWFcFP7fEW2dYDV5MRsKmQ8v9AKLcCW9+T6Zq3tI7Srxn7ZwFsQ >>> mFxZdLFyDlQq0M4VG0WL/epwr0f4B2SUZ3BcOEYrwv7N+7sfMN2cCWI8jQ== >>> =8aOD >>> -----END PGP SIGNATURE----- >>> >>> -- >> John >> >> ----------------------------------- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu > > > - -- > [ stardiviner ] > I try to make every word tell the meaning that I want to express. > > Blog: https://stardiviner.github.io/ > IRC(freenode): stardiviner, Matrix: stardiviner > GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 > > -----BEGIN PGP SIGNATURE----- > > iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7JtzoUHG51bWJjaGls > ZEBnbWFpbC5jb20ACgkQG13xyVromsMC4wf+Nzj7X+SDnSaYoFYWvdx/r0PtSbyJ > u4fmiT5TlWYJvx6+S9HVxTSmvR7QEdxWFTLU0zkVFAmuhFIehIDoQpCzunwCGKfl > Onn+TLwqm8UaeDS1GXs0yhRLRAgsDqM+jdd7+IKccljRonM1RVYDjFjfdXvh9U9h > mDU78HGL/yGg6rzlIHlzh+s0bvkM0xgmivI7zWmk1BF8PQofXcVzdGn3aWFz3rNN > clEgmCtOX/t7gRzn8H8Ydq+vg+J15OliNjWBRZ1Op26msaOYe+nly8tGAbfwqDgB > SSC4vi42vUbvVNzpjYfR6byqQ4RDxI8th66NJ6yuk0hkCnTHe69h1gQuqw== > =Q210 > -----END PGP SIGNATURE----- > -- Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg --=-=-=--