From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Linking to ImageMagick by default Date: Wed, 19 Dec 2018 18:36:16 +0200 Message-ID: <83efadcw3j.fsf@gnu.org> References: <20181205223901.GA5543@breton.holly.idiocy.org> <20181208183810.GA2465@breton.holly.idiocy.org> <20181210220944.GA4793@breton.holly.idiocy.org> <20181219160308.GA43504@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1545237329 6241 195.159.176.226 (19 Dec 2018 16:35:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Dec 2018 16:35:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 19 17:35:25 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZeof-0001Um-5Y for ged-emacs-devel@m.gmane.org; Wed, 19 Dec 2018 17:35:25 +0100 Original-Received: from localhost ([::1]:32961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZeql-0000wm-Rp for ged-emacs-devel@m.gmane.org; Wed, 19 Dec 2018 11:37:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZepe-0000uF-IC for emacs-devel@gnu.org; Wed, 19 Dec 2018 11:36:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZepV-0007Bg-Jf for emacs-devel@gnu.org; Wed, 19 Dec 2018 11:36:21 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZepT-0007Ad-Fk; Wed, 19 Dec 2018 11:36:17 -0500 Original-Received: from [176.228.60.248] (port=1543 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gZepL-0005B5-Qw; Wed, 19 Dec 2018 11:36:13 -0500 In-reply-to: <20181219160308.GA43504@breton.holly.idiocy.org> (message from Alan Third on Wed, 19 Dec 2018 16:03:08 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:231924 Archived-At: > Date: Wed, 19 Dec 2018 16:03:08 +0000 > From: Alan Third > > I want to strip out the properties that I’m going to use at display > time, so that I can use the same cached image for different output > sizes, while leaving other properties that I don’t know about in > place. So I’d like to store the above as > > '(image :file "image.png" :format png) > > however I’m not sure how to go about filtering the list in C. I tried > a few variations on this, but they all seg fault > > static Lisp_Object > get_cache_spec (Lisp_Object spec) > { > Lisp_Object cache_spec, tail; > > cache_spec = Qnil; > > for (tail = XCDR (spec); > CONSP (tail) && CONSP (XCDR (tail)); > tail = XCDR (XCDR (tail))) > { > if (!EQ (XCAR (tail), Qwidth) > && !EQ (XCAR (tail), QCheight) > && !EQ (XCAR (tail), QCmax_width) > && !EQ (XCAR (tail), QCmax_height) > && !EQ (XCAR (tail), QCscale) > && !EQ (XCAR (tail), QCmargin) > && !EQ (XCAR (tail), QCascent) > && !EQ (XCAR (tail), QCrelief)) > cache_spec = list3 (XCAR (tail), XCAR (XCDR (tail)), cache_spec); > } > cache_spec = list2 (XCAR (spec), cache_spec); I think you should use Fcons instead of list3 or list2.