[emacs-w3m:13865] [emacs-w3m/emacs-w3m] Wrong usage of aref in `w3m-form-p` (Issue #110)

Thierry Volpiatto <[email protected]> Fri, 06 May 2022 23:24:23 -0700
Newsgroups gmane.emacs.w3m
Message-ID <emacs-w3m/emacs-w3m/issues/[email protected]>
----==_mimepart_62761097295d5_5dd0d4082148881
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

Even if this function seems to be used nowhere in w3m, it is useful (I use it), `aref` is called with INDEX as first arg instead of ARRAY, here correct usage:

```elisp
(defun w3m-form-p (obj)
  "Return t if OBJ is a form object."
  (and (vectorp obj)
       (symbolp (aref obj 0))
       (eq (aref obj 0) 'w3m-form-object)))
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/emacs-w3m/emacs-w3m/issues/110
You are receiving this because you are subscribed to this thread.

Message ID: <emacs-w3m/emacs-w3m/issues/[email protected]>
----==_mimepart_62761097295d5_5dd0d4082148881
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p></p>
<p dir="auto">Even if this function seems to be used nowhere in w3m, it is useful (I use it), <code class="notranslate">aref</code> is called with INDEX as first arg instead of ARRAY, here correct usage:</p>
<div class="highlight highlight-source-emacs-lisp"><pre>(<span class="pl-k">defun</span> <span class="pl-e">w3m-form-p</span> (<span class="pl-v">obj</span>)
  <span class="pl-s"><span class="pl-pds">"</span>Return t if OBJ is a form object.<span class="pl-pds">"</span></span>
  (<span class="pl-k">and</span> (<span class="pl-c1">vectorp</span> obj)
       (<span class="pl-c1">symbolp</span> (<span class="pl-c1">aref</span> obj <span class="pl-c1">0</span>))
       (<span class="pl-k">eq</span> (<span class="pl-c1">aref</span> obj <span class="pl-c1">0</span>) <span class="pl-c1">'w3m-form-object</span>)))</pre></div>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />Reply to this email directly, <a href="https://github.com/emacs-w3m/emacs-w3m/issues/110">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ALIUPN3D67IEPE7EWS54LTTVIYEBPANCNFSM5VJ6QJ3Q">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ALIUPN3DDTRYF4ANUYV7HVDVIYEBPA5CNFSM5VJ6QJ32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4SJ2CMSA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span>&lt;emacs-w3m/emacs-w3m/issue
 s/110</span><span>@</span><span>github</span><span>.</span><span>com&gt;</span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/emacs-w3m/emacs-w3m/issues/110",
"url": "https://github.com/emacs-w3m/emacs-w3m/issues/110",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
----==_mimepart_62761097295d5_5dd0d4082148881--