Gnus -- minor build / warning fixes [OK For Upstream]
[gnus] / lisp / assistant.el
index 4709870..dd71597 100644 (file)
@@ -8,7 +8,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -17,9 +17,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 
 ;;; Commentary:
 
 (require 'widget)
 (require 'wid-edit)
 
 (require 'widget)
 (require 'wid-edit)
 
+(autoload 'gnus-error "gnus-util")
+(autoload 'netrc-get "netrc")
+(autoload 'netrc-machine "netrc")
+(autoload 'netrc-parse "netrc")
+
 (defvar assistant-readers
   '(("variable" assistant-variable-reader)
     ("validate" assistant-sexp-reader)
 (defvar assistant-readers
   '(("variable" assistant-variable-reader)
     ("validate" assistant-sexp-reader)
@@ -72,7 +75,7 @@
                    (forward-line 1)))
              (skip-chars-forward " \t")
              (prog1
                    (forward-line 1)))
              (skip-chars-forward " \t")
              (prog1
-                 (buffer-substring (point) (line-end-position))
+                 (buffer-substring (point) (point-at-eol))
                (forward-line 1))))
       (push (list command (assistant-reader command value))
            results))
                (forward-line 1))))
       (push (list command (assistant-reader command value))
            results))
          (setq result (if raw (nth 3 elem)
                         (format "%s" (nth 3 elem)))))))
     result))
          (setq result (if raw (nth 3 elem)
                         (format "%s" (nth 3 elem)))))))
     result))
-    
+
 (defun assistant-set-variable (node variable value)
   (let ((variables (assistant-get-list node "variable"))
        elem)
 (defun assistant-set-variable (node variable value)
   (let ((variables (assistant-get-list node "variable"))
        elem)
       (setq elem (cadr elem))
       (when (eq (intern variable) (car elem))
        (setcar (nthcdr 3 elem) value)))))
       (setq elem (cadr elem))
       (when (eq (intern variable) (car elem))
        (setcar (nthcdr 3 elem) value)))))
-    
+
 (defun assistant-render-text (text node)
   (unless (and text node)
 (defun assistant-render-text (text node)
   (unless (and text node)
-    (gnus-error 
-     5 
+    (gnus-error
+     5
      "The assistant was asked to render invalid text or node data"))
   (dolist (elem text)
     (if (stringp elem)
      "The assistant was asked to render invalid text or node data"))
   (dolist (elem text)
     (if (stringp elem)
            (cadr type))
           assistant-widgets))
         (t
            (cadr type))
           assistant-widgets))
         (t
-         (push 
+         (push
           (widget-create
            'editable-field
            :value-face 'assistant-field
            :assistant-variable variable
            (assistant-get-variable node variable))
           assistant-widgets)
           (widget-create
            'editable-field
            :value-face 'assistant-field
            :assistant-variable variable
            (assistant-get-variable node variable))
           assistant-widgets)
-         ;; The editable-field widget apparently inserts a newline;
-         ;; remove it.
-         (delete-char -1)
          (add-text-properties start (point)
          (add-text-properties start (point)
-                              (list
-                               'bold t
-                               'face 'assistant-field
-                               'not-read-only t))))))))
+                              (list
+                               'bold t
+                               'face 'assistant-field
+                               'not-read-only t)))))))
+  (widget-setup))
 
 (defun assistant-render-node (node-name)
   (let ((node (assistant-find-node node-name))
 
 (defun assistant-render-node (node-name)
   (let ((node (assistant-find-node node-name))
     (setq variable (cadr variable))
     (let ((type (nth 1 variable))
          (value (nth 3 variable)))
     (setq variable (cadr variable))
     (let ((type (nth 1 variable))
          (value (nth 3 variable)))
-      (when 
+      (when
          (cond
           ((eq type :number)
            (string-match "[^0-9]" value))
          (cond
           ((eq type :number)
            (string-match "[^0-9]" value))
 (defun assistant-find-next-nodes (&optional node)
   (let* ((node (assistant-find-node (or node assistant-current-node)))
         (nexts (assistant-get-list node "next"))
 (defun assistant-find-next-nodes (&optional node)
   (let* ((node (assistant-find-node (or node assistant-current-node)))
         (nexts (assistant-get-list node "next"))
-        next elem applicable return)
+        elem applicable return)
 
     (while (setq elem (pop nexts))
       (when (assistant-eval (car (cadr elem)))
        (setq applicable (cons elem applicable))))
 
     ;; return the first thing we can
 
     (while (setq elem (pop nexts))
       (when (assistant-eval (car (cadr elem)))
        (setq applicable (cons elem applicable))))
 
     ;; return the first thing we can
-    
+
     (while (setq elem (pop applicable))
       (push (cadr (cadr elem)) return))
 
     (while (setq elem (pop applicable))
       (push (cadr (cadr elem)) return))
 
            (append (assistant-get-list node "variable")
                    variables)))
     variables))
            (append (assistant-get-list node "variable")
                    variables)))
     variables))
-  
+
 (defun assistant-eval (form)
   (let ((bindings nil))
     (dolist (variable (assistant-get-all-variables))
       (setq variable (cadr variable))
 (defun assistant-eval (form)
   (let ((bindings nil))
     (dolist (variable (assistant-get-all-variables))
       (setq variable (cadr variable))
-      (push (list (car variable) 
+      (push (list (car variable)
                  (if (eq (nth 3 variable) 'default)
                      nil
                    (if (listp (nth 3 variable))
                  (if (eq (nth 3 variable) 'default)
                      nil
                    (if (listp (nth 3 variable))
 
 (provide 'assistant)
 
 
 (provide 'assistant)
 
-;;; arch-tag: 0404bfa2-9226-4611-8d3f-335c2416175b
 ;;; assistant.el ends here
 ;;; assistant.el ends here