Changeset 14209


Ignore:
Timestamp:
Aug 24, 2010, 5:43:37 AM (9 years ago)
Author:
rme
Message:

New Hemlock command "Insert Sharp Comment", bound to M-#.

See ticket:725.

Location:
trunk/source/cocoa-ide/hemlock/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/hemlock/src/bindings.lisp

    r13186 r14209  
    411411(bind-key "Goto Absolute Line" #k"meta-g")
    412412;;;(bind-key "Set Package Name" #k"control-x p" :mode "Lisp")
     413(bind-key "Insert Sharp Comment" #k"meta-#")
    413414
    414415#+listener-bindings
  • trunk/source/cocoa-ide/hemlock/src/lispmode.lisp

    r13552 r14209  
    23002300  (variable-value 'current-package :buffer buffer)
    23012301||#               
     2302
     2303(defcommand "Insert Sharp Comment" (p)
     2304  "Inserts #| |# around the selection and puts point between them."
     2305  (declare (ignore p))
     2306  (multiple-value-bind (start end) (buffer-selection-range (current-buffer))
     2307    (let ((point (current-point)))
     2308      (cond ((= start end)
     2309             (insert-string point "#|")
     2310             (insert-character point #\newline)
     2311             (insert-character point #\newline)
     2312             (insert-string point "|#")
     2313             (character-offset point -3))
     2314            (t
     2315             (with-mark ((start-mark point :left-inserting)
     2316                         (end-mark point :left-inserting))
     2317               (move-to-absolute-position start-mark start)
     2318               (move-to-absolute-position end-mark end)
     2319               (insert-string start-mark "#|
     2320")
     2321               (insert-string end-mark "
     2322|#")))))))
Note: See TracChangeset for help on using the changeset viewer.