<div dir="ltr">Thank you, Dan, for looking into this.<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 20, 2017 at 2:04 AM, Dan Flickinger <span dir="ltr"><<a href="mailto:danf@stanford.edu" target="_blank">danf@stanford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-4300787246601866574divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">HI Mike,</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">I can't tell you why LOGON redefines those two macros, but note that you can see what the macro is doing by asking Emacs to evaluate for example the following:</p>
<p style="margin-top:0px;margin-bottom:0px">(macroexpand '(unless t t))</p>
<p style="margin-top:0px;margin-bottom:0px">which in the LOGON universe shows you</p>
<p style="margin-top:0px;margin-bottom:0px">(or t (progn t))</p>
<p style="margin-top:0px;margin-bottom:0px">which returns T, confirming that here you get the value of the first argument to `unless if it is non-nil, and the value of the final argument otherwise.</p>
<p style="margin-top:0px;margin-bottom:0px">In contrast, in unmodified Emacs, the macroexpand shows you<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">(if t nil t)</p>
<p style="margin-top:0px;margin-bottom:0px">confirming that you get NIL if the first argument is non-nil, and the value of the final argument otherwise.</p>
</div></div></blockquote><div><br></div><div>I also found out (sometime between my first and third email) that I could C-x C-e to evaluate an expression in a buffer and get the result in the status bar. I didn't know about macroexpand, but that helps me see what's going wrong. Thanks!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_-4300787246601866574divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">As for usage, I looked at the three files in the LOGON repository with suffix ".el", and reckon that the pg-interface.el file is not used by anyone but me (for the lexical database). Of the other two, lkb.el only calls
'unless once, with no interest in the returned value, and tdl-mode.el makes just one call to `when, and it looks like it might matter what is returned (to set the value of 'indent-me).
<br>
</p>
</div></div></blockquote><div><br></div><div>There are also .el files under franz/, but maybe those aren't affected?</div><div><br></div><div>And in tdl-mode.el I think you're talking about this expression:</div><div><br></div><div> (progn (forward-char 1)<br> (when (and (eq (preceding-char) ?\[)<br> (not (tdl-comma-at-end-p indent-point)))<br> (progn (skip-chars-forward " \t")<br> (re-search-forward "[ \t]" nil t)))<br> (skip-chars-forward " \t")<br> (current-column))</div><div><br></div><div>If the return value is meaningful, could that be rewritten as:</div><div><br></div><div> (progn (forward-char 1)<br> (let ((x (and (eq (preceding-char) ?\[)<br> (not (tdl-comma-at-end-p indent-point)))))<br> (if x (progn (skip-chars-forward " \t")<br> (re-search-forward "[ \t]" nil t))<br> x))<br> (skip-chars-forward " \t")<br> (current-column))<br></div><div><br></div><div>I used the (let ...) form to prevent writing the (and ...) form twice. I don't know if this is idiomatic elisp or not.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_-4300787246601866574divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">So my impression is that there is no need to preserve the LOGON redefinition of 'unless, and perhaps the effect of the redefined 'when could be managed differently in the one call in tdl-mode.el without redefining the
macro.</p>
</div></div></blockquote><div><br></div><div>The future is looking brighter.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_-4300787246601866574divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px"> Dan<br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-4300787246601866574divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> <a href="mailto:developers-bounces@emmtee.net" target="_blank">developers-bounces@emmtee.net</a> <<a href="mailto:developers-bounces@emmtee.net" target="_blank">developers-bounces@emmtee.net</a><wbr>> on behalf of Michael Wayne Goodman <<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>><br>
<b>Sent:</b> Tuesday, December 19, 2017 1:49 PM<br>
<b>To:</b> developers<br>
<b>Subject:</b> Re: [developers] dot.emacs redefinition of 'unless' and 'when'</font>
<div> </div>
</div><div><div class="gmail-h5">
<div>
<div dir="ltr">
<div>
<div>
<div>Sorry, one more change to my original mail. I mistakenly assumed that 'unless' was not returning the last value when the condition was false (based on some symptoms I was seeing), but I didn't explicitly test this, and my lisp is not good enough to deduce
this by looking at the defmacro expression in ${LOGONROOT]/dot.emacs. In fact, it *does* appear to return the last value, but the difference from the default definition is that LOGON-unless returns the value of the condition when it's non-nil, rather than
returning nil.<br>
<br>
</div>
; standard unless<br>
</div>
(unless nil 1 2 3) ; returns: 3<br>
(unless 'value 1 2 3) ; returns: nil<br>
<br>
</div>
; LOGON unless<br>
<div>
<div>
<div>(unless nil 1 2 3) ; returns: 3<br>
(unless 'value 1 2 3) ; returns: value<br>
<div>
<div>
<div class="gmail-m_-4300787246601866574x_gmail_extra"><br>
</div>
<div class="gmail-m_-4300787246601866574x_gmail_extra">So when LOGON-unless is used in constructing a list, it will (I think) append the value of the condition to the list instead of nothing.</div>
<div class="gmail-m_-4300787246601866574x_gmail_extra"><br>
</div>
<div class="gmail-m_-4300787246601866574x_gmail_extra"><br>
<div class="gmail-m_-4300787246601866574x_gmail_quote">On Tue, Dec 19, 2017 at 10:18 AM, Michael Wayne Goodman
<span dir="ltr"><<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>></span> wrote:<br>
<blockquote class="gmail-m_-4300787246601866574x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div class="gmail-m_-4300787246601866574x_gmail_extra">
<div class="gmail-m_-4300787246601866574x_gmail_quote"><span class="gmail-m_-4300787246601866574x_gmail-">On Tue, Dec 19, 2017 at 8:12 AM, Michael Wayne Goodman
<span dir="ltr"><<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>></span> wrote:<br>
<blockquote class="gmail-m_-4300787246601866574x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>
<div>Hi Developers,<br>
<br>
</div>
Does anyone know why ${LOGONROOT}/dot.emacs redefines the 'unless' and 'when' macros? It breaks some other Emacs packages I have that depend on the return value of the 'unless', which should be the value of the last argument. I'm aware that 'unless' and 'when'
should be used when the return value is *not* important (according to <a href="https://www.emacswiki.org/emacs/WhenToUseIf" target="_blank">
https://www.emacswiki.org/emac<wbr>s/WhenToUseIf</a>), but do we have to enforce that suggestion by redefining the macros so they don't return the last value?<br>
<br>
</div>
Also see <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Conditionals.html" target="_blank">
https://www.gnu.org/software/e<wbr>macs/manual/html_node/elisp/Co<wbr>nditionals.html</a>, which says that 'unless' is equivalent to:<br>
<br>
(if condition nil<br>
a b c)<br clear="all">
</div>
</blockquote>
<div><br>
</div>
</span>
<div>Er... I meant that the guide says `(unless condition a b c)' is equivalent to the above, not in the general case. And I think the expected return value of the 'unless' expression would be c if condition returns nil.<br>
</div>
<span class="gmail-m_-4300787246601866574x_gmail-">
<div> </div>
<blockquote class="gmail-m_-4300787246601866574x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>Thanks<span class="gmail-m_-4300787246601866574x_gmail-m_-4875101875560888905gmail-HOEnZb"><font color="#888888"><br>
</font></span></div>
<span class="gmail-m_-4300787246601866574x_gmail-m_-4875101875560888905gmail-HOEnZb"><font color="#888888">
<div><br>
-- <br>
<div class="gmail-m_-4300787246601866574x_gmail-m_-4875101875560888905gmail-m_-3669990881836768010gmail_signature">
<div dir="ltr">Michael Wayne Goodman
<div>Ph.D. Candidate, UW Linguistics</div>
</div>
</div>
</div>
</font></span></div>
</div>
</div>
</blockquote>
</span></div>
<span class="gmail-m_-4300787246601866574x_gmail-"><br>
<br clear="all">
<br>
-- <br>
<div class="gmail-m_-4300787246601866574x_gmail-m_-4875101875560888905gmail_signature">
<div dir="ltr">Michael Wayne Goodman
<div>Ph.D. Candidate, UW Linguistics</div>
</div>
</div>
</span></div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="gmail-m_-4300787246601866574x_gmail_signature">
<div dir="ltr">Michael Wayne Goodman
<div>Ph.D. Candidate, UW Linguistics</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Michael Wayne Goodman<div>Ph.D. Candidate, UW Linguistics</div></div></div>
</div></div>