/[gnats]/gnats/gnats/gnats.el
ViewVC logotype

Diff of /gnats/gnats/gnats.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by chewie, Mon Nov 14 22:36:57 2005 UTC revision 1.35 by chewie, Mon Nov 21 18:58:22 2005 UTC
# Line 85  If the environment variable is unset, \" Line 85  If the environment variable is unset, \"
85    :group 'gnats    :group 'gnats
86    :type 'boolean)    :type 'boolean)
87    
88    (defcustom gnats-menu-length 70
89      "*Maximum length of a name displayed on a popup menu."
90      :type 'integer
91      :group 'boolean)
92    
93    
94    
95  (defvar gnats-server-conn nil  (defvar gnats-server-conn nil
# Line 294  Use an X menu for the value selection." Line 299  Use an X menu for the value selection."
299    (sit-for 0)    (sit-for 0)
300    (gnats-request-enum (get-text-property (point) 'gnats-field-name) e))    (gnats-request-enum (get-text-property (point) 'gnats-field-name) e))
301    
302    (defun gnats-menu-build-paned-menu (name entries)
303      "Build a multi-paned menu named NAME from the strings in ENTRIES.
304    That is, ENTRIES is a list of strings which appear as the choices
305    in the menu.  The number of panes depends on the number of entries.
306    The visible entries are truncated to `gnats-menu-length', but the
307    strings returned are not."
308      (let* ((f-height (/ (frame-height) 2))
309             (pane-list
310              (let (temp-pane-list
311                    (iter 0))
312                (while entries
313                  (let (lst
314                        (count 0))
315                    (while (and (< count f-height) entries)
316                      (let ((str (car entries)))
317                        (setq lst (cons
318                                   (cons
319                                    (if (> (length str) gnats-menu-length)
320                                        (substring str 0 gnats-menu-length)
321                                      str)
322                                    str)
323                                   lst))
324                        (setq entries (cdr entries))
325                        (setq count (1+ count))))
326                    (setq iter (1+ iter))
327                    (setq
328                     temp-pane-list
329                     (cons
330                      (cons
331                       (format "-*- %s (%d) -*-" name iter)
332                       (nreverse lst))
333                      temp-pane-list))))
334                (nreverse temp-pane-list))))
335    
336        ;; Return the menu:
337        (cons (concat "-*- " name " -*-") pane-list)))
338    
339  (defun gnats-request-enum (field &optional menup no-default)  (defun gnats-request-enum (field &optional menup no-default)
340    "Ask the user for an enumerated value for FIELD and change the field value.    "Ask the user for an enumerated value for FIELD and change the field value.
341  If MENUP is non-nil, use an X menu for the selection.  If MENUP is non-nil, use an X menu for the selection.
# Line 305  minibuffer." Line 347  minibuffer."
347            (if menup            (if menup
348                (x-popup-menu                (x-popup-menu
349                 t                 t
350                 (list (concat "New value for " (get field 'field-name) ":")                 (gnats-menu-build-paned-menu
351                       (cons "" (mapcar (lambda (x) (cons (car x) (cadr x)))                  (concat "New value for " (get field 'field-name) ":")
352                                        completions))))                  (mapcar (lambda (x) (car x)) completions)))
353              (completing-read              (completing-read
354               (concat "New value for " (get field 'field-name) ": ")               (concat "New value for " (get field 'field-name) ": ")
355               completions nil t               completions nil t
# Line 1206  gnats-server-conn's `parsed-output' prop Line 1248  gnats-server-conn's `parsed-output' prop
1248  parsed, the `output-complete' property is set."  parsed, the `output-complete' property is set."
1249    (put gnats-server-conn 'curr-output    (put gnats-server-conn 'curr-output
1250         (concat (get gnats-server-conn 'curr-output) output))         (concat (get gnats-server-conn 'curr-output) output))
1251    (if (eq 10 (string-to-char (substring output -1)))    (if (eq ?\n (string-to-char (substring output -1)))
1252        (progn        (progn
1253          (gnats-debug-string (get gnats-server-conn 'curr-output))          (gnats-debug-string (get gnats-server-conn 'curr-output))
1254          (let ((our-output (get gnats-server-conn 'curr-output)))          (let ((our-output (get gnats-server-conn 'curr-output)))
# Line 1571  The function works in the query buffers. Line 1613  The function works in the query buffers.
1613    ;; TODO: Handle gnatsd errors.    ;; TODO: Handle gnatsd errors.
1614    (gnats-send-command "QFMT" "summary")    (gnats-send-command "QFMT" "summary")
1615    (gnats-send-command "RSET")    (gnats-send-command "RSET")
1616    (unless (string= query "")    (let* ((quer-cmd
1617      (gnats-send-command "EXPR" query))            (cond
1618    (let ((result (gnats-send-command "QUER")))             ((string-match "^\[0-9 \]\+$" query)
1619                (concat "QUER " query))
1620               (t
1621                (unless (string= query "")
1622                  (gnats-send-command "EXPR" query))
1623                "QUER")))
1624              (result (gnats-send-command quer-cmd)))
1625      (unless (= (caar result) 300)      (unless (= (caar result) 300)
1626        (error "Query error (%d %s)" (car (car result)) (cadr (car result))))        (error "Query error (%d %s)" (car (car result)) (cadr (car result))))
1627      (setq result (cdr result))      (setq result (cdr result))

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26