all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: region sensitive Makefile compile-command
Date: Wed, 01 Dec 2004 22:37:52 +0200	[thread overview]
Message-ID: <87eki9oiu7.fsf@jurta.org> (raw)
In-Reply-To: <87653syu15.fsf@jidanni.org> (Dan Jacobson's message of "Sat, 27 Nov 2004 09:12:22 +0800")

Dan Jacobson <jidanni@jidanni.org> writes:
> You guys just got to implement this, so I'm rereqesting it as it is so
> cool.  Make a new variable that we can turn on to enable this:
>
> Here we are in a Makefile,
> a:
>         bla bla
> b:
>         bla bla
>
> Well, if the cursor is anywhere in the a: region, all two lines of it,
> then compile-command should be "make a" (or "make -k a"). If anywhere
> in the b: region, then compile-command should be "make b".
>
> That way when one hits M-x compile, one gets prompted with something
> relevant, not just "make -k" which may not always be what you want.
>
> Currently sadly, one can even put the cursor right on top of the a:
> and normally highly sensitive emacs (especially after enabling ffap)
> still doesn't get the hint.

Good idea.  How about such patch?  However, it doesn't provide
a simple option to turn this off.  I wonder if someone might not like
this behavior?

Index: lisp/progmodes/make-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/make-mode.el,v
retrieving revision 1.88
diff -u -r1.88 make-mode.el
--- lisp/progmodes/make-mode.el	20 Sep 2004 15:45:31 -0000	1.88
+++ lisp/progmodes/make-mode.el	1 Dec 2004 20:18:44 -0000
@@ -640,6 +640,17 @@
 
   ;; Real TABs are important in makefiles
   (setq indent-tabs-mode t)
+
+  (make-local-variable 'compile-command)
+  (setq compile-command
+	'(save-excursion
+	   (beginning-of-line)
+	   (if (or (looking-at makefile-macroassign-regex)
+		   (looking-at makefile-dependency-regex)
+		   (makefile-previous-dependency))
+	       (concat "make -k " (match-string-no-properties 1))
+	     (car compile-history))))
+
   (run-hooks 'makefile-mode-hook))
 
-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2004-12-01 20:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-27  1:12 region sensitive Makefile compile-command Dan Jacobson
2004-12-01 20:37 ` Juri Linkov [this message]
2004-12-02 23:33   ` Dan Jacobson
2004-12-05 20:52     ` Juri Linkov
     [not found]     ` <mailman.3743.1102280901.27204.bug-gnu-emacs@gnu.org>
2004-12-06 17:04       ` Kevin Rodgers
2004-12-06 23:40         ` Juri Linkov
     [not found]         ` <mailman.4029.1102377320.27204.bug-gnu-emacs@gnu.org>
2004-12-07  0:20           ` Kevin Rodgers
2004-12-07  1:23             ` Juri Linkov
2004-12-09  0:33         ` Dan Jacobson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eki9oiu7.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.