unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* About elements in `format-alist'
@ 2013-06-16 23:02 Xue Fuqiao
  2013-06-17 22:24 ` Michael Heerdegen
  0 siblings, 1 reply; 4+ messages in thread
From: Xue Fuqiao @ 2013-06-16 23:02 UTC (permalink / raw)
  To: emacs-devel

Hi list,

In the doc string of `format-alist':

  Elements are of the form
  (NAME DOC-STR REGEXP FROM-FN TO-FN MODIFY MODE-FN PRESERVE).

There should be 8 elements in each list.  But there are only 7 elements
in each list of the default value.  Which one is absent?  If there's an
optional element, I think we should mention it in the doc string.

--
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About elements in `format-alist'
  2013-06-16 23:02 About elements in `format-alist' Xue Fuqiao
@ 2013-06-17 22:24 ` Michael Heerdegen
  2013-06-17 22:59   ` Xue Fuqiao
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Heerdegen @ 2013-06-17 22:24 UTC (permalink / raw)
  To: Xue Fuqiao; +Cc: emacs-devel

Xue Fuqiao <xfq.free@gmail.com> writes:

> Hi list,
>
> In the doc string of `format-alist':
>
>   Elements are of the form
>   (NAME DOC-STR REGEXP FROM-FN TO-FN MODIFY MODE-FN PRESERVE).
>
> There should be 8 elements in each list.  But there are only 7 elements
> in each list of the default value.  Which one is absent?  If there's an
> optional element, I think we should mention it in the doc string.

Looks like missing elements are just treated as if they were nil (the
code uses `nth').

Dunno if it's worth the trouble of making a bug report - since holding
the convention doesn't make problems (does it?).


Regards,

Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About elements in `format-alist'
  2013-06-17 22:24 ` Michael Heerdegen
@ 2013-06-17 22:59   ` Xue Fuqiao
  2013-06-18  0:57     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Xue Fuqiao @ 2013-06-17 22:59 UTC (permalink / raw)
  To: emacs-devel

On Tue, Jun 18, 2013 at 6:24 AM, Michael Heerdegen
<michael_heerdegen@web.de> wrote:
> Xue Fuqiao <xfq.free@gmail.com> writes:
>
>> Hi list,
>>
>> In the doc string of `format-alist':
>>
>>   Elements are of the form
>>   (NAME DOC-STR REGEXP FROM-FN TO-FN MODIFY MODE-FN PRESERVE).
>>
>> There should be 8 elements in each list.  But there are only 7 elements
>> in each list of the default value.  Which one is absent?  If there's an
>> optional element, I think we should mention it in the doc string.
>
> Looks like missing elements are just treated as if they were nil (the
> code uses `nth').

Thanks.  May I install the following patch to trunk?

=== modified file 'lisp/format.el'
--- lisp/format.el    2013-01-01 09:11:05 +0000
+++ lisp/format.el    2013-06-17 22:57:24 +0000
@@ -101,6 +101,7 @@
   "List of information about understood file formats.
 Elements are of the form
 \(NAME DOC-STR REGEXP FROM-FN TO-FN MODIFY MODE-FN PRESERVE).
+If an element list is not that long, the excessive part is taken as nil.

 NAME    is a symbol, which is stored in `buffer-file-format'.

--
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About elements in `format-alist'
  2013-06-17 22:59   ` Xue Fuqiao
@ 2013-06-18  0:57     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-06-18  0:57 UTC (permalink / raw)
  To: Xue Fuqiao; +Cc: emacs-devel

>  \(NAME DOC-STR REGEXP FROM-FN TO-FN MODIFY MODE-FN PRESERVE).
> +If an element list is not that long, the excessive part is taken as nil.

It's OK to add it, but at the same time it's not worth the trouble,
because it's a general convention: in 99% of the cases nil is treated
identically to (cons nil nil).  I.e. it's only when this equivalence is
not followed that we should mention it.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-18  0:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-16 23:02 About elements in `format-alist' Xue Fuqiao
2013-06-17 22:24 ` Michael Heerdegen
2013-06-17 22:59   ` Xue Fuqiao
2013-06-18  0:57     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).