help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run function in background.


From: Oleksandr Gavenko
Subject: Run function in background.
Date: Wed, 01 Jun 2011 13:19:53 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

I need use auto update for GNU Global:

  $ global -u

There described how this done:

  http://www.emacswiki.org/emacs/GnuGlobal

But this:

  (defun gtags-root-dir ()
    "Returns GTAGS root directory or nil if doesn't exist."
    (with-temp-buffer
      (if (zerop (call-process "global" nil t nil "-pr"))
          (buffer-substring (point-min) (1- (point-max)))
        nil)))

  (defun gtags-update ()
    "Make GTAGS incremental update"
    (call-process "global" nil nil nil "-u"))

  (defun gtags-update-hook ()
    (when (gtags-root-dir)
      (gtags-update)))

  (add-hook 'after-save-hook #'gtags-update-hook)

cause freezing Emacs for about 2-3 sec. How run this in background
so I can still complete Emacs editing?

Write sh script and start-process-shell-command for asynchronous job?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]