compile.elc 6.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. (provide (quote compile))
  2. (defvar compilation-process nil "\
  3. Process created by compile command, or nil if none exists now.
  4. Note that the process may have been \"deleted\" and still
  5. be the value of this variable.")
  6. (defvar compilation-error-list nil "\
  7. List of error message descriptors for visiting erring functions.
  8. Each error descriptor is a list of length two.
  9. Its car is a marker pointing to an error message.
  10. Its cadr is a marker pointing to the text of the line the message is about,
  11. or nil if that is not interesting.
  12. The value may be t instead of a list;
  13. this means that the buffer of error messages should be reparsed
  14. the next time the list of errors is wanted.")
  15. (defvar compilation-parsing-end nil "\
  16. Position of end of buffer when last error messages parsed.")
  17. (defvar compilation-error-message nil "\
  18. Message to print when no more matches for compilation-error-regexp are found")
  19. (defvar compilation-error-regexp "\\([^
  20. ]+\\(: *\\|, line \\|(\\)[0-9]+\\)\\|\\([0-9]+.*of *[^
  21. ]+\\)" "Regular expression for filename/linenumber in error in compilation log.")
  22. (defun compile (command) "\
  23. Compile the program including the current buffer. Default: run make.
  24. Runs COMMAND, a shell command, in a separate process asynchronously
  25. with output going to the buffer *compilation*.
  26. You can then use the command \\[next-error] to find the next error message
  27. and move to the source code that caused it." (interactive (byte-code "ÁÂ\"C‡" [compile-command read-string "Compile command: "] 3)) (byte-code "ˆ ‰ˆÃÄ\"‡" [compile-command command nil compile1 "No more errors"] 3))
  28. (defun grep (command) "\
  29. Run grep, with user-specified args, and collect output in a buffer.
  30. While grep runs asynchronously, you can use the \\[next-error] command
  31. to find the text that grep hits refer to." (interactive "sRun grep (with args): ") (byte-code "ÁˆÂÃÄQÅÆ#‡" [command nil compile1 "grep -n " " /dev/null" "No more grep hits" "grep"] 4))
  32. (defun compile1 (command error-message &optional name-of-mode) (byte-code "Ò ˆƒ#Ó!Ô=?†ÕÖ!ƒÁר�‚ ÙÚ!‚$ÁˆÁ‰ˆÛ ˆÃ‰ˆ ‰ˆÜÝÞßàP%‰ˆÞ�áâ!ˆá!ˆã ˆá!ˆã ‘ˆ
  33.  ŠäÞ!ˆåÊ!ˆ ‰
  34. ))ˆæç\"ˆ è! é !  p=ƒŽdb‚�ÁˆŠ qˆê !ˆŠ qˆe)ë \"ˆ ì =†¸í \")ˆ ‰ˆî ˆ†Éð‰)+‡" [compilation-process nil compilation-error-list t compilation-error-message error-message shell-file-name command default-directory regexp compilation-error-regexp thisdir outbuf outwin start mode-name name-of-mode mode-line-process save-some-buffers process-status run yes-or-no-p "A compilation process is running; kill it? " (byte-code "Á!ˆÂÃ!ˆÄ!‡" [compilation-process interrupt-process sit-for 1 delete-process] 4) ((error (byte-code "À‡" [nil] 1))) error "Cannot have two compilation processes" compilation-forget-errors start-process "compilation" "*compilation*" "-c" "exec " princ "cd " terpri switch-to-buffer make-local-variable set-process-sentinel compilation-sentinel process-buffer get-buffer-window buffer-flush-undo set-window-start selected-window set-window-point fundamental-mode "Compilation" (": %s")] 23))
  35. (defun compilation-sentinel (proc msg) (byte-code "ÉÊ!!?ƒËÁ\"‚aÌ!Í>…apd`ÎŽÊ!qˆdbˆÏÐ Ñ$ˆÒÓ!ˆÏÔÕ Ö×O\"ˆÒØ!ˆÙÚÌ!!P‰ˆÛ!)ˆ Wƒ\\ b‚]Áˆ
  36. q+‡" [proc nil obuf omax opoint mode-name msg mode-line-process compilation-process buffer-name process-buffer set-process-buffer process-status (signal exit) ((byte-code "Á‰ˆÂà !‡" [compilation-process nil set-buffer-modified-p buffer-modified-p] 3)) insert 10 " " forward-char -1 " at " current-time-string 0 -5 1 ": " symbol-name delete-process] 15))
  37. (defun kill-compilation nil "\
  38. Kill the process made by the \\[compile] command." (interactive) (byte-code "Áˆƒ Â!‚ Á‡" [compilation-process nil interrupt-process] 2))
  39. (defun kill-grep nil "\
  40. Kill the process made by the \\[grep] command." (interactive) (byte-code "Áˆƒ Â!‚ Á‡" [compilation-process nil interrupt-process] 2))
  41. (defun next-error (&optional argp) "\
  42. Visit next compilation error message and corresponding source code.
  43. This operates on the output from the \\[compile] command.
  44. If all preparsed error messages have been processed,
  45. the error message buffer is checked for new ones.
  46. A non-nil argument (prefix arg, if interactive)
  47. means reparse the error message buffer and start at the first error." (interactive "P") (byte-code "ĈÁ=†
  48. ƒÊ ˆË‰‚ĈƒÄ‚+ŠÌÍ!ˆÎÄ!ˆÏ )ˆ@ ?ƒOÐ…BÑ!Ò=ƒIÓ‚JÔP!‚PĈA‰ˆ A@?ƒaÄ‚tÌÕ A@!!ˆ A@bˆÖ A@Ä\"ˆÁ×Õ @!! Ø @\"ˆÙ @\"*ˆÖ @Ä\")‡" [compilation-error-list t argp compilation-parsing-end nil next-error compilation-error-message compilation-process pop-up-windows w compilation-forget-errors 1 switch-to-buffer "*compilation*" set-buffer-modified-p compilation-parse-errors error process-status run " yet" "" marker-buffer set-marker display-buffer set-window-point set-window-start] 16))
  49. (defun compilation-forget-errors nil (byte-code "Á=ƒ ‰‚ ˆ…5@Ä @Â\"ˆ A@ƒ*Ä A@Â\"‚+Â)ˆA‰ˆ‚‡" [compilation-error-list t nil next-error set-marker] 5))
  50. (defun compilation-parse-errors nil "\
  51. Parse the current buffer as error messages.
  52. This makes a list of error descriptors, compilation-error-list.
  53. For each source-file, line-number pair in the buffer,
  54. the source file is read in, and the text location is saved in compilation-error-list.
  55. The function next-error, assigned to \\[next-error], takes the next error off the list
  56. and visits its location." (byte-code "Á‰ˆÌÍ!ˆÁÁÁ bˆoƒÎÏ!‚ÁˆÐÁÇ#…ÁÁÁÁ 
  57.  ŒÑÒÓ!ÔÓ!\"ˆdbˆÕÖ!ˆh×UƒlÑeØ T\"ˆÙ ˆÚ!ˆÕÛ!ˆÑ`ÔÓ!\"ˆdbˆÕÖ!‚mÁˆÜÖ!ƒ€Ýp!‰ˆeb‚�ebˆÝp!‰ˆdbˆÕÛ!ˆÞ ‰ )ˆß \"…¤ Uƒ«Á‚ àá!ˆâ ‰
  58. ˆß \"?ƒÒã ‰!…Ëä !Ó‰‚ÓÁˆ
  59. ƒ Š
  60. qˆå !ƒëábˆá‰‚ìÁˆÎ Z!ˆ‰ˆâ ‰ ˆ
  61.  DB‰)‚ ÁˆÎá!,ˆ‚ˆd‰+ˆÌæ!ˆç!‰‡" [compilation-error-list nil text-buffer last-filename last-linenum compilation-parsing-end compilation-error-regexp t linenum filename error-marker text-marker message "Parsing error messages..." forward-line 2 re-search-forward narrow-to-region match-beginning 0 match-end skip-chars-backward "[0-9]" 40 buffer-size end-of-line re-search-backward "^
  62. " looking-at read compilation-grab-filename equal beginning-of-line 1 point-marker file-exists-p find-file-noselect zerop "Parsing error messages...done" nreverse] 34))
  63. (defun compilation-grab-filename nil "\
  64. Return a string which is a filename, starting at point.
  65. Ignore quotes and parentheses around it, as well as trailing colons." (byte-code "gÀ=ƒŒÁ`ÂÃ!ˆ`\"ˆebˆÄp!)‚\"Å`ÆÇ!ˆ`\"‡" [34 narrow-to-region forward-sexp 1 read buffer-substring skip-chars-forward "^ :,
  66. ("] 7))
  67. (define-key ctl-x-map "`" (quote next-error))