In the code excerpt that follows, when I hit TAB on the line marked with the comment, the line jumps all the way to the left margin instead of the correct indent position. Weirdly, this appears to be a minimal example in the sense that if I delete a random line here or there, the problem goes away. This is for emacs version 24.3.1 running under Windows 10 (64-bit). This is Julia mode version 0.3, which I just downloaded a couple of days ago. The code (not this excerpt, but the original version before I tried to make a minimal example) loads and compiles in Julia 0.4.6, so the problem isn't being caused by a stray parenthesis or comma.
function maintimestepper()
for tind = startstep + 1 : ntimevals
if params.verbosity >= 1
if params.verbosity >= 3
println(" -----------------------------------------------------")
end
println("begin timestep loop tind = ", tind, " with deltat = ", deltat)
end
for i = 1 : ndispbc
ubc[alldispbc[i].node, alldispbc[i].dim] =
curbcweight * alldispbc[i].val[tind] +
prevbcweight * alldispbc[i].val[tind-1]
end
scrap, uoffset = getinitxuoffset_for_tsm(statehist, tind, timevals,
nnode,
spacedim,
maprelabs,
mapabsrel,
massmat,
tsm)
if tind == 2
oldtimeval_h = timevals[1]
oldubc = zeros(nnode, spacedim)
for i = 1 : ndispbc
oldubc[alldispbc[i].node, alldispbc[i].dim] =
alldispbc[i].val[1]
end
olduoffset = zeros(nnode * spacedim)
w = zeros(nis1)
s = zeros(nis1)
fac = params.initsw
s[1 : spacedim + 1 : end] += sqrt(2.0) * fac
s[2 : spacedim + 1 : end] += fac
w[1 : spacedim + 1 : end] = sqrt(2.0) * (mu / fac)
w[2 : spacedim + 1 : end] -= mu / fac
y = mu / fac * ones(ni)
f_handle = F_Handle(f_handle0, oldubc, uoffset, mass_scaling(deltat,tsm))
x = shrink(f_handle, zeros(nx), 1.0 - mu)
ci_handle = CI_Handle(ci_handle0, ubc, timevals[1])
extrcon = extract_contact(ci_handle)
contactrhs = contact_fn_val(ci_handle)
tvar, pivar = init_tvar_pivar(extrcon,
contactrhs,
mu,
x,
params.bigM)
z = mu ./ (extrcon * x + tvar * ones(ncb) - contactrhs)
else
oldtimeval_h = prevbcweight * timevals[tind - 2] +
curbcweight * timevals[tind - 1]
for i = 1 : ndispbc
oldubc[alldispbc[i].node, alldispbc[i].dim] =
curbcweight * alldispbc[i].val[tind-1] +
prevbcweight * alldispbc[i].val[tind-2]
end
scrap, olduoffset = getinitxuoffset_for_tsm(statehist, tind - 1,
timevals,
spacedim,
nnode,
maprelabs,
mapabsrel,
massmat,
tsm)
x = xi_save[:,tind-1]
s = si_save[:,tind-1]
w = wi_save[:,tind-1]
y = yi_save[:,tind-1]
z = zi_save[:,tind-1]
pivar = pivari_save[tind-1]
tvar = tvari_save[tind-1]
end
for step_bc = 1 : params.init_nstep_bc
checkstopiteration(stopiterationtime)
timelambda = Float64(step_bc) / Float64(params.init_nstep_bc)
midubc = (1.0 - timelambda) * oldubc + timelambda * ubc
midtimeval_h = (1.0 - timelambda) * oldtimeval_h + timelambda * timeval_h
midoffset = (1.0 - timelambda) * olduoffset +
timelambda * uoffset
f_handle = F_Handle(f_handle0, midubc,
midoffset, mass_scaling(deltat, tsm))
ci_handle = CI_Handle(ci_handle0, midubc, midtimeval_h)
extrcon = extract_contact(ci_handle)
nlipkkt = NlipKKT(f_handle, h_handle, ci_handle, mu, params)
x, s, w, y, z, tvara, pivara = splitvec(catvar,
[nx, nis1, nis1, ni, ncb, 1, 1])
tvar, pivar = init_tvar_pivar(extrcon, contactrhs, x, mu, params.bigM)
catvar = vcat(x, s, w, y, z, tvar, pivar)
newtonstep = -jac \ bfval
bfval, jac = nlip_kkt_(nlipkkt, catvar, 1)
alpha, alphareason = linesearch(catvar, newtonstep,
f_handle, h_handle, ci_handle, mu,
params)
catvar += alpha * newtonstep
if params.verbosity >= 3
println(" alpha = ",alpha, " timelambda = ", timelambda,
" norm(bfval) = ", norm(bfval))
end
end
# hitting tab here causes x to jump to the left margin
x, s, w, y, z, tvara, pivara = splitvec(catvar,
[nx, nis1, nis1, ni, ncb, 1, 1])
end
end