lint(checkdoc): edit 3 docstrings, add 1 missing docstring.

This commit is contained in:
contrapunctus 2021-06-05 00:07:57 +05:30
parent 7eedb6fe14
commit 933f9077a4
2 changed files with 30 additions and 23 deletions

View File

@ -40,10 +40,10 @@
(eval-when-compile
(require 'cl))
(defun jabber-escape-xml (str)
"Escape strings for XML."
(if (stringp str)
(let ((newstr (concat str)))
(defun jabber-escape-xml (string)
"Escape STRING for XML."
(if (stringp string)
(let ((newstr (concat string)))
;; Form feeds might appear in code you copy, etc. Nevertheless,
;; it's invalid XML.
(setq newstr (jabber-replace-in-string newstr "\f" "\n"))
@ -56,21 +56,21 @@
(setq newstr (jabber-replace-in-string newstr "'" "'"))
(setq newstr (jabber-replace-in-string newstr "\"" """))
newstr)
str))
string))
(defun jabber-unescape-xml (str)
"unescape xml strings"
(defun jabber-unescape-xml (string)
"Unescape STRING for XML."
;; Eventually this can be done with `xml-substitute-special', but the
;; version in xml.el of GNU Emacs 21.3 is buggy.
(if (stringp str)
(let ((newstr str))
(if (stringp string)
(let ((newstr string))
(setq newstr (jabber-replace-in-string newstr """ "\""))
(setq newstr (jabber-replace-in-string newstr "'" "'"))
(setq newstr (jabber-replace-in-string newstr ">" ">"))
(setq newstr (jabber-replace-in-string newstr "&lt;" "<"))
(setq newstr (jabber-replace-in-string newstr "&amp;" "&"))
newstr)
str))
string))
(defun jabber-sexp2xml (sexp)
"Return SEXP as well-formatted XML.
@ -234,7 +234,8 @@ any string character data of this node"
node))
(defmacro jabber-xml-let-attributes (attributes xml-data &rest body)
"Bind variables to the same-name attribute values in XML-DATA."
"Evaluate BODY with ATTRIBUTES bound to their values in XML-DATA.
ATTRIBUTES must be a list of symbols, as present in XML-DATA."
`(let ,(mapcar #'(lambda (attr)
(list attr `(jabber-xml-get-attribute ,xml-data ',attr)))
attributes)
@ -300,6 +301,8 @@ any string character data of this node"
"History of entered JIDs.")
(defsubst jabber-replace-in-string (str regexp newtext)
"Replace all matches for REGEXP with NEWTEXT in STR.
NEWTEXT is inserted literally, without changing its case or treating \\ specially."
(replace-regexp-in-string regexp newtext str t t))
(defalias 'jabber-propertize 'propertize)

View File

@ -168,7 +168,8 @@ If a source block does not have syntax highlighting, press =M-o M-o= (=font-lock
7. [ ] "Code" has a lot of direct sub-headings, making it somewhat cumbersome to navigate; someone with a better understanding of the program could organize these better
8. [X] The tangled file currently does not list all the other authors (currently listed in =:COPYRIGHT:= drawers). We could add them all at once in the library headers section...or something else. 🤔
* Library headers and commentary
#+BEGIN_SRC emacs-lisp
=:comments no= here, because we do not want the first line of the file to be an Org link comment.
#+BEGIN_SRC emacs-lisp :comments no
;;; jabber.el --- a minimal jabber client
;; Copyright (C) 2003-2010, 2013 - Magnus Henoch - mange@freemail.hu
@ -227,10 +228,10 @@ If a source block does not have syntax highlighting, press =M-o M-o= (=font-lock
#+END_SRC
*** jabber-escape-xml :function:
#+BEGIN_SRC emacs-lisp
(defun jabber-escape-xml (str)
"Escape strings for XML."
(if (stringp str)
(let ((newstr (concat str)))
(defun jabber-escape-xml (string)
"Escape STRING for XML."
(if (stringp string)
(let ((newstr (concat string)))
;; Form feeds might appear in code you copy, etc. Nevertheless,
;; it's invalid XML.
(setq newstr (jabber-replace-in-string newstr "\f" "\n"))
@ -243,24 +244,24 @@ If a source block does not have syntax highlighting, press =M-o M-o= (=font-lock
(setq newstr (jabber-replace-in-string newstr "'" "&apos;"))
(setq newstr (jabber-replace-in-string newstr "\"" "&quot;"))
newstr)
str))
string))
#+END_SRC
*** jabber-unescape-xml :function:
#+BEGIN_SRC emacs-lisp
(defun jabber-unescape-xml (str)
"unescape xml strings"
(defun jabber-unescape-xml (string)
"Unescape STRING for XML."
;; Eventually this can be done with `xml-substitute-special', but the
;; version in xml.el of GNU Emacs 21.3 is buggy.
(if (stringp str)
(let ((newstr str))
(if (stringp string)
(let ((newstr string))
(setq newstr (jabber-replace-in-string newstr "&quot;" "\""))
(setq newstr (jabber-replace-in-string newstr "&apos;" "'"))
(setq newstr (jabber-replace-in-string newstr "&gt;" ">"))
(setq newstr (jabber-replace-in-string newstr "&lt;" "<"))
(setq newstr (jabber-replace-in-string newstr "&amp;" "&"))
newstr)
str))
string))
#+END_SRC
*** jabber-sexp2xml :function:
@ -458,7 +459,8 @@ any string character data of this node"
*** jabber-xml-let-attributes :macro:
#+BEGIN_SRC emacs-lisp
(defmacro jabber-xml-let-attributes (attributes xml-data &rest body)
"Bind variables to the same-name attribute values in XML-DATA."
"Evaluate BODY with ATTRIBUTES bound to their values in XML-DATA.
ATTRIBUTES must be a list of symbols, as present in XML-DATA."
`(let ,(mapcar #'(lambda (attr)
(list attr `(jabber-xml-get-attribute ,xml-data ',attr)))
attributes)
@ -543,6 +545,8 @@ any string character data of this node"
*** jabber-replace-in-string :inline:function:
#+BEGIN_SRC emacs-lisp
(defsubst jabber-replace-in-string (str regexp newtext)
"Replace all matches for REGEXP with NEWTEXT in STR.
NEWTEXT is inserted literally, without changing its case or treating \\ specially."
(replace-regexp-in-string regexp newtext str t t))
#+END_SRC