lua-users home
lua-l archive

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

After some experimentation and a certain amount of help from various people,
I managed to get emacs on windows hooked up to ldb, although I find the
performance sluggish in comparison with vim.

I downloaded emacsclientw (and, indeed, the rest of the emacs install) from and more or less followed
the instructions from
The rest was just trial and error and asking questions on irc, and I
ended up with the following (you'll have to adjust it for the location
of the emacsclientw executable, of course). The truly bizarre command
line is the only way I could find to get quoting to work with the
Windows shell, but there may well be a better way.

I also had to change the .emacs file installed by emacsw32 to not
maximize the gvim window on startup:

 '(emacsw32-max-frames nil)

Here's the ldb-config.lua file:

local FNLN = 'cmd /c ""u:\\program
files\\emacs\\emacs\\bin\\emacsclientw.exe" '..
             '--eval '..
             '"(let ((buffer (find-file-noselect %s)) '..
             '       (pop-up-frames nil) '..
             '       (display-buffer-reuse-frames t)) '..
             '   (set-buffer buffer) '..
             '   (select-window (display-buffer buffer nil 0)) '..
             '   (goto-line %d))""'
local osexec = os.execute

-- Open an emacs window and allow 1 second for it to open before the first
-- is reached.
--osexec('emacs --funcall=server-start &')
--osexec('sleep 1')

local function quotefn(filename)
  filename = ("%q"):format(filename)
  return '\\'..filename:sub(1,-2)..'\\"'

return {
  PROMPT =  "(ldb) ",
  PROMPT2 = "  >>> ",

  input = function(prompt)
    io.write(prompt); return"*l"

  output = print,

  error = print,

  edit = function(filename, lineno)
     return osexec(FNLN:format(quotefn(filename), lineno))

  enterframe = function(state)
    local filename ="^@(.*)"
    if filename then
       osexec(FNLN:format(quotefn(filename), or 1))

  load_plugins = function()