[Openmcl-devel] indent3, and fonts

Ron Garret ron at flownet.com
Wed Apr 4 09:15:07 PDT 2012


On Apr 4, 2012, at 2:12 AM, Joakim Sandgren wrote:

> Hi,
> 1.
> So you can have indent and indent form bound to tab. 
> but not indent region.


; Fix the indent command to indent the current selection if there is one

(defcommand "Indent" (p)
  "Invokes function held by the Hemlock variable \"Indent Function\",
  moving point past region if called with argument."
  (if (region-active-p)
    (let ((region (current-region)))
      (with-mark ((start (region-start region) :left-inserting)
                  (end (region-end region) :left-inserting))
        (indent-region-for-commands (region start end))))
    (let ((point (current-point)))
      (with-mark ((mark point :left-inserting))
        (cond ((or (not p) (zerop p))
               (funcall (value indent-function) mark)
               (when (mark< point mark)
                 (move-mark point mark)))
              (t
               (if (plusp p)
                 (unless (line-offset point (1- p))
                   (buffer-end point))
                 (unless (line-offset mark (1+ p))
                   (buffer-start mark)))
               (indent-region-for-commands (region mark point))
               (find-attribute (line-start point) :whitespace #'zerop)))))))

> 2.
> My indent aligning problem in a previous mail was due to my font use : trebuchet.
> It is obviously only monospace fonts that give a correct indentation in clozure.
> I wasn't aware of that since all types of fonts indent correctly in mcl...
> How can this difference be?

Because MCL was built from the ground-up a a Mac application, so it knew about font widths.  CCL uses Hemlock as its editor, which is a legacy application that doesn't know about font widths and assumes everything is rendered with a fixed width font.

rg





More information about the Openmcl-devel mailing list