3

Some context:

I'm doing some linux kernel development on a Debian VM so naturally I'm using tramp. I want to use semantic-symref, but the trouble is that:

  1. Semantic will eventually call cedet-gnu-global-call
  2. Which will use the value of cedet-global-command
  3. Which will crap out because it uses 'call-process.

So from what I understand, I need it to be using tramp-call-process.

My question is, can I monkey patch a function, namely cedet-gnu-global-call? I have seen stuff like defadvice, is this a use case for my problem?

By monkey patching, I mean that I want to replace cedet-gnu-global-call with mine, but at runtime.

Or is there some way to get cedet-global to be smart when used over tramp?

c-o-d
  • 910
  • 9
  • 19
  • Actually, rather than `tramp-call-process`, it should probably call `process-file` (which does delegate to Tramp, depending on default-directory). – Stefan Nov 07 '14 at 22:05

1 Answers1

3

In Emacs ≥24.4, you could try something like

(defun my-call-process-hack (orig program &rest args)
  (apply (if (equal program cedet-global-command) #'process-file orig)
         program args))
(advice-add 'call-process :around #'my-call-process-hack)
Stefan
  • 26,154
  • 3
  • 46
  • 84
  • Amazing! This worked. Now I just have a problem of semantic-symref giving me an empty buffer for results, even for kmalloc.., but at least this problem is solved. – c-o-d Nov 08 '14 at 01:52
  • Alternative to `semantic-symref`, you could use `ggtags-find-references` from [ggtags](https://github.com/leoliu/ggtags). I wrote a guide for using it [here](http://tuhdo.github.io/c-ide.html#sec-1). If you want `semantic-symref` to be functional, you have to setup include paths with EDE. – Tu Do Nov 12 '14 at 05:20
  • 1
    @TuDo I will check out `ggtags-find-references`. I basically avoid EDE and got semantic working on mostly everything by manually setting up the `semantic-dependency-*` functions. Also, your posts are absolutely incredible! Thank you so much for them. EDIT: ggtags-find-references works! Excellent! – c-o-d Nov 12 '14 at 15:45