cl-return gives error without the cl-block.

This commit is contained in:
cnngimenez 2021-03-23 21:03:34 -03:00 committed by wgreenhouse
parent 75f57df0c7
commit 10cc5cbbd2
1 changed files with 42 additions and 42 deletions

View File

@ -432,15 +432,14 @@ Return nil if the attribute was not found."
#+END_SRC
**** jabber-xml-path :function:
#+BEGIN_SRC emacs-lisp
(defun jabber-xml-path (xml-data path)
(defun jabber-xml-path (xml-data path)
"Find sub-node of XML-DATA according to PATH.
PATH is a vaguely XPath-inspired list. Each element can be:
a symbol go to first child node with this node name
cons cell car is string containing namespace URI,
PATH is a vaguely XPath-inspired list. Each element can be:
a symbol go to first child node with this node name
cons cell car is string containing namespace URI,
cdr is string containing node name. Find
first matching child node.
any string character data of this node."
any string character data of this node."
(let ((node xml-data))
(while (and path node)
(let ((step (car path)))
@ -452,10 +451,11 @@ any string character data of this node."
;; of xml.el. It will also be more correct.
;; Now, it only matches explicit namespace declarations.
(setq node
(cl-block dolist-loop
(dolist (x (jabber-xml-get-children node (intern (cdr step))))
(when (string= (jabber-xml-get-attribute x 'xmlns)
(car step))
(cl-return x)))))
(cl-return-from dolist-loop x))))))
((stringp step)
(setq node (car (jabber-xml-node-children node)))
(unless (stringp node)
@ -4249,16 +4249,16 @@ JC is the Jabber connection."
#+END_SRC
**** jabber-roster-sort-items :function:
#+BEGIN_SRC emacs-lisp
(defun jabber-roster-sort-items (a b)
(defun jabber-roster-sort-items (a b)
"Sort roster items A and B according to `jabber-roster-sort-functions'.
Return t if A is less than B."
Return t if A is less than B."
(dolist (fn jabber-roster-sort-functions)
(let ((comparison (funcall fn a b)))
(cond
((< comparison 0)
(cl-return t))
t)
((> comparison 0)
(cl-return nil))))))
nil)))))
#+END_SRC
**** jabber-roster-sort-by-status :function: