Changeset 803


Ignore:
Timestamp:
Apr 30, 2004, 7:31:26 PM (21 years ago)
Author:
Gary Byers
Message:

Arglist stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/hemlock/src/lispmode.lisp

    r6 r803  
    18371837  :value 'indent-for-lisp
    18381838  :mode "Lisp")
     1839
     1840(defun string-to-arglist (string buffer) 
     1841  (let* ((name
     1842          (let* ((*package* (or
     1843                             (find-package
     1844                              (variable-value 'current-package :buffer buffer))
     1845                             *package*)))
     1846            (read-from-string string))))
     1847    (when (and (typep name 'symbol))
     1848      (multiple-value-bind (arglist win)
     1849          (ccl::arglist-string name)
     1850        (format nil "~S : ~A" name (if win (or arglist "()") "(unknown)"))))))
     1851
     1852(defcommand "Current Function Arglist" (p)
     1853  "Show arglist of function whose name precedes point."
     1854  "Show arglist of function whose name precedes point."
     1855  (declare (ignore p))
     1856  (let ((point (current-point)))
     1857    (pre-command-parse-check point)
     1858    (with-mark ((mark1 point)
     1859                (mark2 point))
     1860      (when (backward-up-list mark1)
     1861        (when (form-offset (move-mark mark2 (mark-after mark1)) 1)
     1862          (let* ((fun-name (region-to-string (region mark1 mark2)))
     1863                 (arglist-string (string-to-arglist fun-name (current-buffer))))
     1864            (when arglist-string
     1865              (message arglist-string))))))))
     1866
     1867(defcommand "Arglist On Space" (p)
     1868  "Insert a space, then show the current function's arglist."
     1869  "Insert a space, then show the current function's arglist."
     1870  (declare (ignore p))
     1871  (let ((point (current-point)))
     1872    (insert-character point #\Space)
     1873    (pre-command-parse-check point)
     1874    (with-mark ((mark1 point)
     1875                (mark2 point))
     1876      (when (backward-up-list mark1)
     1877        (when (form-offset (move-mark mark2 (mark-after mark1)) 1)
     1878          (with-mark ((mark3 mark2))
     1879            (do* ()
     1880                 ((mark= mark3 point)
     1881                  (let* ((fun-name (region-to-string (region mark1 mark2)))
     1882                         (arglist-string
     1883                          (string-to-arglist fun-name (current-buffer))))
     1884                    (when arglist-string
     1885                      (message arglist-string))))
     1886              (if (ccl::whitespacep (next-character mark3))
     1887                (mark-after mark3)
     1888                (return nil)))))))))
     1889
     1890               
Note: See TracChangeset for help on using the changeset viewer.