[climacs-devel] Question about the info-pane display function

Max-Gerd Retzlaff m.retzlaff at gmx.net
Fri Oct 21 16:56:41 UTC 2005


Hello

On Fri, Oct 21, 2005 at 05:41:24PM +0200, Troels Henriksen wrote:
> The display-function for the info-pane/modeline,
> climacs-gui::display-info, is very simple, and seems to be a bit
> hackish as well (as far as I can see, text for overwrite-mode,
> fill-mode and isearch-mode is hard-coded in the function). Is this
> simplicity by design, or is it merely a placeholder until something
> more flexible can be put in place? If the latter is the case, is
> anyone working on it? If not, I might be able to lend a hand, since it
> doesn't seem to require all kinds of arcane knowledge about CLIM. :-)
> 
> It should be simple enough to implement some kind of format-string
> system, where the order (and amount) of information in the pane can be
> customized by changing the string, until something like GNU Emacs'
> `mode-line-format'-variable and semantics can be developed.
> 
> What is your input on this?

Using FORMAT to just print (in contrast to PRESENT) some string seems
to be the wrong idea for a CLIM application. The contents of the info-pane
should be PRESENTed as the appropriate PRESENTATION TYPES. Consider the
following patch:

 -- zipp --

Index: gui.lisp
===================================================================
RCS file: /project/climacs/cvsroot/climacs/gui.lisp,v
retrieving revision 1.191
diff -a -u -r1.191 gui.lisp
--- gui.lisp    13 Oct 2005 09:34:12 -0000      1.191
+++ gui.lisp    21 Oct 2005 16:43:12 -0000
@@ -143,6 +143,17 @@
         minibuffer)))
   (:top-level (esa-top-level)))
 
+(define-presentation-translator climacs-buffer-to-pathname-translator
+    (climacs-buffer pathname global-climacs-table
+       :gesture :select
+       :tester ((object)
+                (filepath object))
+       :tester-definitive t
+       :documentation ((object stream)
+                       (format stream "Select pathname ~a" (namestring (filepath object)))))
+    (object)
+  (filepath object))
+
 (defun current-window ()
   (car (windows *application-frame*)))
 
@@ -187,7 +198,8 @@
        (formatting-cell (pane :min-width '(25 :character))
          (princ "  " pane)
          (with-text-face (pane :bold)
-           (princ (name buffer) pane)))
+            (with-output-as-presentation (pane buffer 'climacs-buffer)
+              (princ (name buffer) pane))))
        (formatting-cell (pane :min-width '(5 :character))
          (princ (cond ((and (mark= size bot)
                             (mark= 0 top))
cvs server: Diffing Doc
cvs server: Diffing Persistent
cvs server: Diffing cl-automaton
cvs server: Diffing testing

 -- zapp --

The name of the buffer will now be presented as a presentation of type
CLIMACS-BUFFER, therefore it will be highlighted as suitable input whenever
a climacs command wants a climacs buffer as a parameter, e.g. if you fire
up Switch To Buffer (CLIMACS-GUI::COM-SWITCH-TO-BUFFER).

Not only this but as there is a PRESENTATION TRANSLATOR from the type
CLIMACS-BUFFER to PATHNAME this piece of screen space will also be
highlighted and selectable if you fire up Find File
(CLIMACS-GUI::COM-SWITCH-TO-BUFFER), but only if the buffer is
actually associated with a file on the disk (hence the :TESTER for the
PRESENTATION TRANSLATOR).

Bye, Max

-- 
Max-Gerd Retzlaff <m.retzlaff at gmx.net>

For your amusement:
How many surrealists does it take to screw in a lightbulb?

One to hold the giraffe and one to fill the bathtub with brightly colored
power tools.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/climacs-devel/attachments/20051021/7ba28738/attachment.sig>


More information about the climacs-devel mailing list