changelog shortlog tags changeset files revisions annotate raw

cq.el

changeset 66: 5b737eefe5ea
parent:1fae210bc469
author: kim.vanwyk
date: Wed Nov 10 15:19:03 2010 +0200 (18 months ago)
permissions: -rw-r--r--
description: Adding CSharp Mode and Google Weather
1(defvar funclist)
2(defvar cq-compilation-started 'nil)
3(defun cg-init ()
4 (setq compilation-finish-functions 'cq-call) ;; this function called when compilation has finished - see compile.el
5 (setq compilation-exit-message-function
6 (lambda (status code msg)
7 ;; If M-x compile exists with a 0
8 (when (and (eq status 'exit) (zerop code))
9 ;; then bury the *compilation* buffer, so that C-x b doesn't go there
10 (bury-buffer "*compilation*")
11 ;; and return to whatever were looking at before
12 (replace-buffer-in-windows "*compilation*"))
13 ;; Always return the anticipated result of compilation-exit-message-function
14 (message "Compilation Error")
15 (cons msg code)))
16)
17
18(defun cq-add ()
19"Adds function before point to a queue. The first function is called when there are at least two functions in the queue"
20 (interactive)
21 (save-excursion
22 (search-backward-regexp "(\\(.*\\))")
23 (if (boundp 'funclist)
24 (add-to-list 'funclist (intern (match-string-no-properties 1)) t)
25 (setq funclist (list (intern (match-string-no-properties 1)))))
26 (setq overlay-arrow-position (make-marker))
27 (setq overlay-arrow-string "1")
28 (set-marker overlay-arrow-position (line-beginning-position)
29 (current-buffer))
30
31 (message "Added %s" (match-string-no-properties 1))
32 (unless cq-compilation-started (cq-start))
33 )
34 )
35
36(defun cq-add-func (func)
37 "Adds function given as argument to a queue. The first function is called when there are at least two functions in the queue"
38(interactive)
39 (if (boundp 'funclist)
40 (add-to-list 'funclist (func) t)
41
42 (setq funclist (list func)))
43 (message "Added %s" func)
44 (unless cq-compilation-started (cq-start))
45 )
46
47
48;;(setq compilation-finish-functions 'nil)
49(setq compilation-finish-functions 'cq-call) ;; this function called when compilation has finished - see compile.el
50
51(defun cq-call (buffer string)
52 "Calls the next function in the global variable funclist"
53 (if (and (boundp 'funclist) (not (eq funclist nil))) (funcall (pop funclist))
54 (cq-after-compilation)
55 (setq cq-compilation-started 'nil)) ;; while list is not nil!
56
57 )
58
59(defun cq-start ()
60"Starts the compilation process"
61(interactive)
62(if (boundp 'funclist) (progn
63 (funcall (pop funclist))
64 (setq cq-compilation-started 't))
65 (message "Queue is empty!"))
66)
67
68(defun cq-display ()
69"Displays the compilation queue"
70(interactive)
71(if (boundp 'funclist) (print funclist t))
72)
73
74(defun cq-clear ()
75"Clears the compilation queue"
76(interactive)
77(if (boundp 'funclist)
78 (progn
79 (setq funclist ())
80 (setq cq-compilation-started 'nil)))
81)
82
83(defun cq-mouse-add ()
84(interactive)
85
86)
87
88(defun cq-after-compilation ()
89
90 (setq visible-bell 'nil)
91 (beep t)
92 (setq visible-bell t)
93)
94
95(provide 'cq)