From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EFfBHXYVYGJzQQEAbAwnHQ (envelope-from ) for ; Wed, 20 Apr 2022 16:15:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eB2yHHYVYGKWoAAAG6o9tA (envelope-from ) for ; Wed, 20 Apr 2022 16:15:18 +0200 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 2051E10B50 for ; Wed, 20 Apr 2022 16:15:18 +0200 (CEST) Received: from localhost ([::1]:43694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhB6y-0000CO-Vv for larch@yhetil.org; Wed, 20 Apr 2022 10:15:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhAMk-0005zm-0M for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:27:30 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:36373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhAMi-0004VN-Im for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:27:29 -0400 Received: by mail-pf1-x42f.google.com with SMTP id z16so1936065pfh.3 for ; Wed, 20 Apr 2022 06:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:message-id:date:mime-version; bh=YAaFvpfaQsc1+Pn5mewLjVirKSmNME7RA5JQVankKrY=; b=YA6fEOOd1sW2/C60quFMj8fMKtkaf9azjMHFxnI4ZnCH/W5P2NXQohXDMJXCJB0Im/ 8sxeeUAaCNYY1IFshTyY+Pq2BjUOWyCP3+nNMhnQgx0TU/ahVGAoZ72PHBF4nRf3IxqB qsaGdikEcXYlP0uCnmqsBtZSmv5FnSZWYToZRkwcTLxlUgn4fePMCzEBmzidco3dBtzJ dIfLvlEbZ+bP0eNd8gQRIDBWHoSM0NnD14pRJQGiye/qS61KwN+sbJup+2y5Za1oxWCc ALnj1Mn9qFo/1cr+1FG8FRmsGOyKEdN5pDzCDiziY89x54i2oTp6ehhdtzM4xa5YYuqm aoTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references :message-id:date:mime-version; bh=YAaFvpfaQsc1+Pn5mewLjVirKSmNME7RA5JQVankKrY=; b=Bp6b5I3AEaCX5/9eNlsbEhwAPQdHQE/67IHqufL/i/SJkaYEmu267EUC9SSNTrGEZi dJ5EvGkkBlyqf5WUPrUCiNKqr9dvR5TJAEcL2x+crIj5By9FM48L+As2jhgOJJ3GnrPz 1Z4ULeMkiL5ZEe1ffpTtlYmSoExZ6XE6agHD6XVN2MlEA1X2klgs1w2KNdbrd/w1Uy2w fk+RwA6h2yn5Mr/Fa5YkhE6QWwecG4EP8bg9fbKNZ/1FiSEwpPYEMXkVmYPDP0huLa/h kO7EGwD8/bNc+ktW6Rv3ATNlt9ZpPl00iG4HE5X4945CnOsJw3ZOMbg/fRDHaLo7rrai M64Q== X-Gm-Message-State: AOAM533CPHexwFZeXoBeXrqgc7nIBGjX6H9PRpQko6OcbwZTlglD9+pm GRrchtdeyb8QxtFcJOOc9QfXHBII0rbRJg== X-Google-Smtp-Source: ABdhPJxByqmNAAA9eEHtflP+0s1WZlb9b75xhZ1jaW/5jY/NYx6rnKdJenLfiinC4vX2BDJk3VXgpQ== X-Received: by 2002:a05:6a00:cd2:b0:50a:7685:8055 with SMTP id b18-20020a056a000cd200b0050a76858055mr15903540pfv.37.1650461246556; Wed, 20 Apr 2022 06:27:26 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id p64-20020a622943000000b004fdd5c07d0bsm20198746pfp.63.2022.04.20.06.27.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 06:27:26 -0700 (PDT) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [PATCH v2 34/38] org-link-make-string: Throw error when both LINK and DESCRIPTION are empty In-Reply-To: References: Message-Id: Date: Wed, 20 Apr 2022 21:28:18 +0800 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650464118; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YAaFvpfaQsc1+Pn5mewLjVirKSmNME7RA5JQVankKrY=; b=D9oKl+HjSPcIws0xdOm+XK3g/TvHbT72Z+8m/8yOHLq7DqBrS8AhnHhiFJu/6dLkuGb5Lu vHHMYp6OtoVCu5KYnP6F2bxm6U2BZyfeyys2WWjF5lqD/rlRPAUmfW75qDCRVR+TnqnWP1 ANEV0zcgxExhDM4Pq6btQD5IDtPbAeBfOgGop78ssKIm8uCjnbGixLdWdL4AP4dibjufRf AAHPUC4nE3vxt/d3IH4Y1zOHVtZD5MmXH79zUC7Lsd8s/zGs8TpmhLJyO5ZQQ+bIbWUu1g Q25jxu4W9O9CM80HDccMI7fbknCrDXq1ecSTPGxw720LNeCez7K6E7lM6OlO0Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650464118; a=rsa-sha256; cv=none; b=gitE9Elrm9JAWA10k7Zjs6AgRYmYd+S6SGStU2CAz2DQ4zWBLfPz/luz8JAH7/8PUN8D1l cOJxkoJbPDPp6zqyncQOCKW0No7a9huPxLkqh+7ZCDsdIVKTH0F8N/K+LzAow8I2PrKYuz EyVcYteaV7Mewh4AEyiZdypSj3oI5PQ7Z0TX/u9PqaqT/lDCv2CvtmGGU28GJA2EUBg37B 83IrduXntMkyRk4E0G5RN3NVZx75ZyIIyY9+UoPuGvzoH2mijT42aAj5+Bo4bOOVa2/pC2 lW1f1z1uZnz2A1O0iEGTZlenEksoN+m5mvwoX/c1DRZrLfJEjjkeK+ah6LemCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YA6fEOOd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.04 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YA6fEOOd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 2051E10B50 X-Spam-Score: -3.04 X-Migadu-Scanner: scn1.migadu.com X-TUID: fNvc9LEXr1jV This behaviour is expected according to `test-ol/make-string'. --- lisp/ol.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/ol.el b/lisp/ol.el index 86f55d7cf..22eaae8fb 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -999,7 +999,9 @@ (defun org-link-make-string (link &optional description) (replace-regexp-in-string "]\\'" (concat "\\&" zero-width-space) (org-trim description)))))) - (if (not (org-string-nw-p link)) description + (if (not (org-string-nw-p link)) + (or description + (error "Empty link")) (format "[[%s]%s]" (org-link-escape link) (if description (format "[%s]" description) ""))))) -- 2.35.1 -- 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