Compilation queue (cq.el)

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

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.