From e261f184b5017477d56872916f3fb3df18ce84a3 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 15:16:46 -0700 Subject: [PATCH 01/29] Fix docstring warnings, part one. Fix warnings of the form: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting) --- lisp/jabber-alert.el | 6 +++--- lisp/jabber-chatstates.el | 8 ++++---- lisp/jabber-conn.el | 4 ++-- lisp/jabber-disco.el | 4 ++-- lisp/jabber-feature-neg.el | 4 ++-- lisp/jabber-presence.el | 2 +- lisp/jabber-register.el | 2 +- lisp/jabber-widget.el | 4 ++-- lisp/jabber-xml.el | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index 6edb80c..c2fea24 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -148,7 +148,7 @@ All hooks refrain from action if this function returns nil." "Hooks run when an info request is completed. First argument is WHAT, a symbol telling the kind of info request completed. -That might be 'roster, for requested roster updates, and 'browse, for +That might be \=’roster, for requested roster updates, and \=’browse, for browse requests. Second argument in BUFFER, a buffer containing the result. Third argument is PROPOSED-ALERT, containing the string returned by `jabber-alert-info-message-function' for these arguments." @@ -239,7 +239,7 @@ lambda form or a quoted function name. The created functions are inserted as options in Customize. Examples: -\(define-jabber-alert foo \"Send foo alert\" 'foo-message) +\(define-jabber-alert foo \"Send foo alert\" \='foo-message) \(define-jabber-alert bar \"Send bar alert\" (lambda (msg) (bar msg 42)))" (let ((sn (symbol-name name))) @@ -373,7 +373,7 @@ Examples: "Return a string with the status change if OLDSTATUS and NEWSTATUS differs. Return nil if OLDSTATUS and NEWSTATUS are equal, and in other -cases a string of the form \"'name' (jid) is now NEWSTATUS (STATUSTEXT)\". +cases a string of the form \"\='name\=' (jid) is now NEWSTATUS (STATUSTEXT)\". This function is not called directly, but is the default for `jabber-alert-presence-message-function'." diff --git a/lisp/jabber-chatstates.el b/lisp/jabber-chatstates.el index eb4a479..ec1bccb 100644 --- a/lisp/jabber-chatstates.el +++ b/lisp/jabber-chatstates.el @@ -85,22 +85,22 @@ It can be sent and cancelled several times.") (make-variable-buffer-local 'jabber-chatstates-composing-sent) (defvar jabber-chatstates-paused-timer nil - "Timer that counts down from 'composing state to 'paused.") + "Timer that counts down from \='composing state to \='paused.") (make-variable-buffer-local 'jabber-chatstates-paused-timer) (defun jabber-chatstates-stop-timer () - "Stop the 'paused timer." + "Stop the \='paused timer." (when jabber-chatstates-paused-timer (cancel-timer jabber-chatstates-paused-timer))) (defun jabber-chatstates-kick-timer () - "Start (or restart) the 'paused timer as approriate." + "Start (or restart) the \='paused timer as approriate." (jabber-chatstates-stop-timer) (setq jabber-chatstates-paused-timer (run-with-timer 5 nil 'jabber-chatstates-send-paused))) (defun jabber-chatstates-send-paused () - "Send an 'paused state notification." + "Send an \='paused state notification." (when (and jabber-chatstates-requested jabber-chatting-with) (setq jabber-chatstates-composing-sent nil) (jabber-send-sexp-if-connected diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index 13fad16..99a13d9 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -65,8 +65,8 @@ See `jabber-connect-methods'.") (defcustom jabber-connection-ssl-program nil "Program used for SSL/TLS connections. nil means prefer gnutls but fall back to openssl. -'gnutls' means use gnutls (through `open-tls-stream'). -'openssl means use openssl (through `open-ssl-stream')." +‘gnutls’ means use gnutls (through `open-tls-stream'). +‘openssl’ means use openssl (through `open-ssl-stream')." :type '(choice (const :tag "Prefer gnutls, fall back to openssl" nil) (const :tag "Use gnutls" gnutls) (const :tag "Use openssl" openssl)) diff --git a/lisp/jabber-disco.el b/lisp/jabber-disco.el index 059904f..39b1294 100644 --- a/lisp/jabber-disco.el +++ b/lisp/jabber-disco.el @@ -528,7 +528,7 @@ Call CALLBACK with JC and CLOSURE-DATA as first and second arguments and result as third argument when result is available. On success, result is (IDENTITIES FEATURES), where each identity is [\"name\" \"category\" \"type\"], and each feature is a string. -On error, result is the error node, recognizable by (eq (car result) 'error). +On error, result is the error node, recognizable by (eq (car result) \='error). If CALLBACK is nil, just fetch data. If FORCE is non-nil, invalidate cache and get fresh data." @@ -592,7 +592,7 @@ arguments and items result as third argument when result is available. On success, result is a list of items, where each item is [\"name\" \"jid\" \"node\"] (some values may be nil). -On error, result is the error node, recognizable by (eq (car result) 'error). +On error, result is the error node, recognizable by (eq (car result) \='error). If CALLBACK is nil, just fetch data. If FORCE is non-nil, invalidate cache and get fresh data." diff --git a/lisp/jabber-feature-neg.el b/lisp/jabber-feature-neg.el index 60ff019..e9bb473 100644 --- a/lisp/jabber-feature-neg.el +++ b/lisp/jabber-feature-neg.el @@ -29,7 +29,7 @@ XML-DATA should have one child element, , in the jabber:x:data namespace. -TYPE is either 'request or 'response. +TYPE is either \='request or \='response. Returned alist has field name as key, and value is a list of offered alternatives." @@ -65,7 +65,7 @@ alternatives." "Transform a feature alist into an node int the jabber:x:data namespace. Note that this is not the reverse of `jabber-fn-parse'. -TYPE is either 'request or 'response." +TYPE is either \='request or \='response." (let ((requestp (eq type 'request))) `(x ((xmlns . "jabber:x:data") (type . ,(if requestp "form" "submit"))) diff --git a/lisp/jabber-presence.el b/lisp/jabber-presence.el index cc3a5d7..3137813 100644 --- a/lisp/jabber-presence.el +++ b/lisp/jabber-presence.el @@ -39,7 +39,7 @@ stanza.") (cons "jabber:iq:roster" (function (lambda (jc x) (jabber-process-roster jc x nil))))) (defun jabber-process-roster (jc xml-data closure-data) "Process an incoming roster infoquery result. -CLOSURE-DATA should be 'initial if initial roster push, nil otherwise. +CLOSURE-DATA should be \='initial if initial roster push, nil otherwise. JC is the Jabber connection. XML-DATA is the parsed tree data from the stream (stanzas) obtained from `xml-parse-region'." diff --git a/lisp/jabber-register.el b/lisp/jabber-register.el index df42461..4cb5431 100644 --- a/lisp/jabber-register.el +++ b/lisp/jabber-register.el @@ -124,7 +124,7 @@ obtained from `xml-parse-region'." (defun jabber-process-register-secondtime (jc xml-data closure-data) "Receive registration success or failure. -CLOSURE-DATA is either 'success or 'error. +CLOSURE-DATA is either \='success or \='error. JC is the Jabber connection. XML-DATA is the parsed tree data from the stream (stanzas) diff --git a/lisp/jabber-widget.el b/lisp/jabber-widget.el index 3fe7c85..3c2720d 100644 --- a/lisp/jabber-widget.el +++ b/lisp/jabber-widget.el @@ -30,8 +30,8 @@ (defvar jabber-form-type nil "Type of form. One of: -'x-data, jabber:x:data -'register, as used in jabber:iq:register and jabber:iq:search.") +\='x-data, jabber:x:data +\='register, as used in jabber:iq:register and jabber:iq:search.") (defvar jabber-submit-to nil "JID of the entity to which form data is to be sent.") diff --git a/lisp/jabber-xml.el b/lisp/jabber-xml.el index 7e4ec7f..e6e0ff7 100644 --- a/lisp/jabber-xml.el +++ b/lisp/jabber-xml.el @@ -106,7 +106,7 @@ SEXP should be in the form: (defun jabber-xml-skip-tag-forward (&optional dont-recurse-into-stream) "Skip to end of tag or matching closing tag if present. -Return t iff after a closing tag, otherwise throws an 'unfinished +Return t iff after a closing tag, otherwise throws an \='unfinished tag with value nil. If DONT-RECURSE-INTO-STREAM is non-nil, stop after an opening tag. From 5274064b62ca83120d0932dc06c46f55e6031f15 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 15:30:25 -0700 Subject: [PATCH 02/29] Fix docstring warnings, part two. Fix warnings of the form: Warning: [...] docstring wider than 80 characters --- lisp/jabber-activity.el | 4 +++- lisp/jabber-httpupload.el | 4 ++-- lisp/jabber-libnotify.el | 4 +++- lisp/jabber-wmii.el | 7 +++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/jabber-activity.el b/lisp/jabber-activity.el index 6d44d6c..523ae0d 100644 --- a/lisp/jabber-activity.el +++ b/lisp/jabber-activity.el @@ -224,7 +224,9 @@ all strings still are unique and at least (get-buffer (jabber-muc-get-buffer jid)))) (defun jabber-activity-show-p-default (jid) - "Return non-nil if there is an invisible buffer for JID, and JID is not in `jabber-activity-banned'." + "Return non-nil if JID should be hidden. +A JID should be hidden when there is an invisible buffer for JID, +and JID is not in `jabber-activity-banned'." (let ((buffer (jabber-activity-find-buffer-name jid))) (and (buffer-live-p buffer) (not (get-buffer-window buffer 'visible)) diff --git a/lisp/jabber-httpupload.el b/lisp/jabber-httpupload.el index 1fac626..26c4841 100644 --- a/lisp/jabber-httpupload.el +++ b/lisp/jabber-httpupload.el @@ -58,8 +58,8 @@ (defcustom jabber-httpupload-upload-function #'jabber-httpupload-put-file-curl "The function used to upload the file. - Some functions calls external programs such as Curl and wget, please check their - documentation for more information." +Some functions calls external programs such as Curl and wget, +please check their documentation for more information." :group 'jabber-httpupload :type 'function) diff --git a/lisp/jabber-libnotify.el b/lisp/jabber-libnotify.el index 03499bd..1521d12 100644 --- a/lisp/jabber-libnotify.el +++ b/lisp/jabber-libnotify.el @@ -49,7 +49,9 @@ :group 'jabber-alerts) (defcustom jabber-libnotify-method (if (featurep 'dbus) 'dbus 'shell) - "Specifies the method for libnotify call. Dbus is more faster but require emacs23+" + "Specifies the method for libnotify call. +Dbus is faster but require emacs23+, use shell as a fallback." + ;; TODO: why the distinction now that jabber.el requires Emacs version 27.1? :type '(choice (const :tag "Shell" shell) (const :tag "D-Bus" dbus)) :group 'jabber-alerts) diff --git a/lisp/jabber-wmii.el b/lisp/jabber-wmii.el index fb84bd3..b73c0b1 100644 --- a/lisp/jabber-wmii.el +++ b/lisp/jabber-wmii.el @@ -21,10 +21,13 @@ (eval-when-compile (require 'jabber-alert)) (defvar jabber-wmii-color "#ffffff #335577 #447799" - "Color specification as needed by the wmii window manager for the jabber alert messages.") + "Color specification for the wmii window manager. +This color specification is used for presenting alert messages.") (defvar jabber-wmii-reset-time "20 sec" - "If non-nil time to reset wmii message. If nil the message has to be cleared by other means, i.e. from wmiirc.") + "Duration of alert message presentation. +If non-nil, duration of wmii message visibility. +If nil the message has to be cleared by other means, i.e. from wmiirc.") (defvar jabber-wmii-timer nil "Timer to clear wmii message.") From 4200030491916b81f63f6f94cf66080ce36a3132 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sat, 24 Jun 2023 20:12:31 -0700 Subject: [PATCH 03/29] Resolve "Unused lexical argument" warnings. --- lisp/jabber-activity.el | 6 ++--- lisp/jabber-alert.el | 42 +++++++++++++++--------------- lisp/jabber-autoaway.el | 2 +- lisp/jabber-carbons.el | 4 +-- lisp/jabber-chat.el | 6 ++--- lisp/jabber-chatstates.el | 4 +-- lisp/jabber-disco.el | 4 +-- lisp/jabber-events.el | 2 +- lisp/jabber-gmail.el | 2 +- lisp/jabber-history.el | 2 +- lisp/jabber-keepalive.el | 6 ++--- lisp/jabber-muc-nick-completion.el | 2 +- lisp/jabber-muc.el | 10 +++---- lisp/jabber-notifications.el | 2 +- lisp/jabber-ping.el | 2 +- lisp/jabber-presence.el | 6 ++--- lisp/jabber-register.el | 4 +-- lisp/jabber-rtt.el | 2 +- lisp/jabber-search.el | 4 +-- lisp/jabber-time.el | 6 ++--- lisp/jabber-truncate.el | 4 +-- lisp/jabber-vcard-avatars.el | 2 +- lisp/jabber-vcard.el | 6 ++--- lisp/jabber-version.el | 2 +- lisp/jabber-watch.el | 2 +- lisp/jabber-widget.el | 4 +-- 26 files changed, 69 insertions(+), 69 deletions(-) diff --git a/lisp/jabber-activity.el b/lisp/jabber-activity.el index 523ae0d..e9a0e60 100644 --- a/lisp/jabber-activity.el +++ b/lisp/jabber-activity.el @@ -305,14 +305,14 @@ Optional PRESENCE mean personal presence request or alert." (ignore-errors (jabber-activity-mode-line-update))) -(defun jabber-activity-add (from buffer text proposed-alert) +(defun jabber-activity-add (from _buffer _text _proposed-alert) "Add a JID to mode line when `jabber-activity-show-p'." (when (funcall jabber-activity-show-p from) (add-to-list 'jabber-activity-jids from) (add-to-list 'jabber-activity-personal-jids from) (jabber-activity-mode-line-update))) -(defun jabber-activity-add-muc (nick group buffer text proposed-alert) +(defun jabber-activity-add-muc (_nick group _buffer text _proposed-alert) "Add a JID to mode line when `jabber-activity-show-p'." (when (funcall jabber-activity-show-p group) (add-to-list 'jabber-activity-jids group) @@ -320,7 +320,7 @@ Optional PRESENCE mean personal presence request or alert." (add-to-list 'jabber-activity-personal-jids group)) (jabber-activity-mode-line-update))) -(defun jabber-activity-presence (who oldstatus newstatus statustext proposed-alert) +(defun jabber-activity-presence (who _oldstatus newstatus _statustext _proposed-alert) "Add a JID to mode line on subscription requests." (when (string= newstatus "subscribe") (add-to-list 'jabber-activity-jids (symbol-name who)) diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index c2fea24..645fe39 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -248,22 +248,22 @@ Examples: (pres (intern (format "jabber-presence-%s" sn))) (info (intern (format "jabber-info-%s" sn)))) `(progn - (defun ,msg (from buffer text title) + (defun ,msg (_from _buffer text title) ,docstring (when title (funcall ,function text title))) (cl-pushnew (quote ,msg) (get 'jabber-alert-message-hooks 'custom-options)) - (defun ,muc (nick group buffer text title) + (defun ,muc (_nick _group _buffer text title) ,docstring (when title (funcall ,function text title))) (cl-pushnew (quote ,muc) (get 'jabber-alert-muc-hooks 'custom-options)) - (defun ,pres (who oldstatus newstatus statustext title) + (defun ,pres (_who _oldstatus _newstatus statustext title) ,docstring (when title (funcall ,function statustext title))) (cl-pushnew (quote ,pres) (get 'jabber-alert-presence-hooks 'custom-options)) - (defun ,info (infotype buffer text) + (defun ,info (_infotype _buffer text) ,docstring (when text (funcall ,function text))) @@ -276,7 +276,7 @@ Examples: (lambda (&rest _ignore) (beep))) ;; Message alert hooks -(defun jabber-message-default-message (from buffer text) +(defun jabber-message-default-message (from buffer _text) (when (or jabber-message-alert-same-buffer (not (memq (selected-window) (get-buffer-window-list buffer)))) (if (jabber-muc-sender-p from) @@ -295,7 +295,7 @@ Examples: :type 'boolean :group 'jabber-alerts) -(defun jabber-message-wave (from buffer text title) +(defun jabber-message-wave (from _buffer _text title) "Play the wave file specified in `jabber-alert-message-wave'." (when title (let* ((case-fold-search t) @@ -307,17 +307,17 @@ Examples: (unless (equal sound-file "") (funcall jabber-play-sound-file sound-file))))) -(defun jabber-message-display (from buffer text title) +(defun jabber-message-display (_from buffer _text title) "Display the buffer where a new message has arrived." (when title (display-buffer buffer))) -(defun jabber-message-switch (from buffer text title) +(defun jabber-message-switch (_from buffer _text title) "Switch to the buffer where a new message has arrived." (when title (switch-to-buffer buffer))) -(defun jabber-message-scroll (from buffer text title) +(defun jabber-message-scroll (_from buffer _text _title) "Scroll all nonselected windows where the chat buffer is displayed." ;; jabber-chat-buffer-display will DTRT with point in the buffer. ;; But this change will not take effect in nonselected windows. @@ -339,7 +339,7 @@ Examples: (set-window-point w new-point-max))))) ;; MUC alert hooks -(defun jabber-muc-default-message (nick group buffer text) +(defun jabber-muc-default-message (nick group buffer _text) (when (or jabber-message-alert-same-buffer (not (memq (selected-window) (get-buffer-window-list buffer)))) (if nick @@ -349,27 +349,27 @@ Examples: group))) (format "Message in %s" (jabber-jid-displayname group))))) -(defun jabber-muc-wave (nick group buffer text title) +(defun jabber-muc-wave (_nick _group _buffer _text title) "Play the wave file specified in `jabber-alert-muc-wave'." (when title (funcall jabber-play-sound-file jabber-alert-muc-wave))) -(defun jabber-muc-display (nick group buffer text title) +(defun jabber-muc-display (_nick _group buffer _text title) "Display the buffer where a new message has arrived." (when title (display-buffer buffer))) -(defun jabber-muc-switch (nick group buffer text title) +(defun jabber-muc-switch (_nick _group buffer _text title) "Switch to the buffer where a new message has arrived." (when title (switch-to-buffer buffer))) -(defun jabber-muc-scroll (nick group buffer text title) +(defun jabber-muc-scroll (_nick _group buffer _text _title) "Scroll buffer even if it is in an unselected window." (jabber-message-scroll nil buffer nil nil)) ;; Presence alert hooks -(defun jabber-presence-default-message (who oldstatus newstatus statustext) +(defun jabber-presence-default-message (who oldstatus newstatus _statustext) "Return a string with the status change if OLDSTATUS and NEWSTATUS differs. Return nil if OLDSTATUS and NEWSTATUS are equal, and in other @@ -410,7 +410,7 @@ This function is not called directly, but can be used as the value for (when (get-buffer (jabber-chat-get-buffer (jabber-xml-get-attribute xml-data 'from))) (jabber-presence-default-message who oldstatus newstatus statustext))) -(defun jabber-presence-wave (who oldstatus newstatus statustext proposed-alert) +(defun jabber-presence-wave (who _oldstatus _newstatus _statustext proposed-alert) "Play the wave file specified in `jabber-alert-presence-wave'." (when proposed-alert (let* ((case-fold-search t) @@ -427,12 +427,12 @@ This function is not called directly, but can be used as the value for ;; "Update the roster display by calling `jabber-display-roster'" ;; (jabber-display-roster)) -(defun jabber-presence-display (who oldstatus newstatus statustext proposed-alert) +(defun jabber-presence-display (_who _oldstatus _newstatus _statustext proposed-alert) "Display the roster buffer." (when proposed-alert (display-buffer jabber-roster-buffer))) -(defun jabber-presence-switch (who oldstatus newstatus statustext proposed-alert) +(defun jabber-presence-switch (_who _oldstatus _newstatus _statustext proposed-alert) "Switch to the roster buffer." (when proposed-alert (switch-to-buffer jabber-roster-buffer))) @@ -447,17 +447,17 @@ This function uses `jabber-info-message-alist' to find a message." (concat (cdr (assq infotype jabber-info-message-alist)) " (buffer "(buffer-name buffer) ")")) -(defun jabber-info-wave (infotype buffer proposed-alert) +(defun jabber-info-wave (_infotype _buffer proposed-alert) "Play the wave file specified in `jabber-alert-info-wave'." (if proposed-alert (funcall jabber-play-sound-file jabber-alert-info-wave))) -(defun jabber-info-display (infotype buffer proposed-alert) +(defun jabber-info-display (_infotype buffer proposed-alert) "Display buffer of completed request." (when proposed-alert (display-buffer buffer))) -(defun jabber-info-switch (infotype buffer proposed-alert) +(defun jabber-info-switch (_infotype buffer proposed-alert) "Switch to buffer of completed request." (when proposed-alert (switch-to-buffer buffer))) diff --git a/lisp/jabber-autoaway.el b/lisp/jabber-autoaway.el index f9b52d2..12eae2b 100644 --- a/lisp/jabber-autoaway.el +++ b/lisp/jabber-autoaway.el @@ -102,7 +102,7 @@ This is used to detect whether the user has become unidle.") (apply #'message args))) ;;;###autoload -(defun jabber-autoaway-start (&optional ignored) +(defun jabber-autoaway-start (&optional _ignored) "Start autoaway timer. The IGNORED argument is there so you can put this function in `jabber-post-connect-hooks'." diff --git a/lisp/jabber-carbons.el b/lisp/jabber-carbons.el index d4258c1..a3fc0ba 100644 --- a/lisp/jabber-carbons.el +++ b/lisp/jabber-carbons.el @@ -5,12 +5,12 @@ ;;; Code: -(defun jabber-carbon-success (jc xml-data context) +(defun jabber-carbon-success (_jc xml-data _context) (when (equal "result" (jabber-xml-get-attribute xml-data 'type)) (message "Carbons feature successfully enabled for %s" (jabber-connection-jid jc)))) -(defun jabber-carbon-failure (jc xml-data context) +(defun jabber-carbon-failure (_jc xml-data _context) (message "Carbons feature could not be enabled: %S" xml-data)) (add-to-list 'jabber-jid-service-menu diff --git a/lisp/jabber-chat.el b/lisp/jabber-chat.el index da3b8e0..6e6be8e 100644 --- a/lisp/jabber-chat.el +++ b/lisp/jabber-chat.el @@ -570,7 +570,7 @@ obtained from `xml-parse-region'." (concat "Error: " (jabber-parse-error the-error)) 'face 'jabber-chat-error)))) -(defun jabber-chat-print-subject (xml-data who mode) +(defun jabber-chat-print-subject (xml-data _who mode) "Print subject of given , if any. XML-DATA is the parsed tree data from the stream (stanzas) @@ -626,7 +626,7 @@ obtained from `xml-parse-region'." ((:local :muc-local) 'jabber-chat-text-local)))))) t))) -(defun jabber-chat-print-url (xml-data who mode) +(defun jabber-chat-print-url (xml-data _who mode) "Print URLs provided in jabber:x:oob namespace. XML-DATA is the parsed tree data from the stream (stanzas) @@ -648,7 +648,7 @@ obtained from `xml-parse-region'." (format "%s <%s>" desc url)))))) foundp)) -(defun jabber-chat-goto-address (xml-data who mode) +(defun jabber-chat-goto-address (_xml-data _who mode) "Call `goto-address' on the newly written text. XML-DATA is the parsed tree data from the stream (stanzas) diff --git a/lisp/jabber-chatstates.el b/lisp/jabber-chatstates.el index ec1bccb..8ad6a50 100644 --- a/lisp/jabber-chatstates.el +++ b/lisp/jabber-chatstates.el @@ -64,7 +64,7 @@ nil - don't send states") ""))) (add-hook 'jabber-chat-send-hooks 'jabber-chatstates-when-sending) -(defun jabber-chatstates-when-sending (text id) +(defun jabber-chatstates-when-sending (_text _id) (jabber-chatstates-update-message) (jabber-chatstates-stop-timer) (when (and jabber-chatstates-confirm jabber-chatstates-requested) @@ -128,7 +128,7 @@ It can be sent and cancelled several times.") ;;; COMMON -(defun jabber-handle-incoming-message-chatstates (jc xml-data) +(defun jabber-handle-incoming-message-chatstates (_jc xml-data) (when (get-buffer (jabber-chat-get-buffer (jabber-xml-get-attribute xml-data 'from))) (with-current-buffer (jabber-chat-get-buffer (jabber-xml-get-attribute xml-data 'from)) (cond diff --git a/lisp/jabber-disco.el b/lisp/jabber-disco.el index 39b1294..64d82c0 100644 --- a/lisp/jabber-disco.el +++ b/lisp/jabber-disco.el @@ -142,7 +142,7 @@ obtained from `xml-parse-region'." ;; The hash is incorrect. (jabber-caps-try-next jc hash node ver))))) -(defun jabber-process-caps-info-error (jc xml-data closure-data) +(defun jabber-process-caps-info-error (jc _xml-data closure-data) (cl-destructuring-bind (hash node ver) closure-data (jabber-caps-try-next jc hash node ver))) @@ -409,7 +409,7 @@ obtained from `xml-parse-region'." ;; No such node (jabber-signal-error "Cancel" 'item-not-found)))) -(defun jabber-disco-return-client-info (&optional jc xml-data) +(defun jabber-disco-return-client-info (&optional _jc _xml-data) `( ;; If running under a window system, this is ;; a GUI client. If not, it is a console client. diff --git a/lisp/jabber-events.el b/lisp/jabber-events.el index c12649f..8234790 100644 --- a/lisp/jabber-events.el +++ b/lisp/jabber-events.el @@ -66,7 +66,7 @@ probably reading the message).") " (typing a message)")))) (add-hook 'jabber-chat-send-hooks 'jabber-events-when-sending) -(defun jabber-events-when-sending (text id) +(defun jabber-events-when-sending (_text _id) (setq jabber-events-arrived nil) (jabber-events-update-message) `((x ((xmlns . "jabber:x:event")) diff --git a/lisp/jabber-gmail.el b/lisp/jabber-gmail.el index 5b8f472..2cc2528 100644 --- a/lisp/jabber-gmail.el +++ b/lisp/jabber-gmail.el @@ -81,7 +81,7 @@ See http://code.google.com/apis/talk/jep_extensions/gmail.html#requestmail" #'jabber-gmail-process-mailbox nil #'jabber-process-data "Gmail query" "gmail-query")) -(defun jabber-gmail-process-mailbox (jc xml-sexp &rest ignore) +(defun jabber-gmail-process-mailbox (_jc xml-sexp &rest _ignore) "Process gmail query response. See http://code.google.com/apis/talk/jep_extensions/gmail.html#response" (let ((ts (jabber-xml-node-children diff --git a/lisp/jabber-history.el b/lisp/jabber-history.el index b1eb2db..ca3083c 100644 --- a/lisp/jabber-history.el +++ b/lisp/jabber-history.el @@ -143,7 +143,7 @@ obtained from `xml-parse-region'." (add-hook 'jabber-chat-send-hooks 'jabber-history-send-hook) -(defun jabber-history-send-hook (body id) +(defun jabber-history-send-hook (body _id) "Log outgoing message to log file." (when (and (not jabber-use-global-history) (not (file-directory-p jabber-history-dir))) diff --git a/lisp/jabber-keepalive.el b/lisp/jabber-keepalive.el index 94863ca..d1984bc 100644 --- a/lisp/jabber-keepalive.el +++ b/lisp/jabber-keepalive.el @@ -56,7 +56,7 @@ "Log keepalive traffic when non-nil.") ;;;###autoload -(defun jabber-keepalive-start (&optional jc) +(defun jabber-keepalive-start (&optional _jc) "Activate keepalive. That is, regularly send a ping request to the server, and disconnect it if it doesn't answer. See variable `jabber-keepalive-interval' @@ -97,7 +97,7 @@ for all accounts regardless of the argument." ;; Getting a response at all is. (jabber-ping-send c nil 'jabber-keepalive-got-response nil nil))) -(defun jabber-keepalive-got-response (jc &rest args) +(defun jabber-keepalive-got-response (jc &rest _args) (when jabber-keepalive-debug (message "%s: got keepalive response from %s" (current-time-string) @@ -142,7 +142,7 @@ If you want to verify that the server is able to answer, see "Timer object for whitespace pings.") ;;;###autoload -(defun jabber-whitespace-ping-start (&optional jc) +(defun jabber-whitespace-ping-start (&optional _jc) "Start sending whitespace pings at regular intervals. See `jabber-whitespace-ping-interval'. diff --git a/lisp/jabber-muc-nick-completion.el b/lisp/jabber-muc-nick-completion.el index b6642a3..95a94b6 100644 --- a/lisp/jabber-muc-nick-completion.el +++ b/lisp/jabber-muc-nick-completion.el @@ -96,7 +96,7 @@ Optional argument GROUP to look." (cons (cons group room-activity) *jabber-muc-participant-last-speaking*))))))) -(defun jabber-muc-track-message-time (nick group buffer text &optional title) +(defun jabber-muc-track-message-time (nick group _buffer text &optional _title) "Tracks time of NICK's last speaking in GROUP." (when nick (let ((time (float-time))) diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index 4eb8a3e..3499d40 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -477,7 +477,7 @@ obtained from `xml-parse-region'." (defalias 'jabber-groupchat-render-config 'jabber-muc-render-config "Deprecated. See `jabber-muc-render-config' instead.") -(defun jabber-muc-submit-config (&rest ignore) +(defun jabber-muc-submit-config (&rest _ignore) "Submit MUC configuration form." (jabber-send-iq jabber-buffer-connection jabber-submit-to @@ -490,7 +490,7 @@ obtained from `xml-parse-region'." (defalias 'jabber-groupchat-submit-config 'jabber-muc-submit-config "Deprecated. See `jabber-muc-submit-config' instead.") -(defun jabber-muc-cancel-config (&rest ignore) +(defun jabber-muc-cancel-config (&rest _ignore) "Cancel MUC configuration form." (jabber-send-iq jabber-buffer-connection jabber-submit-to @@ -788,7 +788,7 @@ JC is the Jabber connection." (add-to-list 'jabber-body-printers 'jabber-muc-print-invite) -(defun jabber-muc-print-invite (xml-data who mode) +(defun jabber-muc-print-invite (xml-data _who mode) "Print MUC invitation. XML-DATA is the parsed tree data from the stream (stanzas) @@ -907,7 +907,7 @@ include groupchat invites." (add-to-list 'jabber-jid-muc-menu (cons "Open private chat" 'jabber-muc-private)) -(defun jabber-muc-private (jc group nickname) +(defun jabber-muc-private (_jc group nickname) "Open private chat with NICKNAME in GROUP. JC is the Jabber connection." @@ -989,7 +989,7 @@ Return nil if X-MUC is nil." 'face 'jabber-chat-prompt-foreign 'help-echo (concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from " nick " in " jabber-group))))) -(defun jabber-muc-system-prompt (&rest ignore) +(defun jabber-muc-system-prompt (&rest _ignore) "Print system prompt for MUC." (insert (jabber-propertize (format-spec jabber-groupchat-prompt-format diff --git a/lisp/jabber-notifications.el b/lisp/jabber-notifications.el index c366c92..9c7e028 100644 --- a/lisp/jabber-notifications.el +++ b/lisp/jabber-notifications.el @@ -51,7 +51,7 @@ (const :tag "Critical" "critical")) :group 'jabber-alerts) - (defun jabber-message-notifications (from buffer text title) + (defun jabber-message-notifications (from _buffer text title) "Show a message through the notifications.el interface" (let ((body (or (jabber-escape-xml text) " ")) diff --git a/lisp/jabber-ping.el b/lisp/jabber-ping.el index 8a8ecfe..9582b0d 100644 --- a/lisp/jabber-ping.el +++ b/lisp/jabber-ping.el @@ -44,7 +44,7 @@ TO is full JID. All connected JIDs is used." (jabber-ping-send jc to 'jabber-silent-process-data 'jabber-process-ping "Ping is unsupported"))) ;; called by jabber-process-data -(defun jabber-process-ping (jc xml-data) +(defun jabber-process-ping (_jc xml-data) "Handle results from ping requests. JC is the Jabber connection. diff --git a/lisp/jabber-presence.el b/lisp/jabber-presence.el index 3137813..daf8d64 100644 --- a/lisp/jabber-presence.el +++ b/lisp/jabber-presence.el @@ -255,15 +255,15 @@ JC is the Jabber connection." (dolist (hook '(jabber-presence-hooks jabber-alert-presence-hooks)) (run-hook-with-args hook (jabber-jid-symbol from) nil "subscribe" presence-status (funcall jabber-alert-presence-message-function (jabber-jid-symbol from) nil "subscribe" presence-status))))) -(defun jabber-subscription-accept-mutual (&rest ignored) +(defun jabber-subscription-accept-mutual (&rest _ignored) (message "Subscription accepted; reciprocal subscription request sent") (jabber-subscription-reply "subscribed" "subscribe")) -(defun jabber-subscription-accept-one-way (&rest ignored) +(defun jabber-subscription-accept-one-way (&rest _ignored) (message "Subscription accepted") (jabber-subscription-reply "subscribed")) -(defun jabber-subscription-decline (&rest ignored) +(defun jabber-subscription-decline (&rest _ignored) (message "Subscription declined") (jabber-subscription-reply "unsubscribed")) diff --git a/lisp/jabber-register.el b/lisp/jabber-register.el index 4cb5431..cbf25b3 100644 --- a/lisp/jabber-register.el +++ b/lisp/jabber-register.el @@ -98,7 +98,7 @@ obtained from `xml-parse-region'." (widget-setup) (widget-minor-mode 1))) -(defun jabber-submit-register (&rest ignore) +(defun jabber-submit-register (&rest _ignore) "Submit registration input. See `jabber-process-register-or-search'." (let* ((registerp (plist-get (fsm-get-state-data jabber-buffer-connection) :registerp)) (handler (if registerp @@ -137,7 +137,7 @@ obtained from `xml-parse-region'." (sit-for 3) (jabber-disconnect-one jc)) -(defun jabber-remove-register (&rest ignore) +(defun jabber-remove-register (&rest _ignore) "Cancel registration. See `jabber-process-register-or-search'." (if (or jabber-silent-mode (yes-or-no-p (concat "Are you sure that you want to cancel your registration to " jabber-submit-to "? "))) diff --git a/lisp/jabber-rtt.el b/lisp/jabber-rtt.el index 3d26330..e4f8cd2 100644 --- a/lisp/jabber-rtt.el +++ b/lisp/jabber-rtt.el @@ -52,7 +52,7 @@ '(add-to-list 'jabber-message-chain #'jabber-rtt-handle-message t)) ;;;###autoload -(defun jabber-rtt-handle-message (jc xml-data) +(defun jabber-rtt-handle-message (_jc xml-data) ;; We could support this for MUC as well, if useful. (when (and (not (jabber-muc-message-p xml-data)) (get-buffer (jabber-chat-get-buffer (jabber-xml-get-attribute xml-data 'from)))) diff --git a/lisp/jabber-search.el b/lisp/jabber-search.el index f0c654e..5fb1d5f 100644 --- a/lisp/jabber-search.el +++ b/lisp/jabber-search.el @@ -42,7 +42,7 @@ JC is the Jabber connection." ;; `jabber-submit-search' is called when the "submit" button of the search ;; form is activated. -(defun jabber-submit-search (&rest ignore) +(defun jabber-submit-search (&rest _ignore) "Submit search. See `jabber-process-register-or-search'." (let ((text (concat "Search at " jabber-submit-to))) @@ -63,7 +63,7 @@ JC is the Jabber connection." (message "Search sent")) -(defun jabber-process-search-result (jc xml-data) +(defun jabber-process-search-result (_jc xml-data) "Receive and display search results. JC is the Jabber connection. diff --git a/lisp/jabber-time.el b/lisp/jabber-time.el index 1e7f17f..57a3d10 100644 --- a/lisp/jabber-time.el +++ b/lisp/jabber-time.el @@ -61,7 +61,7 @@ obtained from `xml-parse-region'." 'jabber-silent-process-data "Time request failed")) ;; called by jabber-process-data -(defun jabber-process-time (jc xml-data) +(defun jabber-process-time (_jc xml-data) "Handle results from urn:xmpp:time requests. JC is the Jabber Connection. @@ -79,7 +79,7 @@ obtained from `xml-parse-region'." (format "%s has time: %s %s" from (format-time-string "%Y-%m-%d %T" (jabber-parse-time utc)) tzo)))) -(defun jabber-process-legacy-time (jc xml-data) +(defun jabber-process-legacy-time (_jc xml-data) "Handle results from jabber:iq:time requests. JC is the Jabber connection. @@ -136,7 +136,7 @@ JC is the Jabber connection." #'jabber-silent-process-data #'jabber-process-last #'jabber-silent-process-data "Idle time request failed")) -(defun jabber-process-last (jc xml-data) +(defun jabber-process-last (_jc xml-data) "Handle results from jabber:iq:last requests. JC is the Jabber connection. diff --git a/lisp/jabber-truncate.el b/lisp/jabber-truncate.el index 76421a7..cf3e71c 100644 --- a/lisp/jabber-truncate.el +++ b/lisp/jabber-truncate.el @@ -54,13 +54,13 @@ get it, and then it just gets deleted." (ewoc-prev work-ewoc delete-before) (ewoc-delete work-ewoc delete-before)))))) -(defun jabber-truncate-muc (nick group buffer text proposed-alert) +(defun jabber-truncate-muc (_nick _group buffer _text _proposed-alert) "Clean old history from MUC buffers. `jabber-log-lines-to-keep' specifies the number of lines to keep." (jabber-truncate-top buffer)) -(defun jabber-truncate-chat (from buffer text proposed-alert) +(defun jabber-truncate-chat (_from buffer _text _proposed-alert) "Clean old history from chat buffers. `jabber-log-lines-to-keep' specifies the number of lines to keep. diff --git a/lisp/jabber-vcard-avatars.el b/lisp/jabber-vcard-avatars.el index 6809ea2..4caca09 100644 --- a/lisp/jabber-vcard-avatars.el +++ b/lisp/jabber-vcard-avatars.el @@ -81,7 +81,7 @@ JC is the Jabber connection." #'jabber-vcard-avatars-vcard (cons jid sha1-hash) #'ignore nil)) -(defun jabber-vcard-avatars-vcard (jc iq closure) +(defun jabber-vcard-avatars-vcard (_jc iq closure) "Get the photo from the vCard, and set the avatar." (let ((from (car closure)) (sha1-hash (cdr closure)) diff --git a/lisp/jabber-vcard.el b/lisp/jabber-vcard.el index e9ce5a4..daf003c 100644 --- a/lisp/jabber-vcard.el +++ b/lisp/jabber-vcard.el @@ -330,7 +330,7 @@ JC is the Jabber connection." (PCODE . "Post code") (CTRY . "Country"))) -(defun jabber-vcard-display (jc xml-data) +(defun jabber-vcard-display (_jc xml-data) "Display received vcard. JC is the Jabber connection. @@ -409,7 +409,7 @@ obtained from `xml-parse-region'." (insert "\n")) (error (insert "Couldn't display photo\n"))))))) -(defun jabber-vcard-do-edit (jc xml-data closure-data) +(defun jabber-vcard-do-edit (jc xml-data _closure-data) (let ((parsed (jabber-vcard-parse (jabber-iq-query xml-data))) start-position) (with-current-buffer (get-buffer-create "Edit vcard") @@ -539,7 +539,7 @@ obtained from `xml-parse-region'." (switch-to-buffer (current-buffer)) (goto-char start-position)))) -(defun jabber-vcard-submit (&rest ignore) +(defun jabber-vcard-submit (&rest _ignore) (let ((to-publish (jabber-vcard-reassemble (mapcar (lambda (entry) (cons (car entry) (widget-value (cdr entry)))) diff --git a/lisp/jabber-version.el b/lisp/jabber-version.el index a577d2c..69e9e45 100644 --- a/lisp/jabber-version.el +++ b/lisp/jabber-version.el @@ -44,7 +44,7 @@ JC is the Jabber connection." #'jabber-process-data "Version request failed")) ;; called by jabber-process-data -(defun jabber-process-version (jc xml-data) +(defun jabber-process-version (_jc xml-data) "Handle results from jabber:iq:version requests. JC is the Jabber connection. diff --git a/lisp/jabber-watch.el b/lisp/jabber-watch.el index c208940..cb6f5e1 100644 --- a/lisp/jabber-watch.el +++ b/lisp/jabber-watch.el @@ -30,7 +30,7 @@ when they come online, with comment strings as values." :group 'jabber-watch) (defun jabber-presence-watch (who oldstatus newstatus - statustext proposed-alert) + _statustext proposed-alert) "Send a message if one of your extra-important buddies comes online. The buddies are stored in `jabber-watch-alist' and are added and removed by calling `jabber-watch-add' and `jabber-watch-remove'." diff --git a/lisp/jabber-widget.el b/lisp/jabber-widget.el index 3c2720d..fe778d3 100644 --- a/lisp/jabber-widget.el +++ b/lisp/jabber-widget.el @@ -40,12 +40,12 @@ One of: (define-widget 'jid 'string "JID widget." - :value-to-internal (lambda (widget value) + :value-to-internal (lambda (_widget value) (let ((displayname (jabber-jid-rostername value))) (if displayname (format "%s <%s>" displayname value) value))) - :value-to-external (lambda (widget value) + :value-to-external (lambda (_widget value) (if (string-match "<\\([^>]+\\)>[ \t]*$" value) (match-string 1 value) value)) From 0058f2fc11114429706a020a11a7f8809a5672c9 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 2 Jul 2023 16:05:27 -0700 Subject: [PATCH 04/29] Resolve "Unused lexical argument" warnings. --- lisp/jabber-carbons.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/jabber-carbons.el b/lisp/jabber-carbons.el index a3fc0ba..722d5f8 100644 --- a/lisp/jabber-carbons.el +++ b/lisp/jabber-carbons.el @@ -5,7 +5,7 @@ ;;; Code: -(defun jabber-carbon-success (_jc xml-data _context) +(defun jabber-carbon-success (jc xml-data _context) (when (equal "result" (jabber-xml-get-attribute xml-data 'type)) (message "Carbons feature successfully enabled for %s" (jabber-connection-jid jc)))) From c18ea14b67cc4a359581cb962802ac31ada4af17 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sat, 24 Jun 2023 20:46:09 -0700 Subject: [PATCH 05/29] Resolve "Unused lexical variable" warnings. Most of this looks like refactoring eliminated references to these lexical variables. The rest looks like "this was planned, but not implemented." --- lisp/jabber-activity.el | 2 +- lisp/jabber-ahc.el | 3 +-- lisp/jabber-avatar.el | 3 +-- lisp/jabber-awesome.el | 5 ++--- lisp/jabber-bookmarks.el | 4 ++-- lisp/jabber-disco.el | 2 +- lisp/jabber-festival.el | 2 +- lisp/jabber-iq.el | 4 +--- lisp/jabber-libnotify.el | 2 +- lisp/jabber-muc.el | 29 ++++++++++++++--------------- lisp/jabber-notifications.el | 4 ---- lisp/jabber-presence.el | 1 - lisp/jabber-ratpoison.el | 2 +- lisp/jabber-roster.el | 21 +-------------------- lisp/jabber-search.el | 2 +- lisp/jabber-time.el | 3 +-- lisp/jabber-widget.el | 2 -- lisp/jabber-wmii.el | 4 ++-- 18 files changed, 31 insertions(+), 64 deletions(-) diff --git a/lisp/jabber-activity.el b/lisp/jabber-activity.el index e9a0e60..ec3e200 100644 --- a/lisp/jabber-activity.el +++ b/lisp/jabber-activity.el @@ -201,7 +201,7 @@ all strings still are unique and at least #'(lambda (x) (cons x (funcall jabber-activity-make-string x))) jids) #'(lambda (x y) (string-lessp (cdr x) (cdr y)))))) - (cl-loop for ((prev-jid . prev) (cur-jid . cur) (next-jid . next)) + (cl-loop for ((_prev-jid . prev) (cur-jid . cur) (_next-jid . next)) on (cons nil alist) until (null cur) collect diff --git a/lisp/jabber-ahc.el b/lisp/jabber-ahc.el index c487491..3839cc0 100644 --- a/lisp/jabber-ahc.el +++ b/lisp/jabber-ahc.el @@ -89,8 +89,7 @@ obtained from `xml-parse-region'." (let ((node (car command)) (plist (cdr command))) (let ((acl (plist-get plist 'acl)) - (name (plist-get plist 'name)) - (func (plist-get plist 'func))) + (name (plist-get plist 'name))) (when (or (not (functionp acl)) (funcall acl jc jid)) `(item ((name . ,name) diff --git a/lisp/jabber-avatar.el b/lisp/jabber-avatar.el index 41fc241..27ae40c 100644 --- a/lisp/jabber-avatar.el +++ b/lisp/jabber-avatar.el @@ -122,7 +122,7 @@ If MIME-TYPE is not specified, try to find it from the image data." (jpeg "image/jpeg") (gif "image/gif"))))))) (jabber-avatar-compute-size - (make-avatar :mime-type mime-type :sha1-sum sha1-sum :base64-data base64-data :bytes bytes)))) + (make-avatar :mime-type type :sha1-sum sha1-sum :base64-data base64-data :bytes bytes)))) ;; XXX: This function is based on an outdated version of XEP-0084. ;; (defun jabber-avatar-from-data-node (data-node) @@ -175,7 +175,6 @@ If there is no cached image, return nil." "Cache the AVATAR." (let* ((id (avatar-sha1-sum avatar)) (base64-data (avatar-base64-data avatar)) - (mime-type (avatar-mime-type avatar)) (filename (expand-file-name id jabber-avatar-cache-directory))) (unless (file-directory-p jabber-avatar-cache-directory) (make-directory jabber-avatar-cache-directory t)) diff --git a/lisp/jabber-awesome.el b/lisp/jabber-awesome.el index bfff865..dd313cc 100644 --- a/lisp/jabber-awesome.el +++ b/lisp/jabber-awesome.el @@ -28,11 +28,10 @@ (defun jabber-awesome-message (text &optional title) "Show MSG in Awesome" ;; Possible errors include not finding the awesome binary. - (condition-case e + (condition-case _e (let ((process-connection-type)) (shell-command-to-string (format "echo 'naughty.notify({text = \"%s\" %s})' | awesome-client -" - (or title text) jabber-awesome-args)) - ) + (or title text) jabber-awesome-args))) (error nil))) (define-jabber-alert awesome "Show a message through the Awesome window manager" diff --git a/lisp/jabber-bookmarks.el b/lisp/jabber-bookmarks.el index 7f50881..c0930c4 100644 --- a/lisp/jabber-bookmarks.el +++ b/lisp/jabber-bookmarks.el @@ -197,11 +197,11 @@ JC is the Jabber connection." (lambda (entry) (cl-case (car entry) (url - (cl-destructuring-bind (symbol url name) entry + (cl-destructuring-bind (_symbol url name) entry `(url ((url . ,url) (name . ,name))))) (conference - (cl-destructuring-bind (symbol jid name autojoin nick password) + (cl-destructuring-bind (_symbol jid name autojoin nick password) entry `(conference ((jid . ,jid) (name . ,name) diff --git a/lisp/jabber-disco.el b/lisp/jabber-disco.el index 64d82c0..9969f4e 100644 --- a/lisp/jabber-disco.el +++ b/lisp/jabber-disco.el @@ -73,7 +73,7 @@ obtained from `xml-parse-region'." (c (jabber-xml-path xml-data '(("http://jabber.org/protocol/caps" . "c"))))) (when (and (null type) c) (jabber-xml-let-attributes - (ext hash node ver) c + (_ext hash node ver) c (cond (hash ;; If the element has a hash attribute, it follows the diff --git a/lisp/jabber-festival.el b/lisp/jabber-festival.el index 88032c9..d96d733 100644 --- a/lisp/jabber-festival.el +++ b/lisp/jabber-festival.el @@ -21,7 +21,7 @@ (eval-when-compile (require 'jabber-alert)) -(condition-case e +(condition-case _e (progn ;; Most people don't have Festival, so this will often fail (require 'festival) diff --git a/lisp/jabber-iq.el b/lisp/jabber-iq.el index ac2b5f0..c4ee6c9 100644 --- a/lisp/jabber-iq.el +++ b/lisp/jabber-iq.el @@ -176,9 +176,7 @@ See section 9.3 of XMPP Core." JC is the Jabber connection. XML-DATA is the parsed tree data from the stream (stanzas) obtained from `xml-parse-region'." - (let ((from (or (jabber-xml-get-attribute xml-data 'from) (plist-get (fsm-get-state-data jc) :server))) - (xmlns (jabber-iq-xmlns xml-data)) - (type (jabber-xml-get-attribute xml-data 'type))) + (let ((from (or (jabber-xml-get-attribute xml-data 'from) (plist-get (fsm-get-state-data jc) :server)))) (with-current-buffer (get-buffer-create (format-spec jabber-browse-buffer-format (list (cons ?n from)))) (if (not (eq major-mode 'jabber-browse-mode)) diff --git a/lisp/jabber-libnotify.el b/lisp/jabber-libnotify.el index 1521d12..8072e0a 100644 --- a/lisp/jabber-libnotify.el +++ b/lisp/jabber-libnotify.el @@ -71,7 +71,7 @@ Dbus is faster but require emacs23+, use shell as a fallback." (or jabber-libnotify-message-header " ") text)))) ;; Possible errors include not finding the notify-send binary. - (condition-case e + (condition-case _e (cond ((eq jabber-libnotify-method 'shell) (let ((process-connection-type nil)) diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index 3499d40..7e5d6d5 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -857,21 +857,20 @@ obtained from `xml-parse-region'." JC is the Jabber connection." (interactive (list (jabber-read-account))) - (let ((nickname (plist-get (fsm-get-state-data jc) :username))) - (when (bound-and-true-p jabber-muc-autojoin) - (dolist (group jabber-muc-autojoin) - (jabber-muc-join jc group (or - (cdr (assoc group jabber-muc-default-nicknames)) - (plist-get (fsm-get-state-data jc) :username))))) - (jabber-get-bookmarks - jc - (lambda (jc bookmarks) - (dolist (bookmark bookmarks) - (setq bookmark (jabber-parse-conference-bookmark bookmark)) - (when (and bookmark (plist-get bookmark :autojoin)) - (jabber-muc-join jc (plist-get bookmark :jid) - (or (plist-get bookmark :nick) - (plist-get (fsm-get-state-data jc) :username))))))))) + (when (bound-and-true-p jabber-muc-autojoin) + (dolist (group jabber-muc-autojoin) + (jabber-muc-join jc group (or + (cdr (assoc group jabber-muc-default-nicknames)) + (plist-get (fsm-get-state-data jc) :username))))) + (jabber-get-bookmarks + jc + (lambda (jc bookmarks) + (dolist (bookmark bookmarks) + (setq bookmark (jabber-parse-conference-bookmark bookmark)) + (when (and bookmark (plist-get bookmark :autojoin)) + (jabber-muc-join jc (plist-get bookmark :jid) + (or (plist-get bookmark :nick) + (plist-get (fsm-get-state-data jc) :username)))))))) ;;;###autoload (defun jabber-muc-message-p (message) diff --git a/lisp/jabber-notifications.el b/lisp/jabber-notifications.el index 9c7e028..7028c66 100644 --- a/lisp/jabber-notifications.el +++ b/lisp/jabber-notifications.el @@ -55,10 +55,6 @@ "Show a message through the notifications.el interface" (let ((body (or (jabber-escape-xml text) " ")) - (head (jabber-escape-xml - (or title - (or jabber-notifications-message-header " ") - text))) (avatar-hash (get (jabber-jid-symbol from) 'avatar-hash))) (notifications-notify :title title diff --git a/lisp/jabber-presence.el b/lisp/jabber-presence.el index daf8d64..8effc7e 100644 --- a/lisp/jabber-presence.el +++ b/lisp/jabber-presence.el @@ -146,7 +146,6 @@ obtained from `xml-parse-region'." ;; XXX: use JC argument (let ((roster (plist-get (fsm-get-state-data jc) :roster)) (from (jabber-xml-get-attribute xml-data 'from)) - (to (jabber-xml-get-attribute xml-data 'to)) (type (jabber-xml-get-attribute xml-data 'type)) (presence-show (car (jabber-xml-node-children (car (jabber-xml-get-children xml-data 'show))))) diff --git a/lisp/jabber-ratpoison.el b/lisp/jabber-ratpoison.el index 489734a..f843d44 100644 --- a/lisp/jabber-ratpoison.el +++ b/lisp/jabber-ratpoison.el @@ -23,7 +23,7 @@ (defun jabber-ratpoison-message (text &optional title) "Show MSG in Ratpoison" ;; Possible errors include not finding the ratpoison binary. - (condition-case e + (condition-case _e (let ((process-connection-type)) (call-process "ratpoison" nil 0 nil "-c" (concat "echo " (or title text)))) (error nil))) diff --git a/lisp/jabber-roster.el b/lisp/jabber-roster.el index 8fbca10..8eef1fa 100644 --- a/lisp/jabber-roster.el +++ b/lisp/jabber-roster.el @@ -728,26 +728,7 @@ three being lists of JID symbols. JC is the Jabber connection." (let* ((roster (plist-get (fsm-get-state-data jc) :roster)) (hash (plist-get (fsm-get-state-data jc) :roster-hash)) - (ewoc (plist-get (fsm-get-state-data jc) :roster-ewoc)) - (all-groups (plist-get (fsm-get-state-data jc) :roster-groups)) - (terminator - (lambda (deleted-items) - (dolist (delete-this deleted-items) - (let ((groups (get delete-this 'groups)) - (terminator - (lambda (g) - (let* - ((group (or g jabber-roster-default-group-name)) - (buddies (gethash group hash))) - (when (not buddies) - (setq new-groups (append new-groups (list group)))) - (puthash group - (delq delete-this buddies) - hash))))) - (if groups - (dolist (group groups) - (terminator group)) - (terminator groups))))))) + (all-groups (plist-get (fsm-get-state-data jc) :roster-groups))) ;; fix a old-roster (dolist (delete-this deleted-items) diff --git a/lisp/jabber-search.el b/lisp/jabber-search.el index 5fb1d5f..e8fac6d 100644 --- a/lisp/jabber-search.el +++ b/lisp/jabber-search.el @@ -74,7 +74,7 @@ obtained from `xml-parse-region'." ;; which is not necessarily the case. (let ((query (jabber-iq-query xml-data)) (have-xdata nil) - xdata fields (jid-fields 0)) + xdata fields) ;; First, check for results in jabber:x:data form. (dolist (x (jabber-xml-get-children query 'x)) diff --git a/lisp/jabber-time.el b/lisp/jabber-time.el index 57a3d10..1b932fb 100644 --- a/lisp/jabber-time.el +++ b/lisp/jabber-time.el @@ -144,8 +144,7 @@ XML-DATA is the parsed tree data from the stream (stanzas) obtained from `xml-parse-region'." (let* ((from (jabber-xml-get-attribute xml-data 'from)) (query (jabber-iq-query xml-data)) - (seconds (jabber-xml-get-attribute query 'seconds)) - (message (car (jabber-xml-node-children query)))) + (seconds (jabber-xml-get-attribute query 'seconds))) (cond ((jabber-jid-resource from) ;; Full JID: idle time diff --git a/lisp/jabber-widget.el b/lisp/jabber-widget.el index fe778d3..7f39943 100644 --- a/lisp/jabber-widget.el +++ b/lisp/jabber-widget.el @@ -173,7 +173,6 @@ DEFAULTS takes precedence over values specified in the form." (let* ((var (jabber-xml-get-attribute field 'var)) (label (jabber-xml-get-attribute field 'label)) (type (jabber-xml-get-attribute field 'type)) - (required (jabber-xml-get-children field 'required)) (values (jabber-xml-get-children field 'value)) (options (jabber-xml-get-children field 'option)) (desc (car (jabber-xml-get-children field 'desc))) @@ -342,7 +341,6 @@ Return a list of strings, each of which to be included as cdata in a "Render single-record search results." (dolist (field (jabber-xml-get-children xdata 'field)) (let ((label (jabber-xml-get-attribute field 'label)) - (type (jabber-xml-get-attribute field 'type)) (values (mapcar #'(lambda (val) (car (jabber-xml-node-children val))) (jabber-xml-get-children field 'value)))) diff --git a/lisp/jabber-wmii.el b/lisp/jabber-wmii.el index b73c0b1..b377db3 100644 --- a/lisp/jabber-wmii.el +++ b/lisp/jabber-wmii.el @@ -34,7 +34,7 @@ If nil the message has to be cleared by other means, i.e. from wmiirc.") (defun jabber-wmii-clear () "Clear any previous message output through wmii window manager." - (condition-case e + (condition-case _e (call-process "wmiir" nil nil nil "remove" "/rbar/jabber") (error nil))) @@ -47,7 +47,7 @@ If nil the message has to be cleared by other means, i.e. from wmiirc.") (insert jabber-wmii-color " " (or title text))) ;; Possible errors include not finding the wmiir binary, and ;; too many pipes open because of message flood. - (condition-case e + (condition-case _e (call-process "wmiir" tmp nil nil "create" "/rbar/jabber") (error nil)) (delete-file tmp)) From 43f6c991ef0bf88c4f8754e3e2b1c6e867525417 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sat, 24 Jun 2023 21:32:48 -0700 Subject: [PATCH 06/29] Resolve most "free variable" warnings. These assignments/references to "free variables" can be fixed with simple declarations. This leaves two other "free variable" references that require more than a simple declaration. Those will be fixed in subsequent commits. --- jabber.texi | 1 - lisp/jabber-activity.el | 4 ++++ lisp/jabber-alert.el | 7 +++++++ lisp/jabber-autoaway.el | 19 ++++++++++++++----- lisp/jabber-conn.el | 7 +++++++ lisp/jabber-core.el | 12 ++++++++++-- lisp/jabber-roster.el | 3 +-- lisp/jabber-search.el | 1 - 8 files changed, 43 insertions(+), 11 deletions(-) diff --git a/jabber.texi b/jabber.texi index f7f3b88..2bb21ef 100644 --- a/jabber.texi +++ b/jabber.texi @@ -1153,7 +1153,6 @@ interface and do other useful things. @cindex autoaway @cindex idle @cindex xprintidle -@vindex jabber-autoaway-method @vindex jabber-autoaway-methods @findex jabber-current-idle-time @findex jabber-xprintidle-program diff --git a/lisp/jabber-activity.el b/lisp/jabber-activity.el index ec3e200..2b8d4c9 100644 --- a/lisp/jabber-activity.el +++ b/lisp/jabber-activity.el @@ -163,6 +163,10 @@ It is called after `jabber-activity-mode-string' and (put 'jabber-activity-mode-string 'risky-local-variable t) (put 'jabber-activity-count-string 'risky-local-variable t) +;; Global reference declarations + +(defvar jabber-silent-mode) ; jabber.el + (defun jabber-activity-make-string-default (jid) "Return the nick of the JID. If no nick is available, return the user name part of the JID. In diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index 645fe39..5811835 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -224,6 +224,13 @@ files." :type 'function :group 'jabber-alerts) +;; Global reference declarations + +(defvar jabber-presence-strings) ; jabber.el +(defvar jabber-xml-data) ; jabber.el + +;; + (defmacro define-jabber-alert (name docstring function) "Define a new family of external alert hooks. Use this macro when your hooks do nothing except displaying a string diff --git a/lisp/jabber-autoaway.el b/lisp/jabber-autoaway.el index 12eae2b..b1f830c 100644 --- a/lisp/jabber-autoaway.el +++ b/lisp/jabber-autoaway.el @@ -29,11 +29,9 @@ :group 'jabber) (defcustom jabber-autoaway-methods - (if (fboundp 'jabber-autoaway-method) - (list jabber-autoaway-method) - (list 'jabber-current-idle-time - 'jabber-xprintidle-get-idle-time - 'jabber-termatime-get-idle-time)) + (list 'jabber-current-idle-time + 'jabber-xprintidle-get-idle-time + 'jabber-termatime-get-idle-time) "Methods used to keep track of idleness. This is a list of functions that takes no arguments, and returns the number of seconds since the user was active, or nil on error." @@ -97,6 +95,17 @@ information about priority." "Seconds of idle time the last time we checked. This is used to detect whether the user has become unidle.") +;; Global reference declarations + +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-show*) ; jabber.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar jabber-default-show) ; jabber.el +(defvar jabber-default-priority) ; jabber.el +(defvar jabber-default-status) ; jabber.el + +;; + (defun jabber-autoaway-message (&rest args) (when jabber-autoaway-verbose (apply #'message args))) diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index 99a13d9..60e4dd7 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -98,6 +98,13 @@ First item is the symbol naming the method. Second item is the connect function. Third item is the send function.") +;; Global reference declarations + +(defvar jabber-process-buffer) ; jabber.el +(defvar jabber-debug-keep-process-buffers) ; jabber.el + +;; + (defun jabber-get-connect-function (type) "Get the connect function associated with TYPE. TYPE is a symbol; see `jabber-connection-type'." diff --git a/lisp/jabber-core.el b/lisp/jabber-core.el index 87ab7f7..bfa505d 100644 --- a/lisp/jabber-core.el +++ b/lisp/jabber-core.el @@ -152,6 +152,14 @@ problems." ;; jabber-connect and jabber-connect-all should load jabber.el, not ;; just jabber-core.el, when autoloaded. +;; Global reference declarations + +(defvar jabber-debug-keep-process-buffers) ; jabber.el +(defvar jabber-silent-mode) ; jabber.el +(defvar jabber-account-list) ; jabber.el + +;; + ;;;###autoload (autoload 'jabber-connect-all "jabber" "Connect to all configured Jabber accounts.\nSee `jabber-account-list'.\nIf no accounts are configured (or ARG supplied), call `jabber-connect' interactively." t) (defun jabber-connect-all (&optional arg) "Connect to all configured Jabber accounts. @@ -162,8 +170,8 @@ With many prefix arguments, one less is passed to `jabber-connect'." (interactive "P") (let ((accounts (cl-remove-if (lambda (account) - (cdr (assq :disabled (cdr account)))) - jabber-account-list))) + (cdr (assq :disabled (cdr account)))) + jabber-account-list))) (if (or (null accounts) arg) (let ((current-prefix-arg (cond diff --git a/lisp/jabber-roster.el b/lisp/jabber-roster.el index 8eef1fa..afabd79 100644 --- a/lisp/jabber-roster.el +++ b/lisp/jabber-roster.el @@ -583,8 +583,7 @@ H Toggle displaying this text (plist-get (fsm-get-state-data jc) :server)) 'face 'jabber-title-medium) "\n__________________________________\n") - "__________________________________")) - (new-groups '())) + "__________________________________"))) (plist-put(fsm-get-state-data jc) :roster-ewoc ewoc) (dolist (group (plist-get (fsm-get-state-data jc) :roster-groups)) (let* ((group-name (car group)) diff --git a/lisp/jabber-search.el b/lisp/jabber-search.el index e8fac6d..1d72311 100644 --- a/lisp/jabber-search.el +++ b/lisp/jabber-search.el @@ -92,7 +92,6 @@ obtained from `xml-parse-region'." (nick . (label "Nickname" column 30)) (jid . (label "JID" column 45)) (email . (label "E-mail" column 65)))) - (setq jid-fields 1) (dolist (field-cons fields) (indent-to (plist-get (cdr field-cons) 'column) 1) From d5c780effa30f30bf598075e6c027f9e2aa21ea7 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 20 Nov 2022 23:55:23 -0800 Subject: [PATCH 07/29] =?UTF-8?q?Resolve=20reference=20to=20free=20variabl?= =?UTF-8?q?e=20=E2=80=98widget=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The widget library has apparently changed. The referenced template (widget-color-complete - mentioned in comments) no longer exists. There is still support for ‘:complete-function’ in ‘widget-default-completions’. But since it ‘:complete-function’ invokes the function argument with ’call-interactive’, the widget parameter cannot be passed. This used to work due to dynamic binding. But with lexical binding this will no longer work. Better to use ‘:complete’ which is invoked (non-interactively) and is passed a ‘widget’ parameter, --- lisp/jabber-widget.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/jabber-widget.el b/lisp/jabber-widget.el index 7f39943..f7e0f75 100644 --- a/lisp/jabber-widget.el +++ b/lisp/jabber-widget.el @@ -49,11 +49,10 @@ One of: (if (string-match "<\\([^>]+\\)>[ \t]*$" value) (match-string 1 value) value)) - :complete-function 'jid-complete) + :complete 'jid-complete) -(defun jid-complete () +(defun jid-complete (widget) "Perform completion on JID preceding point." - (interactive) ;; mostly stolen from widget-color-complete (let* ((prefix (buffer-substring-no-properties (widget-field-start widget) (point))) From bd41c45d5891166c18d48789af63ba600cabeee7 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 00:13:03 -0700 Subject: [PATCH 08/29] =?UTF-8?q?Resolve=20reference=20to=20free=20variabl?= =?UTF-8?q?e=20=E2=80=98xml-data=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vestige of dynamic binding. ‘jabber-presence-only-chat-open-message’ depends on access to the input message XML payload. This function is not even bound by default. The documentation suggests ‘jabber-presence-only-chat-open-message’ can be used as an alternative value for `jabber-alert-presence-message-function'. The alternative resolution to the free variable reference, passing ‘xml-data’ as a parameter, turned into a holy mess producing a diff with 51 insertions and 35 deletions. That was a mess. Seems prudent to simply dynamic bind that one variable explicitly; even if it is unclean that anyone uses ‘jabber-presence-only-chat-open-message’. --- lisp/jabber-alert.el | 2 +- lisp/jabber-core.el | 3 ++- lisp/jabber.el | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index 5811835..d2af720 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -414,7 +414,7 @@ at a more manageable level when there are lots of users. This function is not called directly, but can be used as the value for `jabber-alert-presence-message-function'." - (when (get-buffer (jabber-chat-get-buffer (jabber-xml-get-attribute xml-data 'from))) + (when (get-buffer (jabber-chat-get-buffer (jabber-xml-get-attribute jabber-xml-data 'from))) (jabber-presence-default-message who oldstatus newstatus statustext))) (defun jabber-presence-wave (who _oldstatus _newstatus _statustext proposed-alert) diff --git a/lisp/jabber-core.el b/lisp/jabber-core.el index bfa505d..16dd5dc 100644 --- a/lisp/jabber-core.el +++ b/lisp/jabber-core.el @@ -945,7 +945,8 @@ DATA is any sexp." JC is the Jabber connection. XML-DATA is the parsed tree data from the stream (stanzas) obtained from `xml-parse-region'." - (let* ((tag (jabber-xml-node-name xml-data)) + (let* ((jabber-xml-data xml-data) + (tag (jabber-xml-node-name xml-data)) (functions (eval (cdr (assq tag '((iq . jabber-iq-chain) (presence . jabber-presence-chain) (message . jabber-message-chain))))))) diff --git a/lisp/jabber.el b/lisp/jabber.el index b3f9eda..07b34cf 100644 --- a/lisp/jabber.el +++ b/lisp/jabber.el @@ -54,6 +54,10 @@ (defvar jabber-process-buffer " *-jabber-process-*" "The name of the process buffer.") +;; Shared between jabber-core.el and jabber-alert.el + +(defvar jabber-xml-data nil "") + (defcustom jabber-debug-keep-process-buffers nil "If nil, kill process buffers when the process dies. Contents of process buffers might be useful for debugging." From 6dd1c5105a4e0a0cce377d69210328df674be5d0 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 22:20:56 -0700 Subject: [PATCH 09/29] =?UTF-8?q?Fix=20missing=20type=20parameter=20for=20?= =?UTF-8?q?=E2=80=98defcustom=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning in jabber-autoaway.el: Warning: defcustom for ‘jabber-autoaway-methods’ fails to specify type --- lisp/jabber-autoaway.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/jabber-autoaway.el b/lisp/jabber-autoaway.el index b1f830c..6cd6551 100644 --- a/lisp/jabber-autoaway.el +++ b/lisp/jabber-autoaway.el @@ -35,6 +35,7 @@ "Methods used to keep track of idleness. This is a list of functions that takes no arguments, and returns the number of seconds since the user was active, or nil on error." + :type 'hook :group 'jabber-autoaway :options '(jabber-current-idle-time jabber-xprintidle-get-idle-time From f16d416a14173747f46d929517d66515169c5903 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 22:08:04 -0700 Subject: [PATCH 10/29] =?UTF-8?q?Ues=20keywords=20for=20=E2=80=98define-mi?= =?UTF-8?q?nor-mode=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning in jabber-rtt.el: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode' --- lisp/jabber-rtt.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/jabber-rtt.el b/lisp/jabber-rtt.el index e4f8cd2..d780d62 100644 --- a/lisp/jabber-rtt.el +++ b/lisp/jabber-rtt.el @@ -198,7 +198,9 @@ This lets the recipient see every change made to the message up until it's sent. The recipient's client needs to implement XEP-0301, In-Band Real Time Text." - nil " Real-Time" nil + :init-value nil + :lighter " Real-Time" + :keymap nil (if (null jabber-rtt-send-mode) (progn (remove-hook 'after-change-functions #'jabber-rtt--queue-update t) From b1098171c94ea95c15135957be7e015807ca0bf2 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 22:10:05 -0700 Subject: [PATCH 11/29] =?UTF-8?q?Fix=20"Use=20=E2=80=98with-current-buffer?= =?UTF-8?q?=E2=80=99"=20warning.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In jabber-truncate.el: Warning: Use ‘with-current-buffer’ rather than save-excursion+set-buffer --- lisp/jabber-truncate.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/jabber-truncate.el b/lisp/jabber-truncate.el index cf3e71c..6826ec2 100644 --- a/lisp/jabber-truncate.el +++ b/lisp/jabber-truncate.el @@ -43,8 +43,7 @@ get it, and then it just gets deleted." (ewoc-prev work-ewoc (ewoc-locate work-ewoc - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (goto-char (point-max)) (forward-line (- jabber-log-lines-to-keep)) (point)))))) From 992ee8b1362a299884f1c431d73c2d7bcfa3eb5e Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 21:05:09 -0700 Subject: [PATCH 12/29] =?UTF-8?q?Fix=20"obsolute=20function=20=E2=80=98poi?= =?UTF-8?q?nt-at-bol=E2=80=99".?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In jabber-chat-buffer-fill-long-lines: Warning: ‘point-at-bol’ is an obsolete function (as of 29.1) use ‘line-beginning-position’ or ‘pos-bol’ instead. --- lisp/jabber-chatbuffer.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/jabber-chatbuffer.el b/lisp/jabber-chatbuffer.el index 9603f56..c3c4b93 100644 --- a/lisp/jabber-chatbuffer.el +++ b/lisp/jabber-chatbuffer.el @@ -130,7 +130,7 @@ JC is the Jabber connection." (when (>= (current-column) (min fill-column width)) (save-restriction (narrow-to-region (min (1+ (point)) (point-max)) - (point-at-bol)) + (line-beginning-position)) (let ((goback (point-marker))) (fill-paragraph nil) (goto-char (marker-position goback))))) From 9005cb46e05a7fcf40ae8f661bad698e983473e2 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 20:52:08 -0700 Subject: [PATCH 13/29] Fix "function not known to be defined" warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the two warnings in jabber-notifications.el: Warning: the function ‘cmp’ is not known to be defined. Warning: the function ‘fetch-time’ is not known to be defined. --- lisp/jabber-muc-nick-completion.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/jabber-muc-nick-completion.el b/lisp/jabber-muc-nick-completion.el index 95a94b6..669f044 100644 --- a/lisp/jabber-muc-nick-completion.el +++ b/lisp/jabber-muc-nick-completion.el @@ -107,19 +107,18 @@ Optional argument GROUP to look." (+ time jabber-muc-personal-message-bonus) time))))) - (defun jabber-sort-nicks (nicks group) - "Return list of NICKS in GROUP, sorted." - (cl-letf* ((times (cdr (assoc group *jabber-muc-participant-last-speaking*))) - ((symbol-function 'fetch-time) (lambda (nick) (or (assoc nick times) - (cons nick 0)))) - ((symbol-function 'cmp) (lambda (nt1 nt2) - (let ((t1 (cdr nt1)) - (t2 (cdr nt2))) - (if (and (zerop t1) (zerop t2)) - (string< (car nt1) - (car nt2)) - (> t1 t2)))))) - (mapcar #'car (sort (mapcar #'fetch-time nicks) #'cmp)))) +(defun jabber-sort-nicks (nicks group) + "Return list of NICKS in GROUP, sorted." + (let ((times (cdr (assoc group *jabber-muc-participant-last-speaking*)))) + (cl-flet ((fetch-time (nick) (or (assoc nick times) (cons nick 0))) + (cmp (nt1 nt2) + (let ((t1 (cdr nt1)) + (t2 (cdr nt2))) + (if (and (zerop t1) (zerop t2)) + (string< (car nt1) + (car nt2)) + (> t1 t2))))) + (mapcar #'car (sort (mapcar #'fetch-time nicks) #'cmp))))) (defun jabber-muc-beginning-of-line () "Return position of line begining." From 518137c389f23350d30b350cf0a22db842e061f4 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 20:55:14 -0700 Subject: [PATCH 14/29] Fix "mapcar called for effect" warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In jabber-muc.el: Warning: ‘mapcar’ called for effect; use ‘mapc’ or ‘dolist’ instead --- lisp/jabber-muc.el | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index 7e5d6d5..81e2c21 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -662,17 +662,16 @@ JC is the Jabber connection." (defun jabber-muc-print-names (participants) "Format and return data in PARTICIPANTS." (let ((mlist) (plist) (vlist) (nlist)) - (mapcar (lambda (x) - (let ((role (plist-get (cdr x) 'role))) - (cond ((string= role "moderator") - (add-to-list 'mlist x)) - ((string= role "participant") - (add-to-list 'plist x)) - ((string= role "visitor") - (add-to-list 'vlist x)) - ((string= role "none") - (add-to-list 'nlist x))))) - participants) + (dolist (participant participants) + (let ((role (plist-get (cdr participant) 'role))) + (cond ((string= role "moderator") + (push participant mlist)) + ((string= role "participant") + (push participant plist)) + ((string= role "visitor") + (push participant vlist)) + ((string= role "none") + (push participant nlist))))) (concat (apply 'concat "\nModerators:\n" (mapcar 'jabber-muc-format-names mlist)) (apply 'concat "\nParticipants:\n" (mapcar 'jabber-muc-format-names plist)) From 93cedecc51f6091409a269996c2d8d8140b1cba4 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 21:01:49 -0700 Subject: [PATCH 15/29] =?UTF-8?q?Fix=20"global/dynamic=20var=20=E2=80=98pr?= =?UTF-8?q?inters=E2=80=99=20lacks=20a=20prefix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In jabber-muc.el: Warning: global/dynamic var ‘printers’ lacks a prefix Promote ‘printers’ to a hook function. Even though it is only used in ‘jabber-muc-process-message’, add it as a top form ‘defvar’. --- lisp/jabber-muc.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index 81e2c21..607fe00 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -63,6 +63,8 @@ Values are lists of nickname strings.") (defvar jabber-muc-nickname-history () "Keeps track of previously referred-to nicknames.") +(defvar jabber-muc-print-hook nil "List of MUC alert hooks.") + (defcustom jabber-muc-default-nicknames nil "Default nickname for specific MUC rooms." :group 'jabber-chat @@ -1007,7 +1009,6 @@ Return nil if X-MUC is nil." JC is the Jabber connection." (when (jabber-muc-message-p xml-data) - (defvar printers nil) (let* ((from (jabber-xml-get-attribute xml-data 'from)) (group (jabber-jid-user from)) (nick (jabber-jid-resource from)) @@ -1018,16 +1019,16 @@ JC is the Jabber connection." :muc-local) (t :muc-foreign))) (body-text (car (jabber-xml-node-children - (car (jabber-xml-get-children - xml-data 'body))))) + (car (jabber-xml-get-children + xml-data 'body))))) - (printers (append jabber-muc-printers jabber-chat-printers))) + (jabber-muc-print-hook (append jabber-muc-printers jabber-chat-printers))) (with-current-buffer (jabber-muc-create-buffer jc group) (jabber-muc-snarf-topic xml-data) ;; Call alert hooks only when something is output (when (or error-p - (run-hook-with-args-until-success 'printers xml-data type :printp)) + (run-hook-with-args-until-success 'jabber-muc-print-hook xml-data type :printp)) (jabber-maybe-print-rare-time (ewoc-enter-last jabber-chat-ewoc (list type xml-data :time (current-time)))) From c7596f0f20e72bdc90ebaa965335b4a68393647b Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 21:17:52 -0700 Subject: [PATCH 16/29] Revert emacs-version 24.1 dependency. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix "reference to free variable" warnings in jabber-notifications.el: Warning: reference to free variable ‘jabber-notifications-icon’ Warning: reference to free variable ‘jabber-notifications-app’ Warning: reference to free variable ‘jabber-notifications-timeout’ The warnings are due to the conditional 'require for 'jabber-alert. Since ‘jabber.el’ no claims: Package-Requires: (... (emacs "27.1") ...) checking for (string< emacs-version "24.1") is counter productive. --- lisp/jabber-notifications.el | 115 ++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/lisp/jabber-notifications.el b/lisp/jabber-notifications.el index 7028c66..74089c6 100644 --- a/lisp/jabber-notifications.el +++ b/lisp/jabber-notifications.el @@ -21,66 +21,67 @@ ;; Built on jabber-libnotify.el. (eval-when-compile (require 'jabber-alert)) -(unless (string< emacs-version "24.1") ;notifications.el preset since Emacs 24.1 - (require 'notifications) - - (defcustom jabber-notifications-icon "" - "Icon to be used on the notification pop-up. Default is empty" - :type '(file :must-match t) - :group 'jabber-alerts) - - (defcustom jabber-notifications-timeout nil - "Specifies the timeout of the pop up window in millisecond" - :type 'integer - :group 'jabber-alerts) - - (defcustom jabber-notifications-message-header "Jabber message" - "Defines the header of the pop up." - :type 'string - :group 'jabber-alerts) - - (defcustom jabber-notifications-app "Emacs Jabber" - "Defines the app of the pop up." - :type 'string - :group 'jabber-alerts) - - (defcustom jabber-notifications-urgency "low" - "Urgency of message" - :type '(choice (const :tag "Low" "low") - (const :tag "Normal" "normal") - (const :tag "Critical" "critical")) - :group 'jabber-alerts) - - (defun jabber-message-notifications (from _buffer text title) - "Show a message through the notifications.el interface" - (let - ((body (or (jabber-escape-xml text) " ")) - (avatar-hash (get (jabber-jid-symbol from) 'avatar-hash))) - (notifications-notify - :title title - :body body - :app-icon (or (and avatar-hash (jabber-avatar-find-cached avatar-hash)) - jabber-notifications-icon) - :app-name jabber-notifications-app - :category "jabber.message" - :timeout jabber-notifications-timeout))) - - (defun jabber-muc-notifications (nick group buffer text title) - "Show MUC message through the notifications.el interface" - (jabber-message-notifications group buffer (if nick (format "%s: %s" nick text) text) title) - ) - - (defun jabber-muc-notifications-personal (nick group buffer text title) - "Show personal MUC message through the notifications.el interface" - (if (jabber-muc-looks-like-personal-p text group) - (jabber-muc-notifications nick group buffer text title)) - ) + +(require 'notifications) + +(defcustom jabber-notifications-icon "" + "Icon to be used on the notification pop-up. Default is empty" + :type '(file :must-match t) + :group 'jabber-alerts) + +(defcustom jabber-notifications-timeout nil + "Specifies the timeout of the pop up window in millisecond" + :type 'integer + :group 'jabber-alerts) + +(defcustom jabber-notifications-message-header "Jabber message" + "Defines the header of the pop up." + :type 'string + :group 'jabber-alerts) + +(defcustom jabber-notifications-app "Emacs Jabber" + "Defines the app of the pop up." + :type 'string + :group 'jabber-alerts) + +(defcustom jabber-notifications-urgency "low" + "Urgency of message" + :type '(choice (const :tag "Low" "low") + (const :tag "Normal" "normal") + (const :tag "Critical" "critical")) + :group 'jabber-alerts) + +(defun jabber-message-notifications (from _buffer text title) + "Show a message through the notifications.el interface" + (let + ((body (or (jabber-escape-xml text) " ")) + (avatar-hash (get (jabber-jid-symbol from) 'avatar-hash))) + (notifications-notify + :title title + :body body + :app-icon (or (and avatar-hash (jabber-avatar-find-cached avatar-hash)) + jabber-notifications-icon) + :app-name jabber-notifications-app + :category "jabber.message" + :timeout jabber-notifications-timeout))) + +(defun jabber-muc-notifications (nick group buffer text title) + "Show MUC message through the notifications.el interface" + (jabber-message-notifications group buffer (if nick (format "%s: %s" nick text) text) title) + ) + +(defun jabber-muc-notifications-personal (nick group buffer text title) + "Show personal MUC message through the notifications.el interface" + (if (jabber-muc-looks-like-personal-p text group) + (jabber-muc-notifications nick group buffer text title)) + ) ;; jabber-*-notifications* requires "from" argument, so we cant use ;; define-jabber-alert/define-personal-jabber-alert here and do the ;; work by hand: - (cl-pushnew 'jabber-message-notifications (get 'jabber-alert-message-hooks 'custom-options)) - (cl-pushnew 'jabber-muc-notifications (get 'jabber-alert-muc-hooks 'custom-options)) - (cl-pushnew 'jabber-muc-notifications-personal (get 'jabber-alert-muc-hooks 'custom-options))) + +(cl-pushnew 'jabber-message-notifications (get 'jabber-alert-message-hooks 'custom-options)) +(cl-pushnew 'jabber-muc-notifications (get 'jabber-alert-muc-hooks 'custom-options)) +(cl-pushnew 'jabber-muc-notifications-personal (get 'jabber-alert-muc-hooks 'custom-options)) (provide 'jabber-notifications) From 8eaf220c585b4b49bd138f95cd38f8834f51bfaa Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 21:36:32 -0700 Subject: [PATCH 17/29] Remove reference to obsolete function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In jabber-avatar.el: Warning: ‘jabber-presence-update-roster’ is an obsolete function (as of 27.2); use ‘ignore’ instead. This function was marked obsolete in 2007, before Emacs 22. Seems safe to dispose if it now. --- lisp/jabber-avatar.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/jabber-avatar.el b/lisp/jabber-avatar.el index 27ae40c..1a3f1de 100644 --- a/lisp/jabber-avatar.el +++ b/lisp/jabber-avatar.el @@ -219,8 +219,7 @@ AVATAR may be one of: (unless (string= hash (get jid-symbol 'avatar-hash)) (put jid-symbol 'avatar (funcall image)) - (put jid-symbol 'avatar-hash hash) - (jabber-presence-update-roster jid-symbol)))) + (put jid-symbol 'avatar-hash hash)))) (defun jabber-create-image (file-or-data &optional type data-p) "Create an image from FILE-OR-DATA. From f8efbf5ae7320e9e19d636a2ee8e2f028c0cd188 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 25 Jun 2023 20:42:16 -0700 Subject: [PATCH 18/29] Disable partially implemented httpuploads feature. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a warning: Warning: the function ‘jabber-httpupload-record-sentinel’ is not known to be defined. The surrounding code is marked TODO. So it looks like implementation stalled. Disable the feature until someone can take a closer look. --- lisp/jabber-httpupload.el | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lisp/jabber-httpupload.el b/lisp/jabber-httpupload.el index 26c4841..b29bfb6 100644 --- a/lisp/jabber-httpupload.el +++ b/lisp/jabber-httpupload.el @@ -63,11 +63,12 @@ please check their documentation for more information." :group 'jabber-httpupload :type 'function) -(defcustom jabber-httpupload-record-command "sox -d -t ogg $(filename).ogg" - "What is the command used to record audio? -Use $(filename) where the temporal filename should be." - :group 'jabber-httpupload - :type 'function) +;; TODO Recording and sending audio +;; (defcustom jabber-httpupload-record-command "sox -d -t ogg $(filename).ogg" +;; "What is the command used to record audio? +;; Use $(filename) where the temporal filename should be." +;; :group 'jabber-httpupload +;; :type 'function) ;; Disco is used to discover if HTTP Upload is supported on the server ;; side. Two queries are used: @@ -562,18 +563,16 @@ EXTRA-DATA is a list `(jid)" (jabber-httpupload-ignore-certificate jc)) (error "Cannot upload the file. Error: %S" err)))) -;; ** TODO Recording and sending audio ** - -;; TODO -(defun jabber-httpupload--record-audio () - "Create a new audio record and save the file into a temporal directory." - (let ((process (start-process-shell-command - "jabber-httpupload-record-audio" - (current-buffer) - (replace-string "$(filename" - "/tmp/jabber-httpupload-record" - jabber-httpupload-record-command)))) - (set-process-sentinel process #'jabber-httpupload-record-sentinel))) +;; TODO Recording and sending audio ** +;; (defun jabber-httpupload--record-audio () +;; "Create a new audio record and save the file into a temporal directory." +;; (let ((process (start-process-shell-command +;; "jabber-httpupload-record-audio" +;; (current-buffer) +;; (replace-string "$(filename" +;; "/tmp/jabber-httpupload-record" +;; jabber-httpupload-record-command)))) +;; (set-process-sentinel process #'jabber-httpupload-record-sentinel))) ;; * Add hooks * ;; Some function should start automatically. From 47a8f7d4a174d337465f28f54d86ae8a65b67615 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Tue, 27 Jun 2023 15:43:42 -0700 Subject: [PATCH 19/29] =?UTF-8?q?Fix=20=E2=80=98define-package=E2=80=99=20?= =?UTF-8?q?unknown=20function=20warning.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jabber-pkg.el: Warning: the function ‘define-package’ is not known to be defined. --- jabber-pkg.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jabber-pkg.el b/jabber-pkg.el index 43067fa..b2a455b 100644 --- a/jabber-pkg.el +++ b/jabber-pkg.el @@ -1,4 +1,7 @@ ;; For ELPA: http://tromey.com/elpa/ + +(require 'package) + (define-package "jabber" "@PACKAGE_VERSION@" "A Jabber client for Emacs." '((fsm "0.2") (srv "0.2"))) From 437d62be205ad938f7766cf29c29883abe793460 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Mon, 3 Jul 2023 16:05:31 -0700 Subject: [PATCH 20/29] Fix variable/function warnings part one of three. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix variations of function not known to be defined or reference or assignment to free variable warnings. These messages arise from the native compiler, even on files that ‘byte-compile’ successfully. This first patch simply adds or removes ‘require’ functions to intern unresolved symbols. In some cases, remove ‘require’ functions to prevent circular dependencies. In particular, jabber-core, jabber-chat, and jabber-muc are significantly intertwined. So importing those in the wrong combination quickly leads to native compiler to throw errors related to circular dependencies. Refactoring ‘require’ functions leaves quite a few undeclared references. These will be fixed in the next two commits. The circular dependencies argues for a dependency graph and possible refactoring. But this is not that. Reducing the dependency graph to a DAC, though ideal, would require significant refactoring. --- lisp/jabber-activity.el | 3 +-- lisp/jabber-alert.el | 4 ++-- lisp/jabber-autoaway.el | 2 ++ lisp/jabber-avatar.el | 1 + lisp/jabber-bookmarks.el | 7 ++++++- lisp/jabber-browse.el | 1 + lisp/jabber-carbons.el | 6 ++++++ lisp/jabber-chat.el | 2 ++ lisp/jabber-chatbuffer.el | 2 ++ lisp/jabber-chatstates.el | 6 ++++++ lisp/jabber-compose.el | 6 ++++++ lisp/jabber-conn.el | 2 ++ lisp/jabber-console.el | 2 ++ lisp/jabber-core.el | 9 +++------ lisp/jabber-events.el | 5 +++++ lisp/jabber-export.el | 6 ++++++ lisp/jabber-gmail.el | 5 +++++ lisp/jabber-iq.el | 1 + lisp/jabber-logon.el | 2 ++ lisp/jabber-menu.el | 1 + lisp/jabber-muc-nick-completion.el | 2 ++ lisp/jabber-muc.el | 5 +++-- lisp/jabber-presence.el | 2 +- lisp/jabber-private.el | 4 ++++ lisp/jabber-roster.el | 7 ++++--- lisp/jabber-rtt.el | 4 ++++ lisp/jabber-sasl.el | 2 ++ lisp/jabber-time.el | 1 + lisp/jabber-truncate.el | 8 +++++++- lisp/jabber-util.el | 3 +++ lisp/jabber-vcard-avatars.el | 5 +++++ lisp/jabber-version.el | 2 ++ lisp/jabber-watch.el | 1 + lisp/jabber-xml.el | 1 - 34 files changed, 101 insertions(+), 19 deletions(-) diff --git a/lisp/jabber-activity.el b/lisp/jabber-activity.el index 2b8d4c9..ece7427 100644 --- a/lisp/jabber-activity.el +++ b/lisp/jabber-activity.el @@ -39,11 +39,10 @@ ;;; Code: +(require 'cl-lib) (require 'jabber-core) -(require 'jabber-alert) (require 'jabber-util) (require 'jabber-muc-nick-completion) ;we need jabber-muc-looks-like-personal-p -(require 'cl-lib) (defgroup jabber-activity nil "Activity tracking options." diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index d2af720..b5ac188 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -19,9 +19,9 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -(require 'jabber-util) - (require 'cl-lib) +(require 'jabber-util) +(require 'jabber-xml) (defgroup jabber-alerts nil "auditory and visual alerts for jabber events" :group 'jabber) diff --git a/lisp/jabber-autoaway.el b/lisp/jabber-autoaway.el index 6cd6551..ef8dc37 100644 --- a/lisp/jabber-autoaway.el +++ b/lisp/jabber-autoaway.el @@ -23,6 +23,8 @@ (eval-when-compile (require 'cl-lib)) (require 'time-date) +(require 'jabber-util) +(require 'jabber-presence) (defgroup jabber-autoaway nil "Change status to away after idleness." diff --git a/lisp/jabber-avatar.el b/lisp/jabber-avatar.el index 1a3f1de..64f50a4 100644 --- a/lisp/jabber-avatar.el +++ b/lisp/jabber-avatar.el @@ -42,6 +42,7 @@ (require 'mailcap) (eval-when-compile (require 'cl-lib)) +(require 'jabber-util) ;;;; Variables diff --git a/lisp/jabber-bookmarks.el b/lisp/jabber-bookmarks.el index c0930c4..7d6da42 100644 --- a/lisp/jabber-bookmarks.el +++ b/lisp/jabber-bookmarks.el @@ -18,10 +18,15 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +(require 'cl-lib) + +(require 'jabber-disco) +(require 'jabber-muc-nick-completion) +(require 'jabber-chatbuffer) (require 'jabber-private) (require 'jabber-widget) -(require 'cl-lib) + (defvar jabber-bookmarks (make-hash-table :test 'equal) "Mapping from full JIDs to bookmarks. diff --git a/lisp/jabber-browse.el b/lisp/jabber-browse.el index 8401023..e9bfc19 100644 --- a/lisp/jabber-browse.el +++ b/lisp/jabber-browse.el @@ -22,6 +22,7 @@ (require 'jabber-iq) (require 'jabber-xml) (require 'jabber-util) +(require 'jabber-menu) ;; jabber.el can perform browse requests, but will not answer them. diff --git a/lisp/jabber-carbons.el b/lisp/jabber-carbons.el index 722d5f8..125ae44 100644 --- a/lisp/jabber-carbons.el +++ b/lisp/jabber-carbons.el @@ -5,6 +5,12 @@ ;;; Code: +(require 'jabber-util) +(require 'jabber-xml) +(require 'jabber-menu) +(require 'jabber-iq) +(require 'jabber-disco) + (defun jabber-carbon-success (jc xml-data _context) (when (equal "result" (jabber-xml-get-attribute xml-data 'type)) (message "Carbons feature successfully enabled for %s" diff --git a/lisp/jabber-chat.el b/lisp/jabber-chat.el index 6e6be8e..6ec3785 100644 --- a/lisp/jabber-chat.el +++ b/lisp/jabber-chat.el @@ -19,10 +19,12 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (require 'jabber-core) +(require 'jabber-alert) (require 'jabber-chatbuffer) (require 'jabber-history) (require 'jabber-menu) ;we need jabber-jid-chat-menu (require 'ewoc) +(require 'goto-addr) (eval-when-compile (require 'cl-lib)) (defgroup jabber-chat nil "chat display options" diff --git a/lisp/jabber-chatbuffer.el b/lisp/jabber-chatbuffer.el index c3c4b93..9082670 100644 --- a/lisp/jabber-chatbuffer.el +++ b/lisp/jabber-chatbuffer.el @@ -18,6 +18,8 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +(require 'jabber-util) +(require 'jabber-core) (require 'jabber-keymap) (defvar jabber-point-insert nil diff --git a/lisp/jabber-chatstates.el b/lisp/jabber-chatstates.el index 8ad6a50..2bd5b75 100644 --- a/lisp/jabber-chatstates.el +++ b/lisp/jabber-chatstates.el @@ -23,6 +23,12 @@ ;; notifications are handled on receipt. (require 'cl-lib) +(require 'jabber-core) +(require 'jabber-util) +(require 'jabber-chat) +(require 'jabber-chatbuffer) +(require 'jabber-disco) +(require 'jabber-xml) (defgroup jabber-chatstates nil "Chat state notifications." diff --git a/lisp/jabber-compose.el b/lisp/jabber-compose.el index dffc48b..65b9292 100644 --- a/lisp/jabber-compose.el +++ b/lisp/jabber-compose.el @@ -22,6 +22,12 @@ ;;; Code: +(require 'jabber-core) +(require 'jabber-util) +(require 'jabber-widget) +(require 'jabber-chat) + + ;;;###autoload (defun jabber-compose (jc &optional recipient) "Create a buffer for composing a Jabber message. diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index 60e4dd7..2871c08 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -25,6 +25,8 @@ ;; A collection of functions, that hide the details of transmitting to ;; and from a Jabber Server. Mostly inspired by Gnus. +(require 'jabber-core) +(require 'fsm) (eval-when-compile (require 'cl-lib)) ;; Emacs 24 can be linked with GnuTLS diff --git a/lisp/jabber-console.el b/lisp/jabber-console.el index 4a4e812..fb60bd6 100644 --- a/lisp/jabber-console.el +++ b/lisp/jabber-console.el @@ -24,6 +24,8 @@ (require 'jabber-keymap) (require 'jabber-util) +(require 'jabber-truncate) +(require 'xml) (require 'ewoc) (require 'sgml-mode) ;we base on this mode to hightlight XML diff --git a/lisp/jabber-core.el b/lisp/jabber-core.el index 16dd5dc..79bcefe 100644 --- a/lisp/jabber-core.el +++ b/lisp/jabber-core.el @@ -41,15 +41,12 @@ ;;; Code: (require 'cl-lib) -(require 'jabber-util) -(require 'jabber-logon) -(require 'jabber-conn) - -(require 'fsm) - (require 'jabber-sasl) +(require 'jabber-xml) (require 'jabber-console) +(require 'fsm) + (defvar jabber-connections nil "List of jabber-connection FSMs.") diff --git a/lisp/jabber-events.el b/lisp/jabber-events.el index 8234790..b8c73d7 100644 --- a/lisp/jabber-events.el +++ b/lisp/jabber-events.el @@ -20,6 +20,11 @@ ;; Boston, MA 02111-1307, USA. (require 'cl-lib) +(require 'jabber-core) +(require 'jabber-util) +(require 'jabber-chat) +(require 'jabber-chatbuffer) +(require 'jabber-xml) (defgroup jabber-events nil "Message events and notifications." diff --git a/lisp/jabber-export.el b/lisp/jabber-export.el index 5a2b486..33795d8 100644 --- a/lisp/jabber-export.el +++ b/lisp/jabber-export.el @@ -20,6 +20,12 @@ ;; Boston, MA 02111-1307, USA. (require 'cl-lib) +(require 'jabber-core) +(require 'jabber-util) +(require 'jabber-xml) +(require 'jabber-widget) +(require 'fsm) +(require 'widget) (defvar jabber-export-roster-widget nil) diff --git a/lisp/jabber-gmail.el b/lisp/jabber-gmail.el index 2cc2528..9ce1df3 100644 --- a/lisp/jabber-gmail.el +++ b/lisp/jabber-gmail.el @@ -42,6 +42,11 @@ ;; (message msg) ;; (jabber-screen-message msg))) +(require 'jabber-util) +(require 'jabber-iq) +(require 'jabber-xml) +(require 'jabber-chat) + ;;;###autoload (defun jabber-gmail-subscribe (jc) "Subscribe to gmail notifications. diff --git a/lisp/jabber-iq.el b/lisp/jabber-iq.el index c4ee6c9..ec89a97 100644 --- a/lisp/jabber-iq.el +++ b/lisp/jabber-iq.el @@ -21,6 +21,7 @@ (require 'jabber-core) (require 'jabber-util) +(require 'jabber-alert) (require 'jabber-keymap) (defvar *jabber-open-info-queries* nil diff --git a/lisp/jabber-logon.el b/lisp/jabber-logon.el index 04c8f7d..fb87a2b 100644 --- a/lisp/jabber-logon.el +++ b/lisp/jabber-logon.el @@ -21,6 +21,8 @@ (require 'jabber-xml) (require 'jabber-util) +(require 'fsm) + ;; In Emacs 24, sha1 is built in, so this require is only needed for ;; earlier versions. It's supposed to be a noop in Emacs 24, but ;; sometimes, for some people, it isn't, and fails with diff --git a/lisp/jabber-menu.el b/lisp/jabber-menu.el index 5a7164e..ed36630 100644 --- a/lisp/jabber-menu.el +++ b/lisp/jabber-menu.el @@ -20,6 +20,7 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (require 'jabber-util) +(require 'wid-edit) (eval-when-compile (require 'cl-lib)) ;;;###autoload diff --git a/lisp/jabber-muc-nick-completion.el b/lisp/jabber-muc-nick-completion.el index 669f044..f56dca5 100644 --- a/lisp/jabber-muc-nick-completion.el +++ b/lisp/jabber-muc-nick-completion.el @@ -20,6 +20,8 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +(require 'jabber-chatbuffer) + ;;; User customizations here: (defcustom jabber-muc-completion-delimiter ": " "String to add to end of completion line." diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index 607fe00..95ac46e 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -20,7 +20,8 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -(require 'jabber-chat) +(require 'cl-lib) + (require 'jabber-widget) (require 'jabber-disco) (require 'jabber-muc-nick-coloring) @@ -29,7 +30,7 @@ ;; jabber-get-bookmarks and jabber-parse-conference-bookmark): (require 'jabber-bookmarks) -(require 'cl-lib) +(require 'ewoc) ;;;###autoload (defvar *jabber-active-groupchats* nil diff --git a/lisp/jabber-presence.el b/lisp/jabber-presence.el index 8effc7e..39bc197 100644 --- a/lisp/jabber-presence.el +++ b/lisp/jabber-presence.el @@ -24,7 +24,7 @@ (require 'jabber-alert) (require 'jabber-util) (require 'jabber-menu) -(require 'jabber-muc) +(require 'ewoc) (defvar jabber-presence-element-functions nil "List of functions returning extra elements for stanzas. diff --git a/lisp/jabber-private.el b/lisp/jabber-private.el index aebbdb9..40716bc 100644 --- a/lisp/jabber-private.el +++ b/lisp/jabber-private.el @@ -19,6 +19,10 @@ ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. +(require 'jabber-util) +(require 'jabber-xml) +(require 'jabber-iq) + ;;;###autoload (defun jabber-private-get (jc node-name namespace success-callback error-callback) "Retrieve an item from private XML storage. diff --git a/lisp/jabber-roster.el b/lisp/jabber-roster.el index afabd79..171f223 100644 --- a/lisp/jabber-roster.el +++ b/lisp/jabber-roster.el @@ -20,13 +20,14 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -(require 'jabber-presence) +(require 'cl-lib) (require 'jabber-util) (require 'jabber-alert) (require 'jabber-keymap) -(require 'format-spec) -(require 'cl-lib) ;for `find' (require 'jabber-private) +(require 'jabber-presence) +(require 'format-spec) +(require 'ewoc) (defgroup jabber-roster nil "roster display options" :group 'jabber) diff --git a/lisp/jabber-rtt.el b/lisp/jabber-rtt.el index d780d62..6207781 100644 --- a/lisp/jabber-rtt.el +++ b/lisp/jabber-rtt.el @@ -24,6 +24,10 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'jabber-disco) +(require 'jabber-core) +(require 'jabber-core) +(require 'ewoc) ;;;; Handling incoming events diff --git a/lisp/jabber-sasl.el b/lisp/jabber-sasl.el index 9a3dfd9..6153449 100644 --- a/lisp/jabber-sasl.el +++ b/lisp/jabber-sasl.el @@ -19,6 +19,8 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (require 'cl-lib) +(require 'fsm) +(require 'jabber-util) ;;; This file uses sasl.el from FLIM or Gnus. If it can't be found, ;;; jabber-core.el won't use the SASL functions. diff --git a/lisp/jabber-time.el b/lisp/jabber-time.el index 1b932fb..9900919 100644 --- a/lisp/jabber-time.el +++ b/lisp/jabber-time.el @@ -20,6 +20,7 @@ ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +(require 'jabber-disco) (require 'jabber-iq) (require 'jabber-util) (require 'jabber-autoaway) diff --git a/lisp/jabber-truncate.el b/lisp/jabber-truncate.el index 6826ec2..bd9327b 100644 --- a/lisp/jabber-truncate.el +++ b/lisp/jabber-truncate.el @@ -18,14 +18,20 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -(require 'jabber-chat) (require 'jabber-alert) +(require 'ewoc) (require 'cl-lib) (defvar jabber-log-lines-to-keep 1000 "Maximum number of lines in chat buffer.") +;; Global reference declarations + +(defvar jabber-chat-ewoc) ; jabber-chatbuffer.el + +;; + (defun jabber-truncate-top (buffer &optional ewoc) "Clean old history from a chat BUFFER. Optional EWOC is ewoc-widget to work. Default is diff --git a/lisp/jabber-util.el b/lisp/jabber-util.el index 6ff7ce2..b5ad93b 100644 --- a/lisp/jabber-util.el +++ b/lisp/jabber-util.el @@ -22,7 +22,10 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (require 'cl-lib) +(require 'jabber-xml) +(require 'fsm) (require 'password-cache) + (condition-case nil (require 'auth-source) (error nil)) diff --git a/lisp/jabber-vcard-avatars.el b/lisp/jabber-vcard-avatars.el index 4caca09..48e59b5 100644 --- a/lisp/jabber-vcard-avatars.el +++ b/lisp/jabber-vcard-avatars.el @@ -25,6 +25,11 @@ ;;; Code: +(require 'jabber-util) +(require 'jabber-xml) +(require 'jabber-vcard) +(require 'jabber-presence) +(require 'jabber-iq) (require 'jabber-avatar) (defcustom jabber-vcard-avatars-retrieve (and (fboundp 'display-images-p) diff --git a/lisp/jabber-version.el b/lisp/jabber-version.el index 69e9e45..8cad8c9 100644 --- a/lisp/jabber-version.el +++ b/lisp/jabber-version.el @@ -22,6 +22,8 @@ (require 'jabber-iq) (require 'jabber-util) (require 'jabber-ourversion) +(require 'jabber-disco) +(require 'jabber-menu) (defcustom jabber-version-show t "Show our client version to others. Acts on loading." diff --git a/lisp/jabber-watch.el b/lisp/jabber-watch.el index cb6f5e1..93bdb9c 100644 --- a/lisp/jabber-watch.el +++ b/lisp/jabber-watch.el @@ -20,6 +20,7 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (require 'jabber-util) +(require 'jabber-alert) (defcustom jabber-watch-alist nil "Alist of buddies for which an extra notification should be sent diff --git a/lisp/jabber-xml.el b/lisp/jabber-xml.el index e6e0ff7..f4884dd 100644 --- a/lisp/jabber-xml.el +++ b/lisp/jabber-xml.el @@ -20,7 +20,6 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (require 'xml) -(require 'jabber-util) (eval-when-compile (require 'cl-lib)) From 044204ccc7b970e3f4abeee65d0cbe04ed06846b Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Tue, 27 Jun 2023 20:45:55 -0700 Subject: [PATCH 21/29] Fix variable/function warnings part two of three. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix most of the remaining variations of function not known to be defined or reference or assignment to free variable warnings. Like the last patch, this patch is aimed at eliminating native compiler warning message. Where the first patch only manipulated ‘require’ functions, this change only adds ‘defvar’ and ‘define-function’ forms to resolve the remaining cross-file references. With this patch applied there are still a few remaining warnings about functions and variables. These remaining warnings are related to the order of definition and reference in a single file. Those warnings will be resolved by the next commit. --- lisp/jabber-activity.el | 7 ++++++ lisp/jabber-ahc.el | 6 +++++ lisp/jabber-alert.el | 8 +++++++ lisp/jabber-bookmarks.el | 5 ++++ lisp/jabber-chat.el | 15 ++++++++++++ lisp/jabber-chatstates.el | 8 ++++++- lisp/jabber-compose.el | 5 ++++ lisp/jabber-console.el | 7 ++++++ lisp/jabber-core.el | 23 +++++++++++++++++++ lisp/jabber-events.el | 6 +++++ lisp/jabber-export.el | 6 +++++ lisp/jabber-history.el | 8 +++++++ lisp/jabber-libnotify.el | 6 +++++ lisp/jabber-logon.el | 7 ++++++ lisp/jabber-modeline.el | 7 ++++++ lisp/jabber-muc-nick-completion.el | 10 ++++++++ lisp/jabber-muc.el | 28 ++++++++++++++++++++++ lisp/jabber-notifications.el | 10 ++++++++ lisp/jabber-presence.el | 37 ++++++++++++++++++++++++++++++ lisp/jabber-private.el | 9 ++++++++ lisp/jabber-register.el | 8 +++++++ lisp/jabber-roster.el | 17 ++++++++++++++ lisp/jabber-rtt.el | 10 ++++++++ lisp/jabber-sasl.el | 9 +++++++- lisp/jabber-search.el | 6 +++++ lisp/jabber-time.el | 6 +++++ lisp/jabber-util.el | 13 +++++++++++ lisp/jabber-vcard.el | 9 ++++++++ lisp/jabber-version.el | 6 +++++ lisp/jabber-watch.el | 6 +++++ lisp/jabber-widget.el | 6 +++++ 31 files changed, 312 insertions(+), 2 deletions(-) diff --git a/lisp/jabber-activity.el b/lisp/jabber-activity.el index ece7427..ce384c0 100644 --- a/lisp/jabber-activity.el +++ b/lisp/jabber-activity.el @@ -164,8 +164,15 @@ It is called after `jabber-activity-mode-string' and ;; Global reference declarations +(declare-function jabber-chat-get-buffer "jabber-chat.el" (chat-with)) +(declare-function jabber-muc-get-buffer "jabber-muc.el" (group)) +(declare-function jabber-muc-private-get-buffer "jabber-muc.el" + (group nickname)) +(declare-function jabber-muc-sender-p "jabber-muc.el" (jid)) (defvar jabber-silent-mode) ; jabber.el +;; + (defun jabber-activity-make-string-default (jid) "Return the nick of the JID. If no nick is available, return the user name part of the JID. In diff --git a/lisp/jabber-ahc.el b/lisp/jabber-ahc.el index 3839cc0..21f4419 100644 --- a/lisp/jabber-ahc.el +++ b/lisp/jabber-ahc.el @@ -43,6 +43,12 @@ func - function taking connection object and entire IQ stanza as Use the function `jabber-ahc-add' to add a command to this list.") +;; Global reference declarations + +(defvar jabber-jid-info-menu) ; jabber-menu.el +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el + +;; ;;; SERVER (add-to-list 'jabber-disco-info-nodes diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index b5ac188..ddf9571 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -226,8 +226,14 @@ files." ;; Global reference declarations +(declare-function jabber-chat-get-buffer "jabber-chat.el" (chat-with)) +(declare-function jabber-chat-send "jabber-chat.el" (jc body)) +(declare-function jabber-muc-sender-p "jabber-muc.el" (jid)) (defvar jabber-presence-strings) ; jabber.el (defvar jabber-xml-data) ; jabber.el +(defvar *jabber-active-groupchats*) ; jabber-muc.el +(defvar jabber-roster-buffer) ; jabber-core.el +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el ;; @@ -479,6 +485,8 @@ NAME: the name of the sender." (let ((sn (symbol-name name))) (let ((func (intern (format "%s-personal" sn)))) `(progn + (declare-function jabber-muc-looks-like-personal-p "jabber-muc-nick-completion.el" + (message &optional group)) (defun ,func (nick group buffer text title) (if (jabber-muc-looks-like-personal-p text group) (,name nick group buffer text title))) diff --git a/lisp/jabber-bookmarks.el b/lisp/jabber-bookmarks.el index 7d6da42..015fe20 100644 --- a/lisp/jabber-bookmarks.el +++ b/lisp/jabber-bookmarks.el @@ -26,7 +26,12 @@ (require 'jabber-private) (require 'jabber-widget) +;; Global reference declarations +(defvar jabber-muc-default-nicknames) ; jabber-muc.el +(defvar jabber-muc-autojoin) ; jabber-muc.el + +;; (defvar jabber-bookmarks (make-hash-table :test 'equal) "Mapping from full JIDs to bookmarks. diff --git a/lisp/jabber-chat.el b/lisp/jabber-chat.el index 6ec3785..1373124 100644 --- a/lisp/jabber-chat.el +++ b/lisp/jabber-chat.el @@ -210,6 +210,21 @@ message. The functions should return a list of XML nodes they want to be added to the outgoing message.") +;; Global reference declarations + +(declare-function jabber-compose "jabber-compose.el" (jc &optional recipient)) +(declare-function jabber-muc-private-create-buffer "jabber-muc.el" + (jc group nickname)) +(declare-function jabber-muc-print-prompt "jabber-muc.el" + (xml-data &optional local dont-print-nick-p)) +(declare-function jabber-muc-private-print-prompt "jabber-muc.el" (xml-data)) +(declare-function jabber-muc-system-prompt "jabber-muc.el" (&rest _ignore)) +(declare-function jabber-muc-message-p "jabber-muc.el"(message)) +(declare-function jabber-muc-sender-p "jabber-muc.el" (jid)) +(declare-function jabber-muc-private-message-p "jabber-muc.el" (message)) +(defvar jabber-group) ; jabber-muc.el +;; + (defvar jabber-chat-earliest-backlog nil "Float-time of earliest backlog entry inserted into buffer. nil if no backlog has been inserted.") diff --git a/lisp/jabber-chatstates.el b/lisp/jabber-chatstates.el index 2bd5b75..023dbe9 100644 --- a/lisp/jabber-chatstates.el +++ b/lisp/jabber-chatstates.el @@ -58,7 +58,13 @@ nil - don't send states") "Human-readable presentation of chat state information.") (make-variable-buffer-local 'jabber-chatstates-message) -;;; INCOMING +;; Global reference declarations + +(defvar jabber-chatstates-composing-sent) ; jabber-chatstates.el + +;; + +;; INCOMING ;;; Code for requesting chat state notifications from others and handling ;;; them. diff --git a/lisp/jabber-compose.el b/lisp/jabber-compose.el index 65b9292..eb6d2f0 100644 --- a/lisp/jabber-compose.el +++ b/lisp/jabber-compose.el @@ -27,6 +27,11 @@ (require 'jabber-widget) (require 'jabber-chat) +;; Global reference declarations + +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el + +;; ;;;###autoload (defun jabber-compose (jc &optional recipient) diff --git a/lisp/jabber-console.el b/lisp/jabber-console.el index fb60bd6..b56d32b 100644 --- a/lisp/jabber-console.el +++ b/lisp/jabber-console.el @@ -68,6 +68,13 @@ what kind of chat buffer is being created.") (define-key map "\r" 'jabber-chat-buffer-send) map)) +;; Global reference declarations + +(declare-function jabber-send-string "jabber-core.el" (jc string)) +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el + +;; + (defun jabber-console-create-buffer (jc) (with-current-buffer (get-buffer-create (format jabber-console-name-format (jabber-connection-bare-jid jc))) diff --git a/lisp/jabber-core.el b/lisp/jabber-core.el index 79bcefe..615957c 100644 --- a/lisp/jabber-core.el +++ b/lisp/jabber-core.el @@ -151,9 +151,32 @@ problems." ;; Global reference declarations +(declare-function jabber-send-iq "jabber-iq.el" + (jc to type query success-callback success-closure-data + error-callback error-closure-data &optional result-id)) +(declare-function jabber-muc-connection-closed "jabber-muc.el" (bare-jid)) +(declare-function jabber-roster-update "jabber-roster.el" + (jc new-items changed-items deleted-items)) +(declare-function jabber-display-roster "jabber-roster.el" ()) +(declare-function jabber-process-roster "jabber-presence.el" + (jc xml-data closure-data)) +(declare-function jabber-initial-roster-failure "jabber-presence.el" + (jc xml-data _closure-data)) +(declare-function jabber-get-auth "jabber-logon.el" (jc to session-id)) +(declare-function jabber-get-register "jabber-register.el" (jc to)) +(declare-function jabber-get-connect-function "jabber-conn.el" (type)) +(declare-function jabber-get-send-function "jabber-conn.el" (type)) +(declare-function jabber-starttls-process-input "jabber-conn.el" + (fsm xml-data)) +(declare-function jabber-starttls-initiate "jabber-conn.el" (fsm)) +(declare-function jabber-mode-line-presence-update "jabber-modeline.el" ()) (defvar jabber-debug-keep-process-buffers) ; jabber.el (defvar jabber-silent-mode) ; jabber.el (defvar jabber-account-list) ; jabber.el +(defvar jabber-xml-data) ; jabber.el +(defvar jabber-default-connection-type) ; jabber-conn.el +(defvar jabber-connect-methods) ; jabber-conn.el +(defvar jabber-mode-line-mode) ; jabber-modeline.el ;; diff --git a/lisp/jabber-events.el b/lisp/jabber-events.el index b8c73d7..01430f2 100644 --- a/lisp/jabber-events.el +++ b/lisp/jabber-events.el @@ -61,6 +61,12 @@ probably reading the message).") "Human-readable presentation of event information.") (make-variable-buffer-local 'jabber-events-message) +;; Global reference declarations + +(declare-function jabber-muc-message-p "jabber-muc.el" (message)) + +;; + (defun jabber-events-update-message () (setq jabber-events-message (concat (cdr (assq jabber-events-arrived diff --git a/lisp/jabber-export.el b/lisp/jabber-export.el index 33795d8..fa049d5 100644 --- a/lisp/jabber-export.el +++ b/lisp/jabber-export.el @@ -31,6 +31,12 @@ (defvar jabber-import-subscription-p-widget nil) +;; Global reference declarations + +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el + +;; + ;;;###autoload (defun jabber-export-roster (jc) "Export roster for connection JC." diff --git a/lisp/jabber-history.el b/lisp/jabber-history.el index ca3083c..8ab30e1 100644 --- a/lisp/jabber-history.el +++ b/lisp/jabber-history.el @@ -95,6 +95,14 @@ number after the last rotation." :type 'integer :group 'jabber-history) +;; Global reference declarations + +(declare-function jabber-muc-message-p "jabber-muc.el"(message)) +(defvar jabber-chatting-with) ; jabber-chatbuffer.el +(defvar jabber-buffer-connection) ; jabber-buffer-connection.el + +;; + (defvar jabber-history-inhibit-received-message-functions nil "Functions determining whether to log an incoming message stanza. The functions in this list are called with two arguments, diff --git a/lisp/jabber-libnotify.el b/lisp/jabber-libnotify.el index 8072e0a..fb5f50e 100644 --- a/lisp/jabber-libnotify.el +++ b/lisp/jabber-libnotify.el @@ -58,6 +58,12 @@ Dbus is faster but require emacs23+, use shell as a fallback." (defvar jabber-libnotify-id 0) +;; Global reference declarations + +(declare-function jabber-escape-xml "jabber-xml.el" (string)) + +;; + (defun jabber-libnotify-next-id () "Return the next notification id." (setq jabber-libnotify-id (+ jabber-libnotify-id 1))) diff --git a/lisp/jabber-logon.el b/lisp/jabber-logon.el index fb87a2b..2b30e02 100644 --- a/lisp/jabber-logon.el +++ b/lisp/jabber-logon.el @@ -23,6 +23,13 @@ (require 'jabber-util) (require 'fsm) +;; Global reference declarations + +(declare-function jabber-send-iq "jabber-iq.el" + (jc to type query success-callback success-closure-data + error-callback error-closure-data &optional result-id)) +;; + ;; In Emacs 24, sha1 is built in, so this require is only needed for ;; earlier versions. It's supposed to be a noop in Emacs 24, but ;; sometimes, for some people, it isn't, and fails with diff --git a/lisp/jabber-modeline.el b/lisp/jabber-modeline.el index 521b99d..b69a39c 100644 --- a/lisp/jabber-modeline.el +++ b/lisp/jabber-modeline.el @@ -37,6 +37,13 @@ (defvar jabber-mode-line-contacts nil) +;; Global reference declarations + +(defvar *jabber-current-show*) ; jabber.el +(defvar jabber-presence-strings) ; jabber.el + +;; + (defadvice jabber-send-presence (after jsp-update-mode-line (show status priority)) (jabber-mode-line-presence-update)) diff --git a/lisp/jabber-muc-nick-completion.el b/lisp/jabber-muc-nick-completion.el index f56dca5..647299c 100644 --- a/lisp/jabber-muc-nick-completion.el +++ b/lisp/jabber-muc-nick-completion.el @@ -58,6 +58,16 @@ Note that \":\" or alike not needed (it appended in other string)" (defvar *jabber-muc-participant-last-speaking* nil "Global alist in form (group . ((member . time-of-last-speaking) ...) ...).") +;; Global reference declarations + +(defvar jabber-group) ; jabber-muc.el +(defvar *jabber-active-groupchats*) ; jabber-muc.el +(defvar jabber-muc-default-nicknames) ; jabber-muc.el +(defvar jabber-muc-participants) ; jabber-muc.el +(defvar jabber-chatting-with) ; jabber-chat.el + +;; + (defun jabber-my-nick (&optional group) "Return my jabber nick in GROUP." (let ((room (or group jabber-group))) diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index 95ac46e..ad2c2ae 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -166,6 +166,34 @@ The format is that of `mode-line-format' and `header-line-format'." :type 'sexp :group 'jabber-chat) +;; Global reference declarations + +(declare-function jabber-presence-children "jabber-presence.el" (jc)) +(declare-function jabber-vcard-get "jabber-vcard.el" (jc jid)) +(declare-function jabber-parse-conference-bookmark "jabber-bookmarks.el" + (node)) +;; (declare-function jabber-get-bookmarks "jabber-bookmarks.el" +;; (jc cont &optional refresh)) +;; (declare-function jabber-get-conference-data "jabber-bookmarks.el" +;; (jc conference-jid cont &optional key)) +(declare-function jabber-send-message "jabber-chat.el" + (jc to subject body type)) +(declare-function jabber-maybe-print-rare-time "jabber-chat.el" (node)) +(declare-function jabber-chat-pp "jabber-chat.el" (data)) +(declare-function jabber-chat-mode "jabber-chatbuffer.el" (jc ewoc-pp)) +(defvar jabber-silent-mode) ; jabber.el +(defvar jabber-alert-muc-function) ; jabber-alert.el +(defvar jabber-body-printers) ; jabber-chat.el +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el +(defvar jabber-chat-delayed-time-format) ; jabber-chat.el +(defvar jabber-chat-delayed-time-format) ; jabber-chat.el +(defvar jabber-chat-ewoc) ; jabber-chatbuffer.el +(defvar jabber-chat-printers) ; jabber-chat.el +(defvar jabber-chat-time-format) ; jabber-chat.el +(defvar jabber-send-function) ; jabber-console.el + +;; + ;;;###autoload (defvar jabber-muc-printers '() "List of functions that may be able to print part of a MUC message. diff --git a/lisp/jabber-notifications.el b/lisp/jabber-notifications.el index 74089c6..eae3df8 100644 --- a/lisp/jabber-notifications.el +++ b/lisp/jabber-notifications.el @@ -51,6 +51,16 @@ (const :tag "Critical" "critical")) :group 'jabber-alerts) +;; Global reference declarations + +(declare-function jabber-muc-looks-like-personal-p "jabber-muc-nick-completion.el" + (message &optional group)) +(declare-function jabber-avatar-find-cached "jabber-avatar.el" (sha1-sum)) +(declare-function jabber-jid-symbol "jabber-util.el" (jid)) +(declare-function jabber-escape-xml "jabber-xml.el" (string)) + +;; + (defun jabber-message-notifications (from _buffer text title) "Show a message through the notifications.el interface" (let diff --git a/lisp/jabber-presence.el b/lisp/jabber-presence.el index 39bc197..f1a5e58 100644 --- a/lisp/jabber-presence.el +++ b/lisp/jabber-presence.el @@ -35,6 +35,43 @@ stanza.") (defvar jabber-presence-history () "Keeps track of previously used presence status types.") +;; Global reference declarations + +(declare-function jabber-display-roster "jabber-roster.el" ()) +(declare-function jabber-roster-update "jabber-roster.el" + (jc new-items changed-items deleted-items)) +(declare-function jabber-chat-create-buffer "jabber-chat.el" (jc chat-with)) +(declare-function jabber-muc-get-buffer "jabber-muc.el" (group)) +(declare-function jabber-muc-process-presence "jabber-muc.el" (jc presence)) +(declare-function jabber-muc-presence-p "jabber-muc.el" (presence)) +(defvar jabber-chatting-with) ; jabber-chat.el +(defvar *jabber-active-groupchats*) ; jabber-muc.el +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el +(defvar jabber-chat-ewoc) ; jabber-chatbuffer.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar jabber-default-priority) ; jabber.el +(defvar *jabber-current-show*) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-show*) ; jabber.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar *jabber-current-show*) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar jabber-default-show) ; jabber.el +(defvar jabber-default-status) ; jabber.el +(defvar jabber-default-priority) ; jabber.el +(defvar *jabber-current-show*) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar *jabber-current-priority*) ; jabber.el +(defvar jabber-silent-mode) ; jabber.el + +;; + (add-to-list 'jabber-iq-set-xmlns-alist (cons "jabber:iq:roster" (function (lambda (jc x) (jabber-process-roster jc x nil))))) (defun jabber-process-roster (jc xml-data closure-data) diff --git a/lisp/jabber-private.el b/lisp/jabber-private.el index 40716bc..aa4880c 100644 --- a/lisp/jabber-private.el +++ b/lisp/jabber-private.el @@ -23,6 +23,15 @@ (require 'jabber-xml) (require 'jabber-iq) +;; Global reference declarations + +;; (declare-function jabber-iq-query "jabber-util.el" (xml-data)) +;; (declare-function jabber-xml-node-children "jabber-xml.el" (node)) +;; (declare-function jabber-send-iq "jabber-iq.el" +;; (jc to type query success-callback success-closure-data +;; error-callback error-closure-data &optional result-id)) +;; + ;;;###autoload (defun jabber-private-get (jc node-name namespace success-callback error-callback) "Retrieve an item from private XML storage. diff --git a/lisp/jabber-register.el b/lisp/jabber-register.el index cbf25b3..4ff4c98 100644 --- a/lisp/jabber-register.el +++ b/lisp/jabber-register.el @@ -22,6 +22,14 @@ (require 'jabber-iq) (require 'jabber-widget) +;; Global reference declarations + +(declare-function jabber-submit-search "jabber-search.el" (&rest _ignore)) +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el +(defvar jabber-silent-mode) ; jabber.el + +;; + (add-to-list 'jabber-jid-service-menu (cons "Register with service" 'jabber-get-register)) (defun jabber-get-register (jc to) diff --git a/lisp/jabber-roster.el b/lisp/jabber-roster.el index 171f223..e851493 100644 --- a/lisp/jabber-roster.el +++ b/lisp/jabber-roster.el @@ -244,6 +244,23 @@ Trailing newlines are always removed, regardless of this variable." ;;(define-key map "D" 'jabber-disconnect) map)) +;; Global reference declarations + +(declare-function jabber-muc-read-my-nickname "jabber-muc.el" + (jc group &optional default)) +(declare-function jabber-muc-join "jabber-muc.el" + (jc group nickname &optional popup)) +(declare-function jabber-chat-with "jabber-chat.el" + (jc jid &optional other-window)) +(declare-function jabber-disco-get-info "jabber-disco.el" + (jc jid node callback closure-data &optional force)) +(defvar *jabber-current-show*) ; jabber.el +(defvar jabber-presence-strings) ; jabber.el +(defvar *jabber-current-status*) ; jabber.el +(defvar jabber-presence-faces) ; jabber.el + +;; + (defun jabber-roster-ret-action-at-point () "Action for RET. Before try to roll up/down group. Eval `chat-with-jid-at-point' is no group at diff --git a/lisp/jabber-rtt.el b/lisp/jabber-rtt.el index 6207781..d05783c 100644 --- a/lisp/jabber-rtt.el +++ b/lisp/jabber-rtt.el @@ -29,6 +29,16 @@ (require 'jabber-core) (require 'ewoc) +;; Global reference declarations + +(declare-function jabber-chat-get-buffer "jabber-chat.el" (chat-with)) +(declare-function jabber-muc-message-p "jabber-muc.el"(message)) +(defvar jabber-message-chain) ; jabber-core.el +(defvar jabber-chat-ewoc) ; jabber-chatbuffer.el +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el +(defvar jabber-chatting-with) ; jabber-chat.el +(defvar jabber-point-insert) ; jabber-console.el + ;;;; Handling incoming events ;;;###autoload diff --git a/lisp/jabber-sasl.el b/lisp/jabber-sasl.el index 6153449..03b2933 100644 --- a/lisp/jabber-sasl.el +++ b/lisp/jabber-sasl.el @@ -36,8 +36,15 @@ (require 'jabber-xml) +;; Global reference declarations + +(declare-function jabber-send-sexp "jabber-core.el" (jc sexp)) +(defvar jabber-silent-mode) ; jabber.el + +;; + (defun jabber-sasl-start-auth (jc stream-features) -"Start the SASL authentication mechanism. + "Start the SASL authentication mechanism. JC is The Jabber Connection. STREAM-FEATURES the XML parsed \"stream features\" answer (it is used with `jabber-xml-get-chidlren')." diff --git a/lisp/jabber-search.el b/lisp/jabber-search.el index 1d72311..f91e798 100644 --- a/lisp/jabber-search.el +++ b/lisp/jabber-search.el @@ -21,6 +21,12 @@ (require 'jabber-register) +;; Global reference declarations + +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el + +;; + (add-to-list 'jabber-jid-service-menu (cons "Search directory" 'jabber-get-search)) (defun jabber-get-search (jc to) diff --git a/lisp/jabber-time.el b/lisp/jabber-time.el index 9900919..4638718 100644 --- a/lisp/jabber-time.el +++ b/lisp/jabber-time.el @@ -27,6 +27,12 @@ (require 'time-date) +;; Global reference declarations + +(defvar jabber-jid-info-menu) ; jabber-menu.el + +;; + (add-to-list 'jabber-jid-info-menu (cons "Request time" 'jabber-get-time)) (defun jabber-get-time (jc to) diff --git a/lisp/jabber-util.el b/lisp/jabber-util.el index b5ad93b..1745829 100644 --- a/lisp/jabber-util.el +++ b/lisp/jabber-util.el @@ -33,6 +33,19 @@ (defvar jabber-jid-history nil "History of entered JIDs.") +;; Global reference declarations + +(declare-function jabber-chat-with "jabber-chat.el" + (jc jid &optional other-window)) +(declare-function jabber-ahc-execute-command "jabber-ahc.el" (jc to node)) +(declare-function jabber-get-register "jabber-register.el" (jc to)) +(declare-function jabber-muc-read-my-nickname "jabber-muc.el" + (jc group &optional default)) +(declare-function jabber-muc-join "jabber-muc.el" + (jc group nickname &optional popup)) + +;; + (defalias 'jabber-propertize 'propertize) (defsubst jabber-read-with-input-method (prompt &optional initial-contents history default-value) diff --git a/lisp/jabber-vcard.el b/lisp/jabber-vcard.el index daf003c..e79ac33 100644 --- a/lisp/jabber-vcard.el +++ b/lisp/jabber-vcard.el @@ -72,6 +72,15 @@ "The avatar structure for the photo in the vCard edit buffer.") (make-variable-buffer-local 'jabber-vcard-photo) +;; Global reference declarations + +(declare-function jabber-vcard-avatars-update-current + "jabber-vcard-avatars.el" (jc new-hash)) +(defvar jabber-vcard-fields) ; jabber-vcard.el +(defvar jabber-buffer-connection) ; jabber-chatbuffer.el + +;; + (defun jabber-vcard-parse (vcard) "Parse the vCard XML structure given in VCARD. The top node should be the `vCard' node." diff --git a/lisp/jabber-version.el b/lisp/jabber-version.el index 8cad8c9..fde6758 100644 --- a/lisp/jabber-version.el +++ b/lisp/jabber-version.el @@ -30,6 +30,12 @@ :type 'boolean :group 'jabber) +;; Global reference declarations + +;; (defvar jabber-jid-info-menu) ; jabber-menu.el + +;; + (add-to-list 'jabber-jid-info-menu (cons "Request software version" 'jabber-get-version)) (defun jabber-get-version (jc to) diff --git a/lisp/jabber-watch.el b/lisp/jabber-watch.el index 93bdb9c..8feb92c 100644 --- a/lisp/jabber-watch.el +++ b/lisp/jabber-watch.el @@ -30,6 +30,12 @@ when they come online, with comment strings as values." :type '(alist :key-type symbol :value-type string) :group 'jabber-watch) +;; Global reference declarations + +;; (defvar jabber-presence-hooks) ; jabber-alert.el + +;; + (defun jabber-presence-watch (who oldstatus newstatus _statustext proposed-alert) "Send a message if one of your extra-important buddies comes online. diff --git a/lisp/jabber-widget.el b/lisp/jabber-widget.el index f7e0f75..58b61cd 100644 --- a/lisp/jabber-widget.el +++ b/lisp/jabber-widget.el @@ -36,6 +36,12 @@ One of: (defvar jabber-submit-to nil "JID of the entity to which form data is to be sent.") +;; Global reference declarations + +(defvar *jabber-roster*) ; jabber-core.el + +;; + (jabber-disco-advertise-feature "jabber:x:data") (define-widget 'jid 'string From 8739a6e098c1f21c3b333c99ac3e063413fd88d1 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Tue, 27 Jun 2023 21:10:09 -0700 Subject: [PATCH 22/29] Fix variable/function warnings part three of three. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix remaining variations of function not known to be defined or reference or assignment to free variable warnings. These remaining messages, generated by the native compiler, arise from forward references in a single file. Forms that evaluate ‘place’, like or ‘push’ or ‘add-to-list’ cause issues for native compilation if the referenced variable is not yet defined. There are three files where definitions follow referencing forms: jabber-alert.el, jabber-chatbuffer.el, and jabber-disco.el. Where the previous two patches only manipulated ‘require’ functions, or added ‘defvar’ and ‘define-function’ forms, this change simply moves code around within the above three files to ensure variables are defined before they are referenced. --- lisp/jabber-alert.el | 18 +++--- lisp/jabber-chatbuffer.el | 12 ++-- lisp/jabber-disco.el | 132 ++++++++++++++++++++------------------ 3 files changed, 86 insertions(+), 76 deletions(-) diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index ddf9571..783bc90 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -289,15 +289,6 @@ Examples: (lambda (&rest _ignore) (beep))) ;; Message alert hooks -(defun jabber-message-default-message (from buffer _text) - (when (or jabber-message-alert-same-buffer - (not (memq (selected-window) (get-buffer-window-list buffer)))) - (if (jabber-muc-sender-p from) - (format "Private message from %s in %s" - (jabber-jid-resource from) - (jabber-jid-displayname (jabber-jid-user from))) - (format "Message from %s" (jabber-jid-displayname from))))) - (defcustom jabber-message-alert-same-buffer t "If nil, don't display message alerts for the current buffer." :type 'boolean @@ -308,6 +299,15 @@ Examples: :type 'boolean :group 'jabber-alerts) +(defun jabber-message-default-message (from buffer _text) + (when (or jabber-message-alert-same-buffer + (not (memq (selected-window) (get-buffer-window-list buffer)))) + (if (jabber-muc-sender-p from) + (format "Private message from %s in %s" + (jabber-jid-resource from) + (jabber-jid-displayname (jabber-jid-user from))) + (format "Message from %s" (jabber-jid-displayname from))))) + (defun jabber-message-wave (from _buffer _text title) "Play the wave file specified in `jabber-alert-message-wave'." (when title diff --git a/lisp/jabber-chatbuffer.el b/lisp/jabber-chatbuffer.el index 9082670..bd3c02f 100644 --- a/lisp/jabber-chatbuffer.el +++ b/lisp/jabber-chatbuffer.el @@ -49,6 +49,12 @@ window or at `fill-column', whichever is shorter." ;;;###autoload (make-variable-buffer-local 'jabber-buffer-connection) +(defvar jabber-chat-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map jabber-common-keymap) + (define-key map "\r" 'jabber-chat-buffer-send) + map)) + (defun jabber-chat-mode (jc ewoc-pp) "Jabber chat mode. \\{jabber-chat-mode-map} @@ -94,12 +100,6 @@ JC is the Jabber connection." (put 'jabber-chat-mode 'flyspell-mode-predicate 'jabber-chat-mode-flyspell-verify) -(defvar jabber-chat-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map jabber-common-keymap) - (define-key map "\r" 'jabber-chat-buffer-send) - map)) - (defun jabber-chat-buffer-send () (interactive) ;; If user accidentally hits RET without writing anything, just diff --git a/lisp/jabber-disco.el b/lisp/jabber-disco.el index 9969f4e..1182eaf 100644 --- a/lisp/jabber-disco.el +++ b/lisp/jabber-disco.el @@ -48,6 +48,77 @@ to symbols accepted by `secure-hash'. XEP-0115 currently recommends SHA-1, but let's be future-proof.") +;; Keys are ("jid" . "node"), where "node" is nil if appropriate. +;; Values are (identities features), where each identity is ["name" +;; "category" "type"], and each feature is a string. +(defvar jabber-disco-info-cache (make-hash-table :test 'equal)) + +;; Keys are ("jid" . "node"). Values are (items), where each +;; item is ["name" "jid" "node"] (some values may be nil). +(defvar jabber-disco-items-cache (make-hash-table :test 'equal)) + +(defvar jabber-advertised-features + (list "http://jabber.org/protocol/disco#info") + "Features advertised on service discovery requests. + +Don't add your feature to this list directly. Instead, call +`jabber-disco-advertise-feature'.") + +(defvar jabber-disco-items-nodes + (list + (list "" nil nil)) + "Alist of node names and information about returning disco item data. +Key is node name as a string, or \"\" for no node specified. Value is +a list of two items. + +First item is data to return. If it is a function, that function is +called and its return value is used; if it is a list, that list is +used. The list should be the XML data to be returned inside the + element, like this: + +\((item ((name . \"Name of first item\") + (jid . \"first.item\") + (node . \"node\")))) + +Second item is access control function. That function is passed the +JID, and returns non-nil if access is granted. If the second item is +nil, access is always granted.") + +(defvar jabber-disco-info-nodes + (list + (list "" #'jabber-disco-return-client-info nil)) + "Alist of node names and information returning disco info data. +Key is node name as a string, or \"\" for no node specified. Value is +a list of two items. + +First item is data to return. If it is a function, that function is +called and its return value is used; if it is a list, that list is +used. The list should be the XML data to be returned inside the + element, like this: + +\((identity ((category . \"client\") + (type . \"pc\") + (name . \"Jabber client\"))) + (feature ((var . \"some-feature\")))) + +Second item is access control function. That function is passed the +JID, and returns non-nil if access is granted. If the second item is +nil, access is always granted.") + +;; Global reference declarations + +(declare-function jabber-send-current-presence "jabber-presence.el" + (&optional _ignore)) +(declare-function jabber-xdata-formtype "jabber-widget.el" (x)) +(defvar jabber-presence-element-functions) ; jabber-presence.el + +;; + +(add-to-list 'jabber-iq-get-xmlns-alist + (cons "http://jabber.org/protocol/disco#info" 'jabber-return-disco-info)) +(add-to-list 'jabber-iq-get-xmlns-alist + (cons "http://jabber.org/protocol/disco#items" 'jabber-return-disco-info)) + (defun jabber-caps-get-cached (jid) "Get disco info from Entity Capabilities cache. JID should be a string containing a full JID. @@ -319,58 +390,6 @@ the right node." (eval-after-load "jabber-presence" '(add-to-list 'jabber-presence-element-functions #'jabber-caps-presence-element)) -(defvar jabber-advertised-features - (list "http://jabber.org/protocol/disco#info") - "Features advertised on service discovery requests. - -Don't add your feature to this list directly. Instead, call -`jabber-disco-advertise-feature'.") - -(defvar jabber-disco-items-nodes - (list - (list "" nil nil)) - "Alist of node names and information about returning disco item data. -Key is node name as a string, or \"\" for no node specified. Value is -a list of two items. - -First item is data to return. If it is a function, that function is -called and its return value is used; if it is a list, that list is -used. The list should be the XML data to be returned inside the - element, like this: - -\((item ((name . \"Name of first item\") - (jid . \"first.item\") - (node . \"node\")))) - -Second item is access control function. That function is passed the -JID, and returns non-nil if access is granted. If the second item is -nil, access is always granted.") - -(defvar jabber-disco-info-nodes - (list - (list "" #'jabber-disco-return-client-info nil)) - "Alist of node names and information returning disco info data. -Key is node name as a string, or \"\" for no node specified. Value is -a list of two items. - -First item is data to return. If it is a function, that function is -called and its return value is used; if it is a list, that list is -used. The list should be the XML data to be returned inside the - element, like this: - -\((identity ((category . \"client\") - (type . \"pc\") - (name . \"Jabber client\"))) - (feature ((var . \"some-feature\")))) - -Second item is access control function. That function is passed the -JID, and returns non-nil if access is granted. If the second item is -nil, access is always granted.") - -(add-to-list 'jabber-iq-get-xmlns-alist - (cons "http://jabber.org/protocol/disco#info" 'jabber-return-disco-info)) -(add-to-list 'jabber-iq-get-xmlns-alist - (cons "http://jabber.org/protocol/disco#items" 'jabber-return-disco-info)) (defun jabber-return-disco-info (jc xml-data) "Respond to a service discovery request. See XEP-0030. @@ -513,15 +532,6 @@ obtained from `xml-parse-region'." 'jabber-node node)))) (insert "No items found.\n")))) -;; Keys are ("jid" . "node"), where "node" is nil if appropriate. -;; Values are (identities features), where each identity is ["name" -;; "category" "type"], and each feature is a string. -(defvar jabber-disco-info-cache (make-hash-table :test 'equal)) - -;; Keys are ("jid" . "node"). Values are (items), where each -;; item is ["name" "jid" "node"] (some values may be nil). -(defvar jabber-disco-items-cache (make-hash-table :test 'equal)) - (defun jabber-disco-get-info (jc jid node callback closure-data &optional force) "Get disco info for JID and NODE, using connection JC. Call CALLBACK with JC and CLOSURE-DATA as first and second From fd2297f0d267653a2ee7be79222da4bdc4bb5248 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Mon, 3 Jul 2023 15:43:13 -0700 Subject: [PATCH 23/29] Address review comments. - https://codeberg.org/emacs-jabber/emacs-jabber/pulls/32/files#issuecomment-960563 - https://codeberg.org/emacs-jabber/emacs-jabber/pulls/32/files#issuecomment-960567 - https://codeberg.org/emacs-jabber/emacs-jabber/pulls/32/files#issuecomment-960571 --- lisp/jabber-alert.el | 2 +- lisp/jabber-conn.el | 4 ++-- lisp/jabber.el | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el index 783bc90..996f3b9 100644 --- a/lisp/jabber-alert.el +++ b/lisp/jabber-alert.el @@ -148,7 +148,7 @@ All hooks refrain from action if this function returns nil." "Hooks run when an info request is completed. First argument is WHAT, a symbol telling the kind of info request completed. -That might be \=’roster, for requested roster updates, and \=’browse, for +That might be \='roster, for requested roster updates, and \='browse, for browse requests. Second argument in BUFFER, a buffer containing the result. Third argument is PROPOSED-ALERT, containing the string returned by `jabber-alert-info-message-function' for these arguments." diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index 2871c08..b1f11ef 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -67,8 +67,8 @@ See `jabber-connect-methods'.") (defcustom jabber-connection-ssl-program nil "Program used for SSL/TLS connections. nil means prefer gnutls but fall back to openssl. -‘gnutls’ means use gnutls (through `open-tls-stream'). -‘openssl’ means use openssl (through `open-ssl-stream')." +\='gnutls\=' means use gnutls (through `open-tls-stream'). +\='openssl means use openssl (through `open-ssl-stream')." :type '(choice (const :tag "Prefer gnutls, fall back to openssl" nil) (const :tag "Use gnutls" gnutls) (const :tag "Use openssl" openssl)) diff --git a/lisp/jabber.el b/lisp/jabber.el index 07b34cf..939df91 100644 --- a/lisp/jabber.el +++ b/lisp/jabber.el @@ -56,7 +56,7 @@ ;; Shared between jabber-core.el and jabber-alert.el -(defvar jabber-xml-data nil "") +(defvar jabber-xml-data) (defcustom jabber-debug-keep-process-buffers nil "If nil, kill process buffers when the process dies. From 2dbb01f635b8a46e042a7456c799b65c91ad1a7b Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Mon, 3 Jul 2023 17:06:49 -0700 Subject: [PATCH 24/29] Another round of declarations. The dependency tree is very brittle. Adding an random require here or there changes the package load order, often uncovering a new interdependency; or worse, a new cylic dependency recursion. --- lisp/jabber-core.el | 1 + lisp/jabber-disco.el | 7 ++++++- lisp/jabber-iq.el | 11 +++++++++-- lisp/jabber-keepalive.el | 9 +++++++++ lisp/jabber-ping.el | 6 ++++++ lisp/jabber-register.el | 2 ++ lisp/jabber-roster.el | 1 + 7 files changed, 34 insertions(+), 3 deletions(-) diff --git a/lisp/jabber-core.el b/lisp/jabber-core.el index 615957c..ff3ff56 100644 --- a/lisp/jabber-core.el +++ b/lisp/jabber-core.el @@ -44,6 +44,7 @@ (require 'jabber-sasl) (require 'jabber-xml) (require 'jabber-console) +(require 'jabber-keepalive) (require 'fsm) diff --git a/lisp/jabber-disco.el b/lisp/jabber-disco.el index 1182eaf..959c3c1 100644 --- a/lisp/jabber-disco.el +++ b/lisp/jabber-disco.el @@ -23,9 +23,14 @@ (require 'jabber-xml) (require 'jabber-menu) +;; Global reference declarations + +(defvar jabber-presence-chain) ; jabber-core.el +(defvar jabber-connections) ; jabber-core.el + +;; ;;; Respond to disco requests -;;;###autoload (eval-after-load "jabber-core" '(add-to-list 'jabber-presence-chain #'jabber-process-caps)) diff --git a/lisp/jabber-iq.el b/lisp/jabber-iq.el index ec89a97..5ae87df 100644 --- a/lisp/jabber-iq.el +++ b/lisp/jabber-iq.el @@ -19,7 +19,6 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -(require 'jabber-core) (require 'jabber-util) (require 'jabber-alert) (require 'jabber-keymap) @@ -56,6 +55,13 @@ These fields are available at this moment: :type 'string :group 'jabber-browse) +;; Global reference declarations + +(declare-function jabber-send-sexp "jabber-core.el" (jc sexp)) +(defvar jabber-iq-chain) ; jabber-core.el + +;; + (defun jabber-browse-mode () "Jabber browse mode. \\{jabber-browse-mode-map}" @@ -70,7 +76,8 @@ These fields are available at this moment: (put 'jabber-browse-mode 'mode-class 'special) -(add-to-list 'jabber-iq-chain 'jabber-process-iq) +(eval-after-load "jabber-core" + '(add-to-list 'jabber-iq-chain 'jabber-process-iq)) (defun jabber-process-iq (jc xml-data) "Process an incoming iq stanza. diff --git a/lisp/jabber-keepalive.el b/lisp/jabber-keepalive.el index d1984bc..1d3e987 100644 --- a/lisp/jabber-keepalive.el +++ b/lisp/jabber-keepalive.el @@ -55,6 +55,15 @@ (defvar jabber-keepalive-debug nil "Log keepalive traffic when non-nil.") +;; Global reference declarations + +(declare-function jabber-send-string "jabber-core.el" (jc string)) +(declare-function jabber-disconnect-one "jabber-core.el" + (jc &optional dont-redisplay)) +(defvar jabber-connections) ; jabber-core.el + +;; + ;;;###autoload (defun jabber-keepalive-start (&optional _jc) "Activate keepalive. diff --git a/lisp/jabber-ping.el b/lisp/jabber-ping.el index 9582b0d..87418bc 100644 --- a/lisp/jabber-ping.el +++ b/lisp/jabber-ping.el @@ -23,6 +23,12 @@ (require 'jabber-menu) (require 'jabber-disco) +;; Global reference declarations + +(defvar jabber-connections) ; jabber-core.el + +;; + (add-to-list 'jabber-jid-info-menu (cons "Ping" 'jabber-ping)) diff --git a/lisp/jabber-register.el b/lisp/jabber-register.el index 4ff4c98..9fb1206 100644 --- a/lisp/jabber-register.el +++ b/lisp/jabber-register.el @@ -24,6 +24,8 @@ ;; Global reference declarations +(declare-function jabber-disconnect-one "jabber-core.el" + (jc &optional dont-redisplay)) (declare-function jabber-submit-search "jabber-search.el" (&rest _ignore)) (defvar jabber-buffer-connection) ; jabber-chatbuffer.el (defvar jabber-silent-mode) ; jabber.el diff --git a/lisp/jabber-roster.el b/lisp/jabber-roster.el index e851493..9526206 100644 --- a/lisp/jabber-roster.el +++ b/lisp/jabber-roster.el @@ -26,6 +26,7 @@ (require 'jabber-keymap) (require 'jabber-private) (require 'jabber-presence) +(require 'jabber-carbons) (require 'format-spec) (require 'ewoc) From 6384ed351a932c21662666e1d2a0349219764b64 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Mon, 3 Jul 2023 22:52:53 -0700 Subject: [PATCH 25/29] Small README update. Mention lexical-binding. The last of the cl -> cl-lib is complete. --- README.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 2cbbebb..3ddaab2 100644 --- a/README.org +++ b/README.org @@ -29,9 +29,10 @@ Old resources :END: 1. (WIP) Support for [[https://xmpp.org/extensions/xep-0363.html][XEP-0363: HTTP File Upload]] 2. Support for [[https://xmpp.org/extensions/xep-0280.html][XEP-0280: Message Carbons]] -3. Use of the deprecated =cl= library is almost completely replaced with =cl-lib= -4. Build system changed from Autotools to a =Makefile= -5. Lots of cleanup by addressing =checkdoc= and byte-compiler warnings - addition/improvement of docstrings, function/variable declarations, etc +3. All jabber packages now enable lexical-binding +4. Use of the deprecated =cl= library has been completely replaced with =cl-lib= +5. Build system changed from Autotools to a =Makefile= +6. Lots of cleanup by addressing =checkdoc= and byte-compiler warnings - addition/improvement of docstrings, function/variable declarations, etc ** Requirements :PROPERTIES: From 0deeba1b536892d1020e86d208c8187aec85c6df Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Wed, 5 Jul 2023 21:13:29 -0700 Subject: [PATCH 26/29] Address review comments on codeberg.org. Link to comments: https://codeberg.org/emacs-jabber/emacs-jabber/pulls/32#issuecomment-962327 Applied the (ignore (require ...)) suggestion and added `declare-function` forms for the `starttls-negotiate` and `starttls-open-stream`. Will address deprecation warnings in a follow on PR. Reworked "jabber-festival.el" to accommodate two alternate versions of the "festival.el" package. Tested both versions. Added `:group` to `defface`. --- lisp/jabber-conn.el | 11 ++++++---- lisp/jabber-festival.el | 48 +++++++++++++++++++++++++++++++++++------ lisp/jabber-muc.el | 3 ++- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index b1f11ef..3cc4895 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -30,13 +30,13 @@ (eval-when-compile (require 'cl-lib)) ;; Emacs 24 can be linked with GnuTLS -(ignore-errors (require 'gnutls)) +(require 'gnutls nil t) ;; Try two different TLS/SSL libraries, but don't fail if none available. -(or (ignore-errors (require 'tls)) - (ignore-errors (require 'ssl))) +(or (require 'tls nil t) + (require 'ssl nil t)) -(ignore-errors (require 'starttls)) +(require 'starttls nil t) (require 'srv) @@ -102,6 +102,9 @@ Third item is the send function.") ;; Global reference declarations +(declare-function starttls-negotiate "starttls.el" (process)) +(declare-function starttls-open-stream "starttls.el" + (name buffer host port)) (defvar jabber-process-buffer) ; jabber.el (defvar jabber-debug-keep-process-buffers) ; jabber.el diff --git a/lisp/jabber-festival.el b/lisp/jabber-festival.el index d96d733..7014b34 100644 --- a/lisp/jabber-festival.el +++ b/lisp/jabber-festival.el @@ -20,14 +20,48 @@ ;; Boston, MA 02111-1307, USA. (eval-when-compile (require 'jabber-alert)) +(require 'festival nil t) -(condition-case _e - (progn - ;; Most people don't have Festival, so this will often fail - (require 'festival) - (define-jabber-alert festival "Voice messages through Festival" - (lambda (text &optional title) (festival-say-string (or title text))))) - (error nil)) +;; Oddly enough, there are two different implementations of +;; festival.el. One is distributed with the festival package +;; (http://festvox.org/festival), which provides the speech-to-text +;; executable. The other was written by Dave Pearson +;; (https://github.com/davep/festival.el). +;; +;; EmacsWiki points to Pearson’s version. And that is the version +;; which straight.el's loads by default. Neither version is provided +;; by either GNU ELPA, or MELPA. +;; +;; The version bundled with the binary package supplies +;; ‘festival-say-string’, Pearson's version supplies ‘festival-say’ +;; instead. We support both, suppressing ‘check-declare’ warnings by +;; prefixing the filename with "ext:". + +;; Global reference declarations + +(declare-function festival-say-string "ext:festival.el" (say)) +(declare-function festival-say "ext:festival.el" (format &rest args)) + +;; + + +(when (featurep 'festival) + (cond + ((fboundp 'festival-say-string) + (define-jabber-alert + festival "Voice messages through Festival" + (lambda (text &optional title) + (festival-say-string (or title text))))) + ((fboundp 'festival-say) + (define-jabber-alert + festival "Voice messages through Festival" + (lambda (text &optional title) + (festival-say (or title text))))) + (t + (define-jabber-alert + festival "Voice messages through Festival" + (lambda (_text &optional _title) + (error "Unsupported festival.el implementation.")))))) (provide 'jabber-festival) ;; arch-tag: 8922D096-5D07-11D9-B4C2-000A95C2FCD0 diff --git a/lisp/jabber-muc.el b/lisp/jabber-muc.el index ad2c2ae..ca8fb59 100644 --- a/lisp/jabber-muc.el +++ b/lisp/jabber-muc.el @@ -1075,7 +1075,8 @@ JC is the Jabber connection." (defface jabber-muc-presence-dim '((t (:foreground "dark grey" :weight light :slant italic))) - "face for diminished presence notifications.") + "face for diminished presence notifications." + :group 'jabber-alerts) (defcustom jabber-muc-decorate-presence-patterns nil "List of regular expressions and face pairs. From 009054c079a5620f66f608368bda39d3d8d695a5 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Sun, 9 Jul 2023 08:47:40 -0700 Subject: [PATCH 27/29] Remove references 'tls and 'ssl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These deprecated packages are no longer needed. They have been replaced by 'gnutls since Emacs 24. There is a chance that relying on ’gnutls will disrupt usage on Windows. For that possibility refer users to "(emacs-gnutls) Help For Users" --- lisp/jabber-conn.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index 3cc4895..e9ca5fe 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -30,11 +30,12 @@ (eval-when-compile (require 'cl-lib)) ;; Emacs 24 can be linked with GnuTLS -(require 'gnutls nil t) - -;; Try two different TLS/SSL libraries, but don't fail if none available. -(or (require 'tls nil t) - (require 'ssl nil t)) +(condition-case e + (require 'gnutls) + (file-missing + (info + "(emacs-gnutls) Help For Users") + (signal (car e) (cdr e)))) (require 'starttls nil t) @@ -105,6 +106,12 @@ Third item is the send function.") (declare-function starttls-negotiate "starttls.el" (process)) (declare-function starttls-open-stream "starttls.el" (name buffer host port)) +(declare-function gnutls-negotiate "gnutls.el" + (&rest spec + &key process type hostname priority-string + trustfiles crlfiles keylist min-prime-bits + verify-flags verify-error verify-hostname-error + &allow-other-keys)) (defvar jabber-process-buffer) ; jabber.el (defvar jabber-debug-keep-process-buffers) ; jabber.el From 02ac80f065f81efd8e1a466fdbe61ed48b2e5974 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Wed, 12 Jul 2023 20:05:10 -0700 Subject: [PATCH 28/29] Be less invasive in the absence of 'gnutls. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow forward progress in the absence of 'gnutls. Allow messages generated by ‘jabber-network-conect-async’ or ‘jabber-network-connect’sync’ (Windows) to draw the user’s attention to the reason for connection failures. --- lisp/jabber-conn.el | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lisp/jabber-conn.el b/lisp/jabber-conn.el index e9ca5fe..2d345c3 100644 --- a/lisp/jabber-conn.el +++ b/lisp/jabber-conn.el @@ -30,12 +30,7 @@ (eval-when-compile (require 'cl-lib)) ;; Emacs 24 can be linked with GnuTLS -(condition-case e - (require 'gnutls) - (file-missing - (info - "(emacs-gnutls) Help For Users") - (signal (car e) (cdr e)))) +(require 'gnutls nil t) (require 'starttls nil t) From b941519b67a22ce09aa0b128bdfda0f55d64fab2 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Thu, 13 Jul 2023 18:42:59 -0700 Subject: [PATCH 29/29] Add description of frequent failure modes. --- README.org | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.org b/README.org index 3ddaab2..05c897f 100644 --- a/README.org +++ b/README.org @@ -113,6 +113,51 @@ Useful tips for debugging: - You can set the [[file:jabber.org::#debug-log-xml][jabber-debug-log-xml]] custom variable to ~t~ to enable the XML debug console. - The XML console is a buffer called ~*-jabber-console-ACCOUNT-*~ by default. Enable ~jabber-debug-log-xml~ and switch to that buffer to see the incoming and outgoing XML stanzas. See [[file:jabber.org::#xml-console-mode][xml-console-mode]]. +Common connection issues + +When a connection fails, there is usually a message in the echo area describing the failure. If the echo area has already been cleared, check the ~*Messages*~ buffer. + +Here are some of the common connection failure modes: + +*** No response beyond "Connecting..." + +#+begin_example +Connecting to :5222... +#+end_example + +This is likely a DNS lookup failure. Check the XMPP server name in ~jabber-account-list~. + +*** Host unknown +#+begin_example +: connection lost: ‘Unexpected stanza (error ((xmlns . http://etherx.jabber.org/streams)) (host-unknown ((xmlns . urn:ietf:params:xml:ns:xmpp-streams))) (text ((xmlns . urn:ietf:params:xml:ns:xmpp-streams)) This server does not serve ))’ +#+end_example + +This is likely a server misconfiguration in ~jabber-account-list~, or a misconfiguration of the XMPP server. Verify the Jabber ID (jid) specified in ~jabber-account-list~. If that looks correct, ensure the XMPP server responds to the configured port with something like: + +Alternatively, check for ~DNS~ ~SRV~ records pointing to an alternate port: + +#+begin_src sh +dig srv _xmpp-client._tcp.ccss.com +# -or- +dig srv _xmpps-client._tcp.ccss.com +#+end_src + +Check connectivity to the host and port with a tool like ~nc~ or ~openssl s_client~. + +*** Authentication failure +#+begin_example +STARTTLS encryption required, but disabled/non-functional at our end +#+end_example +This likely means that the "gnutls" package is not available. Check +#+begin_src emacs-lisp +(gnutls-available-p) +#+end_src +if that returns ~nil~, consult +#+begin_src emacs-lisp +(info "(emacs-gnutls) Help For Users") +#+end_src +for more details and potential mitigation. + ** fsm.el - the Finite State Machine library :PROPERTIES: :CUSTOM_ID: fsm