[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shortcut to compile "highlighted Text/Tag"
From: |
Kevin Rodgers |
Subject: |
Re: Shortcut to compile "highlighted Text/Tag" |
Date: |
Thu, 18 Apr 2013 07:28:11 -0600 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 |
On 4/17/13 11:37 AM, Rami A wrote:
I have F4 being shortcut for the compile command:
(global-set-key [f4] 'compile)
But I have to type the tag I am looking for after pressing F4.
Is there a way to highlight the symbol in the code and have a shortcut that
does the compilation right away?
`C-h f compile' explains:
| (compile COMMAND &optional COMINT)
|
| Compile the program including the current buffer. Default: run `make'.
| Runs COMMAND, a shell command, in a separate process asynchronously
| with output going to the buffer `*compilation*'.
|
| You can then use the command C-x ` to find the next error message
| and move to the source code that caused it.
|
| If optional second arg COMINT is t the buffer will be in Comint mode with
| `compilation-shell-minor-mode'.
|
| Interactively, prompts for the command if `compilation-read-command' is
| non-nil; otherwise uses `compile-command'. With prefix arg, always prompts.
| Additionally, with universal prefix arg, compilation buffer will be in
| comint mode, i.e. interactive.
So:
(defun compile-target-at-point ()
"Run \"make\" with the symbol at point as the target, via `compile'."
(interactive)
(compile (format "make %s" (or (symbol-at-point)
(error "No target at point")))))
(global-set-key [f4] 'compile-symbol-at-point)
--
Kevin Rodgers
Denver, Colorado, USA
- Shortcut to compile "highlighted Text/Tag", Rami A, 2013/04/17
- Re: Shortcut to compile "highlighted Text/Tag", Dan Espen, 2013/04/17
- Re: Shortcut to compile "highlighted Text/Tag",
Kevin Rodgers <=
- Message not available
- Re: Shortcut to compile "highlighted Text/Tag", Rami A, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Dan Espen, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Rami A, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Dan Espen, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Rami A, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Dan Espen, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Rami A, 2013/04/19
- Re: Shortcut to compile "highlighted Text/Tag", Bob Proulx, 2013/04/20
- Message not available
- Re: Shortcut to compile "highlighted Text/Tag", Rami A, 2013/04/20
- Re: Shortcut to compile "highlighted Text/Tag", Bob Proulx, 2013/04/20