all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean-Christophe Helary <brandelune@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: wrong number of arguments when launched interactively...
Date: Sun, 25 Nov 2018 22:35:33 +0900	[thread overview]
Message-ID: <27A15626-627A-4164-BE6B-FDD08C9247BA@gmail.com> (raw)

(beginner warning)

I'm trying to automate the creation of html templates to avoid link mistakes and I wrote this code today:

(defun dailyIndex (myDate)
  (interactive (list
                (read-number "Date: " (string-to-number (format-time-string "%d")))))
  (setq baseCSSLink (format "../../../css/%s/baseCSS.css" (format-time-string "%Y")))
  (setq dailyCSSLink (format "../../../css/%s/DailyCSS%s%s.css" (format-time-string "%Y") (format-time-string "%m") myDate))
  (setq previousDay (- myDate 1))
  (setq previousDate (format "%s%s" (format-time-string "%m") previousDay))
  (setq previousDayLink (format "../../%s/%s/index.html" (format-time-string "%m") previousDay))
  (setq nextDay (+ myDate 1))
  (setq nextDate (format "%s%s" (format-time-string "%m") nextDay))
  (setq nextDayLink (format "../../%s/%s/index.html" (format-time-string "%m") nextDay))
  (setq todayDate (format "%s/%s/%s" (format-time-string "%Y") (format-time-string "%m") myDate))
  (setq todayTemplate
	(format "<html>
    <head>
	<title>%s</title>
	<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" class=\"baseCSS\"/>
        <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" class=\"dailyCSS\"/>
    </head>
    <body>
	We're not there yet...
	<p class=\"navigation\">
	    <a href=\"%s\" hreflang=\"en\" rel=\"prev\">%s</a>
	    <a href=\"../../../index.html\" hreflang=\"en\">index</a>
	    <a href=\"%s\" hreflang=\"en\" rel=\"next\">%s</a>
	</p> 
	<p>%s, %s </p>
	<p>
	<h1>%s</h1>
	<h2>%s</h2>	

	<p class=\"navigation\">
	    <a href=\"%s\" hreflang=\"en\" rel=\"prev\">%s</a>
	    <a href=\"../../../index.html\" hreflang=\"en\">index</a>
	    <a href=\"%s\" hreflang=\"en\" rel=\"next\">&s</a>
	</p>
    </body>
</html>"
		"titre" baseCSSLink dailyCSSLink previousDayLink previousDate nextDayLink nextDate todayDate "..." "titre" "sous-titre" previousDayLink previousDate nextDayLink nextDate todayDate))

(write-region (dailyIndex) nil "~/Desktop/index.html"))

When run interactively, I always get a "wrong number of arguments" error. When I evaluate the internal expressions one by one, I never get this. I have no idea what is going on...


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





             reply	other threads:[~2018-11-25 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 13:35 Jean-Christophe Helary [this message]
2018-11-25 14:06 ` wrong number of arguments when launched interactively Stephen Berman
2018-11-25 14:36   ` Jean-Christophe Helary

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=27A15626-627A-4164-BE6B-FDD08C9247BA@gmail.com \
    --to=brandelune@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.