From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#45693: [two word expansion works, but write-abbrev-file destroys it] Date: Mon, 11 Jan 2021 18:38:57 +0100 Message-ID: <87mtxf4bm6.fsf@gmail.com> References: <87v9cam56e.fsf@mat.ucm.es> <87lfd0svvp.fsf@gnus.org> <87czycpz71.fsf@mat.ucm.es> <87wnwkiybo.fsf@gnus.org> <87eeis1oag.fsf_-_@mat.ucm.es> <87wnwjd9yy.fsf@gmail.com> <83czybfq9q.fsf@gnu.org> <875z4379ri.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 45693@debbugs.gnu.org To: Uwe Brauer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 11 18:41:47 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz1CM-0006E2-Lb for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 18:41:46 +0100 Original-Received: from localhost ([::1]:53916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz1CL-0000DV-Lz for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 12:41:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz1Ag-0006d5-NZ for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 12:40:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz1Ag-0003R4-EM for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 12:40:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kz1Ag-0000R1-AG for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 12:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2021 17:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45693 X-GNU-PR-Package: emacs Original-Received: via spool by 45693-submit@debbugs.gnu.org id=B45693.16103867511609 (code B ref 45693); Mon, 11 Jan 2021 17:40:02 +0000 Original-Received: (at 45693) by debbugs.gnu.org; 11 Jan 2021 17:39:11 +0000 Original-Received: from localhost ([127.0.0.1]:58168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz19q-0000Pt-NZ for submit@debbugs.gnu.org; Mon, 11 Jan 2021 12:39:10 -0500 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:41389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz19l-0000PM-L8 for 45693@debbugs.gnu.org; Mon, 11 Jan 2021 12:39:09 -0500 Original-Received: by mail-wr1-f45.google.com with SMTP id a12so619813wrv.8 for <45693@debbugs.gnu.org>; Mon, 11 Jan 2021 09:39:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version; bh=u+pfw0qbTOlENUamTfqShG7XpeAt0MlN9qbqgFc75L8=; b=s3Cpnl7sE1q/1WRB47n6HtpwchWMdlslY6C7MZdgdxQSsxmxIBpqqwDke1FGMqXN0K e6fJ09+/IOoEm2JYcf/w6GO/I5dGFBq99gewTiH4J7ECFthCrmtxulddO/SplEdWTuuG E7Md39E7Z95JSR9nFG2BTJxyRb2NpMvLpWQDtjBSZ2J15qZCdhxybSd19bEC5MWnAo+H AODxumFuJfjzwLZFQ1wMP6d5beKRKxI8Xfd/Ic01fawkrsKmOfZeDPB9VR0F6mcCskgx yTSepDCB6MmfHOBcoHM1gA/t+eN6+zgoga2YAjP0bidsh38LO6O5gvU46Psf0GABBE/5 ++dA== 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:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version; bh=u+pfw0qbTOlENUamTfqShG7XpeAt0MlN9qbqgFc75L8=; b=IIk+pL/Cj975OAZSXPLx1hG6iWDnilL9I5+3SwFcY/XgDUkdIsecig1tl5yoHYsJ8w pH9CLQ6ElI7cDYrjpF/g7F16DXGQn5bVT44IPs5/dO31gKA0HlcgvGvnlFZewG6h0QGi +Y7qCKv6j7xKkPm3G2jjvCm4JKd0osv+YlG561JKAYx59Sqfyhht3wYuv2cl9RxmeTsL +9b1YL7ATEps5txKJYy6QnbBGEdcqqFcB6D1oSPamOHsb0FVYdEYKO49rzOk7TnIjd0l jmrwBGFLMHSRNGGqxTGIfy3DGz6b0625xSMZNQTt4a9bne6hrsqD0JzqCxjDHV5MH9Yr WeLw== X-Gm-Message-State: AOAM533/GkV4wm12uov8FAO9Gjuf5IPq0lTMeTT0h39dwLQsx8SY6v5a S3FLZsgVPzVe1RjfdgFB6PBPwQZhYnE= X-Google-Smtp-Source: ABdhPJy8ShpPaYyQwKWLhzms+f06ykT/yUHB7uEFLehmzAxxduZ5ZcZsv7FgSwnDSfqnxETdaLbAFw== X-Received: by 2002:adf:f401:: with SMTP id g1mr247984wro.258.1610386739297; Mon, 11 Jan 2021 09:38:59 -0800 (PST) Original-Received: from rltb ([2a01:e34:ecfc:a861:69b6:6aaf:dbd3:8964]) by smtp.gmail.com with ESMTPSA id a17sm459773wrs.20.2021.01.11.09.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 09:38:58 -0800 (PST) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <875z4379ri.fsf@mat.ucm.es> (Uwe Brauer's message of "Mon, 11 Jan 2021 16:50:41 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197729 Archived-At: Uwe Brauer writes: >> So does it mean we had better avoid describing this "feature" in the >> docs, until and unless it gets fixed to be more user-friendly? > > Well, I find it useful and found a real kludge by using two abbrev files > and associated minor modes. I think what is *really* missing is to > improve/rewrite the write-abbrev-file function. At the very least we need to support :regexp and :case-fixed. Something like this, maybe? diff --git i/lisp/abbrev.el w/lisp/abbrev.el index 65f7118385..21b4af095f 100644 --- i/lisp/abbrev.el +++ w/lisp/abbrev.el @@ -1074,7 +1074,11 @@ insert-abbrev-table-description a call to `define-abbrev-table' that when evaluated will define the abbrev table NAME exactly as it is currently defined. Abbrevs marked as \"system abbrevs\" are ignored." - (let ((symbols (abbrev--table-symbols name readable))) + (let* ((symbols (abbrev--table-symbols name readable)) + (docstring (or (documentation-property name 'variable-documentation) + "no documentation")) + (sym (obarray-get (symbol-value name) "")) + (props (symbol-plist sym))) (setq symbols (sort symbols 'string-lessp)) (let ((standard-output (current-buffer))) (if readable @@ -1090,7 +1094,13 @@ insert-abbrev-table-description (insert " '())\n\n") (insert "\n '(\n") (mapc 'abbrev--write symbols) - (insert " ))\n\n"))) + (insert " )\n") + (insert (format "%S\n" docstring)) + (when (plist-member props :case-fixed) + (insert (format "%s %s\n" :case-fixed (plist-get props :case-fixed)))) + (when (plist-member props :regexp) + (insert (format "%s %S\n" :regexp (plist-get props :regexp)))) + (insert ")\n\n"))) nil))) (defun abbrev--table-symbols (name &optional system)