bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29923: [PATCH] Skip writing empty abbrev tables


From: Noam Postavsky
Subject: bug#29923: [PATCH] Skip writing empty abbrev tables
Date: Sun, 09 Sep 2018 16:43:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Allen Li <address@hidden> writes:

> Subject: [PATCH] Skip writing empty abbrev tables
>
> Fixes bug#29923
>
> * lisp/abbrev.el (write-abbrev-file): Pass SKIPEMPTY to
> insert-abbrev-table-description.
> (insert-abbrev-table-description): Add SKIPEMPTY optional
> parameter. Skip inserting empty tables if SKIPEMPTY is non-nil.

  
>  (eval-when-compile (require 'cl-lib))
>  (require 'obarray)
> +(require 'seq)

You didn't end up using seq, as far as I can tell.
  
> -(defun insert-abbrev-table-description (name &optional readable)
> +(defun insert-abbrev-table-description (name &optional readable skipempty)
>    "Insert before point a full description of abbrev table named NAME.
>  NAME is a symbol whose value is an abbrev table.
>  If optional 2nd arg READABLE is non-nil, a human-readable description
>  is inserted.  Otherwise the description is an expression,
>  a call to `define-abbrev-table', which would
>  define the abbrev table NAME exactly as it is currently defined.
> +If optional arg SKIPEMPTY is non-nil, skip insertion if table is empty.
>  
>  Abbrevs marked as \"system abbrevs\" are omitted."

> -    (mapatoms (lambda (sym) (if (symbol-value sym) (push sym symbols))) 
> table)
> +    (mapatoms (lambda (sym)
> +                (if (and (symbol-value sym) (not (abbrev-get sym :system)))
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks like the second check you added implements the "Abbrevs marked as
\"system abbrevs\" are omitted" part.  I guess that actually fixes an
additional bug?  Worth mentioning in the commit message, I think.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]