Changeset 12887


Ignore:
Timestamp:
Sep 28, 2009, 2:01:36 PM (10 years ago)
Author:
rme
Message:

trunk changes r12874 through r12886

Location:
branches/watchpoints
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/watchpoints/cocoa-ide/cocoa-editor.lisp

    r12859 r12887  
    14911491                                    (> (#/clickCount event) 1))))))
    14921492           (let* ((cache (hemlock-buffer-string-cache (#/hemlockString textstorage)))
    1493                   (buffer (if cache (buffer-cache-buffer cache))))
    1494              (when (and buffer (string= (hi::buffer-major-mode buffer) "Lisp"))
    1495                (let* ((hi::*current-buffer* buffer))
    1496                  (hi::with-mark ((m1 (hi::buffer-point buffer)))
    1497                    (setq index (hi:mark-absolute-position m1))
    1498                    (hemlock::pre-command-parse-check m1)
    1499                    (when (hemlock::valid-spot m1 nil)
    1500                      (cond ((eql (hi::next-character m1) #\()
    1501                             (hi::with-mark ((m2 m1))
    1502                               (when (hemlock::list-offset m2 1)
    1503                                 (ns:init-ns-range r index (- (hi:mark-absolute-position m2) index))
    1504                                 (return-from HANDLED r))))
    1505                            ((eql (hi::previous-character m1) #\))
    1506                             (hi::with-mark ((m2 m1))
    1507                               (when (hemlock::list-offset m2 -1)
    1508                                 (ns:init-ns-range r (hi:mark-absolute-position m2) (- index (hi:mark-absolute-position m2)))
    1509                                 (return-from HANDLED r))))))))))))       
    1510        (call-next-method proposed g)
    1511        #+debug
    1512        (#_NSLog #@"range = %@, proposed = %@, granularity = %d"
    1513                 :address (#_NSStringFromRange r)
    1514                 :address (#_NSStringFromRange proposed)
    1515                 :<NSS>election<G>ranularity g))))
    1516 
    1517 
     1493                  (buffer (buffer-cache-buffer cache))
     1494                  (hi::*current-buffer* buffer)
     1495                  (point (hi::buffer-point buffer)))
     1496             (hi::with-mark ((mark point))
     1497               (move-hemlock-mark-to-absolute-position mark cache index)
     1498               (when (selection-offset-for-double-click buffer mark)
     1499                 ;; Act as if we started the selection at the other end, so the heuristic
     1500                 ;; in #/selectionRangeForProposedRange does the right thing.  ref bug #565.
     1501                 (hi::move-mark point mark)
     1502                 (let ((start index)
     1503                       (end (hi::mark-absolute-position mark)))
     1504                   (when (< end start) (rotatef start end))
     1505                   (ns:init-ns-range r start (- end start)))
     1506                 #+debug
     1507                 (#_NSLog #@"range = %@, proposed = %@, granularity = %d"
     1508                          :address (#_NSStringFromRange r)
     1509                          :address (#_NSStringFromRange proposed)
     1510                          :<NSS>election<G>ranularity g)
     1511                 (return-from HANDLED r))))))
     1512       (prog1
     1513           (call-next-method proposed g)
     1514         #+debug
     1515         (#_NSLog #@"range = %@, proposed = %@, granularity = %d"
     1516                  :address (#_NSStringFromRange r)
     1517                  :address (#_NSStringFromRange proposed)
     1518                  :<NSS>election<G>ranularity g)))))
     1519
     1520;; Return nil to use the default Cocoa selection, which will be word for double-click, line for triple.
     1521;; TODO: make this consistent with "current sexp".
     1522(defun selection-offset-for-double-click (buffer mark)
     1523  (when (string= (hi::buffer-major-mode buffer) "Lisp") ;; gag
     1524    (hemlock::pre-command-parse-check mark)
     1525    (when (hemlock::valid-spot mark nil)
     1526      (cond ((eql (hi::next-character mark) #\()
     1527             (hemlock::list-offset mark 1))
     1528            ((eql (hi::previous-character mark) #\))
     1529             (hemlock::list-offset mark -1))))))
    15181530
    15191531(defun append-output (view string)
     
    15341546     (affinity :<NSS>election<A>ffinity)
    15351547     (still-selecting :<BOOL>))
    1536   #+debug
    1537   (#_NSLog #@"Set selected range called: location = %d, length = %d, affinity = %d, still-selecting = %d"
    1538            :int (pref r :<NSR>ange.location)
    1539            :int (pref r :<NSR>ange.length)
     1548  #+debug
     1549  (#_NSLog #@"Set selected range called: range = %@, affinity = %d, still-selecting = %d"
     1550           :address (#_NSStringFromRange r)
    15401551           :<NSS>election<A>ffinity affinity
    15411552           :<BOOL> (if still-selecting #$YES #$NO))
  • branches/watchpoints/cocoa-ide/hemlock/src/edit-defs.lisp

    r12651 r12887  
    9393        (error (c) (editor-error (format nil "~a" c)))))))
    9494     
    95 
    96 #|
    97 ;;; "Edit Command Definition" is a hack due to creeping evolution in
    98 ;;; GO-TO-DEFINITION.  We specify :function type and a name with "-COMMAND"
    99 ;;; instead of :command type and the real command name because this causes
    100 ;;; the right pattern to be created for searching.  We could either specify
    101 ;;; that you always edit command definitions with this command (breaking
    102 ;;; "Go to Definition" for commands called as functions), fixing the code,
    103 ;;; or we can hack this command so everything works.
    104 ;;;
    10595(defcommand "Edit Command Definition" (p)
    106   "Prompts for command definition name and goes to it for editing."
    10796  "Prompts for command definition name and goes to it for editing."
    10897  (multiple-value-bind
     
    116105        (prompt-for-keyword :tables (list *command-names*)
    117106                            :prompt "Command to edit: "))
    118     (go-to-definition (fun-defined-from-pathname (command-function command))
    119                       :function
    120                       (concatenate 'simple-string name "-COMMAND"))))
    121 
     107    (declare (ignore name))
     108    (handler-case (edit-definition (command-function command))
     109      (error (c) (editor-error (format nil "~a" c))))))
     110
     111#|
    122112;;; FUN-DEFINED-FROM-PATHNAME takes a symbol or function object.  It
    123113;;; returns a pathname for the file the function was defined in.  If it was
  • branches/watchpoints/cocoa-ide/hemlock/src/listener.lisp

    r12859 r12887  
    601601
    602602(defcommand "Editor Evaluate Defun" (p)
    603   "Evaluates the current or next top-level form in the editor Lisp.
     603  "Evaluates the current or next top-level form.
    604604   If the current region is active, this evaluates the region."
    605   "Evaluates the current or next top-level form in the editor Lisp."
    606605  (declare (ignore p))
    607606  (if (region-active-p)
     
    610609
    611610(defcommand "Editor Evaluate Region" (p)
    612   "Evaluates lisp forms between the point and the mark in the editor Lisp."
    613   "Evaluates lisp forms between the point and the mark in the editor Lisp."
     611  "Evaluates lisp forms between the point and the mark"
    614612  (declare (ignore p))
    615613  (if (region-active-p)
     
    634632(defcommand "Editor Re-evaluate Defvar" (p)
    635633  "Evaluate the current or next top-level form if it is a DEFVAR.  Treat the
    636    form as if the variable is not bound.  This occurs in the editor Lisp."
    637   "Evaluate the current or next top-level form if it is a DEFVAR.  Treat the
    638    form as if the variable is not bound.  This occurs in the editor Lisp."
     634   form as if the variable is not bound."
    639635  (declare (ignore p))
    640636  (with-input-from-region (stream (defun-region (current-point)))
  • branches/watchpoints/level-1/l1-streams.lisp

    r12842 r12887  
    34263426
    34273427(defmethod stream-external-format ((s character-stream))
    3428   (make-external-format :character-encoding #+big-endian-target :utf32-be #+little-endian-target :utf32-le :line-termination :unix))
     3428  (make-external-format :character-encoding #+big-endian-target :utf-32be #+little-endian-target :utf-32le :line-termination :unix))
    34293429
    34303430
  • branches/watchpoints/tools/advice-profiler/profiler.lisp

    r11463 r12887  
    121121    (ccl:rlet ((ts :mach_timespec))
    122122      (unless (zerop (#_clock_get_time (%get-ptr clock-port) ts))
    123         (error "error reading clock ~A: ~A~%" id (ccl::%strerror (ccl::%get-errno))))
     123        (error "error reading Mach clock: ~A~%" (ccl::%strerror (ccl::%get-errno))))
    124124      (mach-timespec->nanoseconds ts))))
    125125
Note: See TracChangeset for help on using the changeset viewer.