unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Inserting "-*- mode: ..." before turning mode on in (compilation-start)
@ 2005-05-27 16:54 Markus Gritsch
  2005-05-28 11:53 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Gritsch @ 2005-05-27 16:54 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

Hi,

It would be nice if the specified mode in (compilation-start) would get 
activated before inserting anything (i.e. the mode setter line) into the 
buffer.

In a function which I added to compilation-mode-hook I change some 
fontification things including the used font.  When (compilation-start) 
is called using compilation-mode as mode, my function gets called using 
(funcall mode).  However this happens a few lines too late, because the 
mode setter has already been inserted into the buffer, and so it is not 
displayed using my font (see attached screen shot).

Kind regards,
Markus


[-- Attachment #2: ScreenShot.png --]
[-- Type: image/png, Size: 19123 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Inserting "-*- mode: ..." before turning mode on in (compilation-start)
  2005-05-27 16:54 Inserting "-*- mode: ..." before turning mode on in (compilation-start) Markus Gritsch
@ 2005-05-28 11:53 ` Richard Stallman
  2005-05-28 12:05   ` Markus Gritsch
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2005-05-28 11:53 UTC (permalink / raw)
  Cc: emacs-devel

Does this patch give good results?

*** compile.el	20 May 2005 17:56:45 -0400	1.356
--- compile.el	28 May 2005 05:02:27 -0400	
***************
*** 935,946 ****
  		    (substitute-env-vars (match-string 1 command))
  		  "~")
  	      default-directory))
  	(erase-buffer)
! 	;; output a mode setter, for saving and later reloading this buffer
  	(insert "-*- mode: " name-of-mode
  		"; default-directory: " (prin1-to-string default-directory)
! 		" -*-\n" command "\n")
! 	(setq thisdir default-directory))
        (set-buffer-modified-p nil))
      ;; If we're already in the compilation buffer, go to the end
      ;; of the buffer, so point will track the compilation output.
--- 935,954 ----
  		    (substitute-env-vars (match-string 1 command))
  		  "~")
  	      default-directory))
+ 	;; Select the desired mode.
+ 	(if (not (eq mode t))
+ 	    (funcall mode)
+ 	  (setq buffer-read-only nil)
+ 	  (with-no-warnings (comint-mode))
+ 	  (compilation-shell-minor-mode))
+ 	(if highlight-regexp
+ 	    (set (make-local-variable 'compilation-highlight-regexp)
+ 		 highlight-regexp))
  	(erase-buffer)
! 	;; Output a mode setter, for saving and later reloading this buffer.
  	(insert "-*- mode: " name-of-mode
  		"; default-directory: " (prin1-to-string default-directory)
! 		" -*-\n" command "\n")	(setq thisdir default-directory))
        (set-buffer-modified-p nil))
      ;; If we're already in the compilation buffer, go to the end
      ;; of the buffer, so point will track the compilation output.
***************
*** 963,976 ****
  	      ;; don't override users' setting of $EMACS.
  	      (unless (getenv "EMACS") '("EMACS=t"))
  	      (copy-sequence process-environment))))
- 	(if (not (eq mode t))
- 	    (funcall mode)
- 	  (setq buffer-read-only nil)
- 	  (with-no-warnings (comint-mode))
- 	  (compilation-shell-minor-mode))
- 	(if highlight-regexp
- 	    (set (make-local-variable 'compilation-highlight-regexp)
- 		 highlight-regexp))
  	(set (make-local-variable 'compilation-arguments)
  	     (list command mode name-function highlight-regexp))
  	(set (make-local-variable 'revert-buffer-function)
--- 971,976 ----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Inserting "-*- mode: ..." before turning mode on in (compilation-start)
  2005-05-28 11:53 ` Richard Stallman
@ 2005-05-28 12:05   ` Markus Gritsch
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Gritsch @ 2005-05-28 12:05 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:
> Does this patch give good results?

Yes, it works perfectly now.

Thank you,
Markus

> *** compile.el	20 May 2005 17:56:45 -0400	1.356
> --- compile.el	28 May 2005 05:02:27 -0400	
> ***************
> *** 935,946 ****
>   		    (substitute-env-vars (match-string 1 command))
>   		  "~")
>   	      default-directory))
>   	(erase-buffer)
> ! 	;; output a mode setter, for saving and later reloading this buffer
>   	(insert "-*- mode: " name-of-mode
>   		"; default-directory: " (prin1-to-string default-directory)
> ! 		" -*-\n" command "\n")
> ! 	(setq thisdir default-directory))
>         (set-buffer-modified-p nil))
>       ;; If we're already in the compilation buffer, go to the end
>       ;; of the buffer, so point will track the compilation output.
> --- 935,954 ----
>   		    (substitute-env-vars (match-string 1 command))
>   		  "~")
>   	      default-directory))
> + 	;; Select the desired mode.
> + 	(if (not (eq mode t))
> + 	    (funcall mode)
> + 	  (setq buffer-read-only nil)
> + 	  (with-no-warnings (comint-mode))
> + 	  (compilation-shell-minor-mode))
> + 	(if highlight-regexp
> + 	    (set (make-local-variable 'compilation-highlight-regexp)
> + 		 highlight-regexp))
>   	(erase-buffer)
> ! 	;; Output a mode setter, for saving and later reloading this buffer.
>   	(insert "-*- mode: " name-of-mode
>   		"; default-directory: " (prin1-to-string default-directory)
> ! 		" -*-\n" command "\n")	(setq thisdir default-directory))
>         (set-buffer-modified-p nil))
>       ;; If we're already in the compilation buffer, go to the end
>       ;; of the buffer, so point will track the compilation output.
> ***************
> *** 963,976 ****
>   	      ;; don't override users' setting of $EMACS.
>   	      (unless (getenv "EMACS") '("EMACS=t"))
>   	      (copy-sequence process-environment))))
> - 	(if (not (eq mode t))
> - 	    (funcall mode)
> - 	  (setq buffer-read-only nil)
> - 	  (with-no-warnings (comint-mode))
> - 	  (compilation-shell-minor-mode))
> - 	(if highlight-regexp
> - 	    (set (make-local-variable 'compilation-highlight-regexp)
> - 		 highlight-regexp))
>   	(set (make-local-variable 'compilation-arguments)
>   	     (list command mode name-function highlight-regexp))
>   	(set (make-local-variable 'revert-buffer-function)
> --- 971,976 ----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-05-28 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-27 16:54 Inserting "-*- mode: ..." before turning mode on in (compilation-start) Markus Gritsch
2005-05-28 11:53 ` Richard Stallman
2005-05-28 12:05   ` Markus Gritsch

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).