Merge commit 'jao/emacs'
commit
f886d50dd2
|
@ -74,6 +74,9 @@ beast.
|
|||
|
||||
- C-cz : switch to listener
|
||||
- C-co : cycle between code, tests and docs factor files
|
||||
- C-cs : switch to other factor buffer (M-x fuel-switch-to-buffer)
|
||||
- C-x4s : switch to other factor buffer in other window
|
||||
- C-x5s : switch to other factor buffer in other frame
|
||||
|
||||
- M-. : edit word at point in Emacs (see fuel-edit-word-method custom var)
|
||||
- M-, : go back to where M-. was last invoked
|
||||
|
|
|
@ -132,6 +132,32 @@ was last invoked."
|
|||
(pop-tag-mark)
|
||||
(error "No previous location for find word or vocab invokation")))
|
||||
|
||||
(defvar fuel-edit--buffer-history nil)
|
||||
|
||||
(defun fuel-switch-to-buffer (&optional method)
|
||||
"Switch to any of the existing Factor buffers, with completion."
|
||||
(interactive)
|
||||
(let ((buffer (completing-read "Factor buffer: "
|
||||
(remove (buffer-name)
|
||||
(mapcar 'buffer-name (buffer-list)))
|
||||
'(lambda (s) (string-match "\\.factor$" s))
|
||||
t
|
||||
nil
|
||||
fuel-edit--buffer-history)))
|
||||
(cond ((eq method 'window) (switch-to-buffer-other-window buffer))
|
||||
((eq method 'frame) (switch-to-buffer-other-frame buffer))
|
||||
(t (switch-to-buffer buffer)))))
|
||||
|
||||
(defun fuel-switch-to-buffer-other-window ()
|
||||
"Switch to any of the existing Factor buffers, in other window."
|
||||
(interactive)
|
||||
(fuel-switch-to-buffer 'window))
|
||||
|
||||
(defun fuel-switch-to-buffer-other-frame ()
|
||||
"Switch to any of the existing Factor buffers, in other frame."
|
||||
(interactive)
|
||||
(fuel-switch-to-buffer 'frame))
|
||||
|
||||
|
||||
(provide 'fuel-edit)
|
||||
;;; fuel-edit.el ends here
|
||||
|
|
|
@ -73,18 +73,20 @@
|
|||
;;; Font lock:
|
||||
|
||||
(defun fuel-font-lock--syntactic-face (state)
|
||||
(cond ((nth 3 state) 'factor-font-lock-string)
|
||||
((char-equal (char-after (nth 8 state)) ?\ )
|
||||
(save-excursion
|
||||
(goto-char (nth 8 state))
|
||||
(beginning-of-line)
|
||||
(cond ((looking-at "USING: ") 'factor-font-lock-vocabulary-name)
|
||||
((looking-at "\\(TUPLE\\|SYMBOLS\\|VARS\\): ")
|
||||
'factor-font-lock-symbol)
|
||||
(t 'default))))
|
||||
((char-equal (char-after (nth 8 state)) ?U)
|
||||
'factor-font-lock-parsing-word)
|
||||
(t 'factor-font-lock-comment)))
|
||||
(if (nth 3 state) 'factor-font-lock-string
|
||||
(let ((c (char-after (nth 8 state))))
|
||||
(cond ((char-equal c ?\ )
|
||||
(save-excursion
|
||||
(goto-char (nth 8 state))
|
||||
(beginning-of-line)
|
||||
(cond ((looking-at "USING: ") 'factor-font-lock-vocabulary-name)
|
||||
((looking-at "\\(TUPLE\\|SYMBOLS\\|VARS\\): ")
|
||||
'factor-font-lock-symbol)
|
||||
(t 'default))))
|
||||
((char-equal c ?U) 'factor-font-lock-parsing-word)
|
||||
((char-equal c ?\() 'factor-font-lock-stack-effect)
|
||||
((char-equal c ?\") 'factor-font-lock-string)
|
||||
(t 'factor-font-lock-comment)))))
|
||||
|
||||
(defconst fuel-font-lock--font-lock-keywords
|
||||
`((,fuel-syntax--stack-effect-regex . 'factor-font-lock-stack-effect)
|
||||
|
@ -135,16 +137,18 @@
|
|||
|
||||
;;; Fontify strings as Factor code:
|
||||
|
||||
(defvar fuel-font-lock--font-lock-buffer
|
||||
(let ((buffer (get-buffer-create " *fuel font lock*")))
|
||||
(set-buffer buffer)
|
||||
(set-syntax-table fuel-syntax--syntax-table)
|
||||
(fuel-font-lock--font-lock-setup)
|
||||
buffer))
|
||||
(defun fuel-font-lock--font-lock-buffer ()
|
||||
(let ((name " *fuel font lock*"))
|
||||
(or (get-buffer name)
|
||||
(let ((buffer (get-buffer-create name)))
|
||||
(set-buffer buffer)
|
||||
(set-syntax-table fuel-syntax--syntax-table)
|
||||
(fuel-font-lock--font-lock-setup)
|
||||
buffer))))
|
||||
|
||||
(defun fuel-font-lock--factor-str (str)
|
||||
(save-current-buffer
|
||||
(set-buffer fuel-font-lock--font-lock-buffer)
|
||||
(set-buffer (fuel-font-lock--font-lock-buffer))
|
||||
(erase-buffer)
|
||||
(insert str)
|
||||
(let ((font-lock-verbose nil)) (font-lock-fontify-buffer))
|
||||
|
|
|
@ -177,6 +177,9 @@ interacting with a factor listener is at your disposal.
|
|||
(fuel-mode--key-1 ?l 'fuel-run-file)
|
||||
(fuel-mode--key-1 ?r 'fuel-eval-region)
|
||||
(fuel-mode--key-1 ?z 'run-factor)
|
||||
(fuel-mode--key-1 ?s 'fuel-switch-to-buffer)
|
||||
(define-key fuel-mode-map "\C-x4s" 'fuel-switch-to-buffer-other-window)
|
||||
(define-key fuel-mode-map "\C-x5s" 'fuel-switch-to-buffer-other-frame)
|
||||
|
||||
(define-key fuel-mode-map "\C-\M-x" 'fuel-eval-definition)
|
||||
(define-key fuel-mode-map "\C-\M-r" 'fuel-eval-extended-region)
|
||||
|
|
|
@ -240,14 +240,15 @@
|
|||
|
||||
(defconst fuel-syntax--syntactic-keywords
|
||||
`(;; CHARs:
|
||||
("CHAR: \\(.\\)\\( \\|$\\)" (1 "w"))
|
||||
("\\(CHAR:\\|POSTPONE:\\|\\\\\\) \\(.\\)\\( \\|$\\)" (2 "w"))
|
||||
;; Comments:
|
||||
("\\_<\\(#?!\\) .*\\(\n\\|$\\)" (1 "<") (2 ">"))
|
||||
("\\_<\\(#?!\\)\\(\n\\|$\\)" (1 "<") (2 ">"))
|
||||
("\\_<\\((\\) \\([^)\n]*?\\) \\()\\)\\_>" (1 "<b") (2 "w") (3 ">b"))
|
||||
;; Strings
|
||||
("\\_<\\(\"\\)\\([^\n\r\f\"]\\|\\\\\"\\)*\\(\"\\)\\_>" (1 "\"") (3 "\""))
|
||||
("\\_<<\\(\"\\)\\_>" (1 "\""))
|
||||
("\\_<\\(\"\\)>\\_>" (1 "\""))
|
||||
("\\_<<\\(\"\\)\\_>" (1 "<b"))
|
||||
("\\_<\\(\"\\)>\\_>" (1 ">b"))
|
||||
;; Multiline constructs
|
||||
("\\_<\\(U\\)SING: \\(;\\)" (1 "<b") (2 ">b"))
|
||||
("\\_<USING:\\( \\)" (1 "<b"))
|
||||
|
|
Loading…
Reference in New Issue