Changeset 12123


Ignore:
Timestamp:
May 24, 2009, 7:31:01 AM (10 years ago)
Author:
gb
Message:

When processing PACKAGE file option, set both CURRENT-PACKAGE and
DEFAULT-PACKAGE buffer-local variables. Try to use CCL::OLD-IN-PACKAGE
to process package option for effect (e.g., to handle those LispM-style
package specifications that MCL handled.)

File:
1 edited

Legend:

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

    r11894 r12123  
    3131
    3232(define-file-option "Package" (buffer value)
    33   (defhvar "Current Package"
    34     "The package used for evaluation of Lisp in this buffer."
    35     :buffer buffer
    36     :value
    37     (let ((thing (handler-case (read-from-string value t)
    38                    (error () (editor-error "Bad package file option value")))))
    39       (cond
    40        ((or (stringp thing) (symbolp thing))
    41         (string thing))
    42        ((and (consp thing) ;; e.g. Package: (foo :use bar)
    43              (or (stringp (car thing)) (symbolp (car thing))))
    44         (string (car thing)))
    45        (t
    46         (message "Ignoring \"package:\" file option ~a" thing)
    47         nil)))
    48     :hooks (list 'package-name-change-hook)))
     33  (let* ((thing (handler-case (read-from-string value t)
     34                  (error () (editor-error "Bad package file option value"))))
     35         (name
     36          (cond
     37           ((or (stringp thing) (symbolp thing))
     38            (string thing))
     39           ((and (consp thing) ;; e.g. Package: (foo :use bar)
     40                 (or (stringp (car thing)) (symbolp (car thing))))
     41            (string (car thing)))
     42           (t
     43            (message "Ignoring \"package:\" file option ~a" thing)
     44            nil))))
     45    (when name
     46      (ignore-errors (let* ((*package* *package*))
     47                       (apply 'ccl::old-in-package (if (atom thing) (list thing) thing)))))
     48    (defhvar "Current Package"
     49      "The package used for evaluation of Lisp in this buffer."
     50      :buffer buffer
     51      :value (or name (package-name *package*))
     52      :hooks (list 'package-name-change-hook))
     53    (defhvar "Default Package"
     54      "The buffer's default package."
     55      :buffer buffer
     56      :value (or name (package-name *package*)))))
     57     
    4958
    5059
Note: See TracChangeset for help on using the changeset viewer.