all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Hongyi Zhao <hongyi.zhao@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: append, push, and add-to-list.
Date: Sun, 4 Jul 2021 14:28:24 +0300	[thread overview]
Message-ID: <YOGbWPme9pU7Z6Ox@protected.localdomain> (raw)
In-Reply-To: <CAGP6POJ_BMPvesXjkhN9CzUwXQ9z=NLedkgptGmwKn_vsgWafA@mail.gmail.com>

* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-07-04 08:12]:
> Thank you. I listed the usages below for all above-mentioned functions
> by {C-h f} function-name:
> 
> (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)
> (push NEWELT PLACE)
> (cl-pushnew X PLACE [KEYWORD VALUE]...)
> (append &rest SEQUENCES)

Good, I can also see some possible inconsistencies with X and NEWELT,
as it would be better to call X also NEWELT. I can also see that
documentation for `cl-pushnew' is not adequate enough. You are
probably expected to learn definition from Common Lisp to understand
the KEYWORDs:
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_pushnew.html#pushnew

Function `append' will work with various sequences not just lists.

Please see manual: (info "(elisp) Sequences Arrays Vectors")

> > Because you use it more for configurations, then add-to-list would be:
> >
> > (add-to-list 'company-backends '(company-capf company-ispell))
> 
> Why can't this be written as follows, just like the other two?
> 
> (add-to-list company-backends '(company-capf company-ispell))
> 
> >
> > and with append
> >
> > (append company-backends '(company-capf company-ispell))

Functions `add-to-list' and `append' do different things, though
similar. 


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2021-07-04 11:28 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04  3:18 append, push, and add-to-list Hongyi Zhao
2021-07-04  4:35 ` Jean Louis
2021-07-04  5:11   ` Hongyi Zhao
2021-07-04 11:28     ` Jean Louis [this message]
2021-07-04 13:50       ` Hongyi Zhao
2021-07-04 15:58         ` Jean Louis
2021-07-05  2:04           ` Hongyi Zhao
2021-07-04 16:01         ` [External] : " Drew Adams
2021-07-04 16:20     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-04 16:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05  2:16   ` Hongyi Zhao
2021-07-05  3:48     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05  4:31       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05  5:07         ` Hongyi Zhao
2021-07-05  5:50           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05  6:19             ` Hongyi Zhao
2021-07-05  5:06     ` Jean Louis
2021-07-05  6:22       ` Hongyi Zhao
2021-07-05  6:32         ` Emanuel Berg via Users list for the GNU Emacs text editor
  -- strict thread matches above, loose matches on Subject: below --
2021-07-05 14:37 Drew Adams
2021-07-05 14:53 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 15:19   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-05 16:46     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-06 19:54       ` Jean Louis
2021-07-06 20:08         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 15:41   ` tomas
2021-07-05 16:58     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 17:21       ` tomas
2021-07-06  1:17         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 18:10       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 18:18         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 18:11       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 18:39         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-05 20:35           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-06 19:57         ` Jean Louis
2021-07-06 20:16           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-06 19:56       ` Jean Louis
2021-07-06 20:15         ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YOGbWPme9pU7Z6Ox@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hongyi.zhao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.