From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jean-Christophe Helary Newsgroups: gmane.emacs.help Subject: Re: concat vs format Date: Sun, 9 Dec 2018 22:42:15 +0900 Message-ID: <957DD078-6F45-487F-84AA-09E2C54F5B9A@gmail.com> References: <6038B67F-98A7-42B9-8486-97DB99D63033@gmail.com> <4A03F880-46F5-47AA-BFA9-7CA09FB9D7AA@gmail.com> <87bm5vaqe1.fsf@mail.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1544362865 7606 195.159.176.226 (9 Dec 2018 13:41:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Dec 2018 13:41:05 +0000 (UTC) To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 09 14:41:00 2018 Return-path: Envelope-to: geh-help-gnu-emacs@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 1gVzKO-0001rV-HN for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Dec 2018 14:41:00 +0100 Original-Received: from localhost ([::1]:55508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVzMV-0000Tv-CV for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Dec 2018 08:43:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVzLl-0000Sf-Fb for help-gnu-emacs@gnu.org; Sun, 09 Dec 2018 08:42:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVzLi-0004ej-9O for help-gnu-emacs@gnu.org; Sun, 09 Dec 2018 08:42:25 -0500 Original-Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:34220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gVzLh-0004cw-7B for help-gnu-emacs@gnu.org; Sun, 09 Dec 2018 08:42:21 -0500 Original-Received: by mail-pl1-x632.google.com with SMTP id w4so3974388plz.1 for ; Sun, 09 Dec 2018 05:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=IY0jAMKAnFnAtBVB9pN/s3BEUgxjWT3IJfhSsYh2oYc=; b=ORG6WPjfLvijlCYNFH6haTzy5XZrP5cwCmZ2Y5yvlLp82By7Y9xHG4OB607Oy6HmWO fp0ctV9j57bFQFQZ1QFcLv+193E5yjNS4HCz9BrungrVmtVhABelL01FaCNt0wGRJysv e6kTnmP1UFuf4WOzqIrPBCBsmmugQtzXBM8EfJmB/n23pF8JmbYosygzVTexHduEbTFO aJ41RZEXKVzCJimkp7GxB3Jrom5PrQzHfUSS33WTBu45PWU3r6ThV9fKvLakgWYgJjLl tQ2IYlKgz0oJBK9nVhbH78taRlMAbSfS7p1pkEpnWPYuEWgqGrDKT0BMUmsCWj0GTRYm BEBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=IY0jAMKAnFnAtBVB9pN/s3BEUgxjWT3IJfhSsYh2oYc=; b=AbAZhNIk0n+41sEFVvXXRrob2Oi9kKAu/V5SyW6esFcnu5uvs6qWyGvFQpYa3fD6EP FGdcJEM8pY3uuYV5kQtH35T5FcQzOSJ20k4pFqiSknwxAmhntKUIX3lIuyT3NUJOu1/a Jbf8ZkpicEx2cXO3Y3uwqoJI0PiW/WqJAHNqT1NDb0T2vlKjFmzSSTkVf/Y0D5UUB92m 5R4b+kfm5IFJLwYdcio9Nxg5tb69wpZD8G1Vuz3h5dDMorutRe3DQTh/422LyZWnHeRZ NgUVgbgUZ3mLuaQCBAfob8wf39A7ZxOy5NGwR5OIolYJseMt1bIjNnw3Cw2fztMts5Io BzxQ== X-Gm-Message-State: AA+aEWbLA9kS7vL3eDknXZY9nkehQ8hj5e2WQjKdByOICwlrC/R07z2I hIdYqqZJS8atH+ECD3z+ZUwvtsHX X-Google-Smtp-Source: AFSGD/W3Wh9qdz35ssRSCGq0u1p5rk+kLwwysQzPhgMzBbSnSVc7nTOt8GhoqZQyaddq04a4aDoWkA== X-Received: by 2002:a17:902:8c91:: with SMTP id t17mr8376167plo.119.1544362939366; Sun, 09 Dec 2018 05:42:19 -0800 (PST) Original-Received: from [10.79.173.236] (117.102.194.204.static.zoot.jp. [117.102.194.204]) by smtp.gmail.com with ESMTPSA id g185sm12391022pfc.174.2018.12.09.05.42.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Dec 2018 05:42:18 -0800 (PST) In-Reply-To: <87bm5vaqe1.fsf@mail.de> X-Mailer: Apple Mail (2.3445.101.1) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::632 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118933 Archived-At: Stephan, I tried your suggestion but it did not (seem to) work. But after simplifying the code, I found a simpler way to identify the = issue, so that I can show it to the list. I run edebug on this: (defun dailyTemplate (myDay) (interactive (list (read-number "Date: " (string-to-number = (format-time-string "%d"))))) (let* ((myToday (getMyDates myDay)) ; (myTomorrow (+ (getMyDates myDay) 84600)) ; (myYesterday (- (getMyDates myDay) 84600)) (siteRoot "/Users/suzume/Documents/Code/brandelune.github.io/") (cssRoot (concat siteRoot "css/" (format-time-string "%Y" = myToday) "/")) And here are the edebug messages: Edebug: dailyTemplate [4 times] Result: "09" Result: 9 (#o11, #x9, ?\C-i) Result: 9 (#o11, #x9, ?\C-i) Result: (9) [3 times] Result: 9 (#o11, #x9, ?\C-i) Result: 1544324400 (#o13403102460, #x5c0c8530) [2 times] Result: "/Users/suzume/Documents/Code/brandelune.github.io/" [2 times] Result: 1544324400 (#o13403102460, #x5c0c8530) Result: "2018" Result: "/Users/suzume/Documents/Code/brandelune.github.io/..." So, the last concat gives me a path that's not the result of a "concat" = on the values that I feed it. Why ? "myDay" is checked to be between 1 and 31 and "getMyDates" returns this: (encode-time (list 0 0 12 myDay myMonth myYear nil nil 32400) 'integer) When I run: (concat "/Users/suzume/Documents/Code/brandelune.github.io/" "css/" = (format-time-string "%Y" 1544324400) "/") I *do* get what I expect, which is: "/Users/suzume/Documents/Code/brandelune.github.io/css/2018/" There is clearly something I do not understand here... :( Jean-Christophe=20 > On Dec 9, 2018, at 20:30, Stefan Huchler = wrote: >=20 > I run into a similar problem when I used the prin1 function. It had to > do with the default value auf print-length which was to low. >=20 > can you put a (let* ((print-length 5000)) around your code and test > that? Or look up the variable if it could have something todo with = your > problem. >=20 > Jean-Christophe Helary writes: >=20 >>> On Dec 9, 2018, at 13:09, Drew Adams wrote: >>>=20 >>>> Is there a difference between: >>>> (concat firstPartofURL secondPartofURL) and >>>> (format "%s%s" firstPartofURL secondPartofURL)? >>>=20 >>> If both args are strings then no; the result >>> is the same. But the functions are very >>> different - they take different args and, >>> aside from some cases like this one where >>> the result is the same for some args, their >>> uses/purposes are different. >>=20 >> Thank you. >>=20 >> I'm trying to create URLs from dates and at one point I get a concat = that outputs "/path/to/url/..." instead of = "/path/to/url/12/04/index.html". >> I checked the code and put format instead of concat and got the same >> result. All the things I try to concat are strings that I >> progressively build over other strings, and edebug gives me correct >> values up to the point where the wrong string is created... >>=20 >> I'm going to re-check the whole thing... >>=20 >> Jean-Christophe Helary >> ----------------------------------------------- >> http://mac4translators.blogspot.com @brandelune >=20 >=20 Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune