all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs and buffer switching
@ 2006-12-06  0:09 Hadron Quark
  2006-12-06 17:11 ` Kevin Rodgers
       [not found] ` <mailman.1603.1165425138.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Hadron Quark @ 2006-12-06  0:09 UTC (permalink / raw)



I have a c-mode-common hook which activates ecb (code browser) when I
load a c file. But how to activate it when I switch to an existing c
buffer? I am already switching layouts with winring, but wish for the
ecb layout to pop up if I switch from a single buffer frame to an
already loaded c file.

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

* Re: emacs and buffer switching
  2006-12-06  0:09 emacs and buffer switching Hadron Quark
@ 2006-12-06 17:11 ` Kevin Rodgers
       [not found] ` <mailman.1603.1165425138.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2006-12-06 17:11 UTC (permalink / raw)


Hadron Quark wrote:
> I have a c-mode-common hook which activates ecb (code browser) when I
> load a c file. But how to activate it when I switch to an existing c
> buffer? I am already switching layouts with winring, but wish for the
> ecb layout to pop up if I switch from a single buffer frame to an
> already loaded c file.

c-mode-common-hook is the wrong place to do that.  But something like
this might work for you:

(defun ecb-window-configuration ()
   (when (derived-mode-p 'c-mode)
     ;; activate ECB here
     ))

(add-hook 'window-configuration-change-hook 'ecb-window-configuration)

-- 
Kevin

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

* Re: emacs and buffer switching
       [not found] ` <mailman.1603.1165425138.2155.help-gnu-emacs@gnu.org>
@ 2006-12-06 17:30   ` Hadron Quark
  2006-12-06 20:57     ` Kevin Rodgers
       [not found]     ` <mailman.1615.1165438755.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Hadron Quark @ 2006-12-06 17:30 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Hadron Quark wrote:
>> I have a c-mode-common hook which activates ecb (code browser) when I
>> load a c file. But how to activate it when I switch to an existing c
>> buffer? I am already switching layouts with winring, but wish for the
>> ecb layout to pop up if I switch from a single buffer frame to an
>> already loaded c file.
>
> c-mode-common-hook is the wrong place to do that.  But something like
> this might work for you:
>
> (defun ecb-window-configuration ()
>   (when (derived-mode-p 'c-mode)
>     ;; activate ECB here
>     ))
>
> (add-hook 'window-configuration-change-hook 'ecb-window-configuration)

Thanks Kevin : almost there.

ecb activates, but I get (instead of the c file in the right hand buffer):

Warning: `semantic-before-toplevel-bovination-hook' is an obsolete variable;
    use `semantic--before-fetch-tags-hook' instead.
Error: Wrong type argument: window-live-p, #<window 53>


Advice on how to track down the problem?

Also, what code to turn off ecb if its not a c-mode derivative? Some
form of "else" in the code above which then calls ecb-deactivate()?

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

* Re: emacs and buffer switching
  2006-12-06 17:30   ` Hadron Quark
@ 2006-12-06 20:57     ` Kevin Rodgers
       [not found]     ` <mailman.1615.1165438755.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2006-12-06 20:57 UTC (permalink / raw)


Hadron Quark wrote:
> Kevin Rodgers <ihs_4664@yahoo.com> writes:
>> (defun ecb-window-configuration ()
>>   (when (derived-mode-p 'c-mode)
>>     ;; activate ECB here
>>     ))
>>
>> (add-hook 'window-configuration-change-hook 'ecb-window-configuration)
> 
> Thanks Kevin : almost there.
> 
> ecb activates, but I get (instead of the c file in the right hand buffer):
> 
> Warning: `semantic-before-toplevel-bovination-hook' is an obsolete variable;
>     use `semantic--before-fetch-tags-hook' instead.
> Error: Wrong type argument: window-live-p, #<window 53>
> 
> 
> Advice on how to track down the problem?

(setq debug-on-error t)

> Also, what code to turn off ecb if its not a c-mode derivative? Some
> form of "else" in the code above which then calls ecb-deactivate()?

Isn't it just

(if (derived-mode-p 'c-mode)
     (ecb-activate)
   (ecb-deactivate))

-- 
Kevin

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

* Re: emacs and buffer switching
       [not found]     ` <mailman.1615.1165438755.2155.help-gnu-emacs@gnu.org>
@ 2006-12-06 21:32       ` Hadron Quark
  2006-12-07 19:39         ` Kevin Rodgers
       [not found]         ` <mailman.1649.1165520479.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Hadron Quark @ 2006-12-06 21:32 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Hadron Quark wrote:
>> Kevin Rodgers <ihs_4664@yahoo.com> writes:
>>> (defun ecb-window-configuration ()
>>>   (when (derived-mode-p 'c-mode)
>>>     ;; activate ECB here
>>>     ))
>>>
>>> (add-hook 'window-configuration-change-hook 'ecb-window-configuration)
>>
>> Thanks Kevin : almost there.
>>
>> ecb activates, but I get (instead of the c file in the right hand buffer):
>>
>> Warning: `semantic-before-toplevel-bovination-hook' is an obsolete variable;
>>     use `semantic--before-fetch-tags-hook' instead.
>> Error: Wrong type argument: window-live-p, #<window 53>
>>
>>
>> Advice on how to track down the problem?
>
> (setq debug-on-error t)
>
>> Also, what code to turn off ecb if its not a c-mode derivative? Some
>> form of "else" in the code above which then calls ecb-deactivate()?
>
> Isn't it just
>
> (if (derived-mode-p 'c-mode)
>     (ecb-activate)
>   (ecb-deactivate))

Actually, I had already done that but thanks for the reply.

Alas, its all a little more complicated. I need to call winring-init on
the FIRST call to my ecb function but not on the others. In addition, if
I manually turn off ecb, it should not turn it back on when I move to a
c derivative.

at the mo I have:


(defun ecb-first ()
   (interactive)
   (ecb-activate)
   (ecb-winman-winring-enable-support)
   (winring-initialize)
)

(defun ecb-window-configuration ()
  (if(derived-mode-p 'c-mode)
    (ecb-activate) ;; **** call ecb-first on FIRST call??
;;    (ecb-deactivate);
    ))

(add-hook 'window-configuration-change-hook 'ecb-window-configuration)

The problem is the need to activate ecb before winring if you want
winring to support ecb. its all very messy and my elisp istn up to the
task :(





-- 

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

* Re: emacs and buffer switching
  2006-12-06 21:32       ` Hadron Quark
@ 2006-12-07 19:39         ` Kevin Rodgers
       [not found]         ` <mailman.1649.1165520479.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2006-12-07 19:39 UTC (permalink / raw)


Hadron Quark wrote:
> Alas, its all a little more complicated. I need to call winring-init on
> the FIRST call to my ecb function but not on the others. In addition, if
> I manually turn off ecb, it should not turn it back on when I move to a
> c derivative.
> 
> at the mo I have:
> 
> 
> (defun ecb-first ()
>    (interactive)
>    (ecb-activate)
>    (ecb-winman-winring-enable-support)
>    (winring-initialize)
> )
> 
> (defun ecb-window-configuration ()
>   (if(derived-mode-p 'c-mode)
>     (ecb-activate) ;; **** call ecb-first on FIRST call??
> ;;    (ecb-deactivate);
>     ))
> 
> (add-hook 'window-configuration-change-hook 'ecb-window-configuration)
> 
> The problem is the need to activate ecb before winring if you want
> winring to support ecb. its all very messy and my elisp istn up to the
> task :(

Surely there is a variable that indicates whether winring has been
initialized yet.  Assuming that variable is called winring-initialized:

(defun ecb-window-configuration ()
   (if (derived-mode-p 'c-mode)
       (progn
	(ecb-activate)
	(unless winring-initialized
	  (ecb-winman-winring-enable-support)
	  (winring-initialize)))
     (ecb-deactivate)))

(add-hook 'window-configuration-change-hook 'ecb-window-configuration)

Have you considered asking the experts at ecb-list@lists.sourceforge.net
(see http://lists.sourceforge.net/lists/listinfo/ecb-list)?

-- 
Kevin

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

* Re: emacs and buffer switching
       [not found]         ` <mailman.1649.1165520479.2155.help-gnu-emacs@gnu.org>
@ 2006-12-13  0:01           ` Hadron Quark
  0 siblings, 0 replies; 7+ messages in thread
From: Hadron Quark @ 2006-12-13  0:01 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Surely there is a variable that indicates whether winring has been
> initialized yet.  Assuming that variable is called winring-initialized:
>
> (defun ecb-window-configuration ()
>   (if (derived-mode-p 'c-mode)
>       (progn
> 	(ecb-activate)
> 	(unless winring-initialized
> 	  (ecb-winman-winring-enable-support)
> 	  (winring-initialize)))
>     (ecb-deactivate)))
>
> (add-hook 'window-configuration-change-hook 'ecb-window-configuration)
>

Hi Kevin, the ecb nabble forum is pretty dead/ignored.

This is what I currently have after poking around in the code:

,----
| (defun ecb-init()
|    (interactive)
|    (unless winring-initialized
|      (ecb-minor-mode 0)
|      (ecb-winman-winring-enable-support)
|      (winring-initialize)
|      )
| )
| 
| (defun ecb-window-configuration ()
|   (if(derived-mode-p 'c-mode)
|     (ecb-activate)
|     ))
| 
| (add-hook 'window-configuration-change-hook 'ecb-window-configuration)
`----

The main problem is that if I call ecb-init from my ".emacs" then the
ecb buffers show up even if starting emacs with no file arguments. Yet,
if I dont call it from .emacs and call it manually from the command
buffer after loading emacs then it does what I want (initialises ecb and
winring without bringing up the frames).

My lisp isnt good enough to figure out the code in ecb.el

Any further help appreciated.

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

end of thread, other threads:[~2006-12-13  0:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-06  0:09 emacs and buffer switching Hadron Quark
2006-12-06 17:11 ` Kevin Rodgers
     [not found] ` <mailman.1603.1165425138.2155.help-gnu-emacs@gnu.org>
2006-12-06 17:30   ` Hadron Quark
2006-12-06 20:57     ` Kevin Rodgers
     [not found]     ` <mailman.1615.1165438755.2155.help-gnu-emacs@gnu.org>
2006-12-06 21:32       ` Hadron Quark
2006-12-07 19:39         ` Kevin Rodgers
     [not found]         ` <mailman.1649.1165520479.2155.help-gnu-emacs@gnu.org>
2006-12-13  0:01           ` Hadron Quark

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.