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