Is there a way to redirect Coqide messages and errors to the same output? - coq

I have a tactic whose expected behavior is to output an error message, and I want to run it in batch mode on a series of goals and for each goal, I want to record the goal and the error message from the tactic. It seems like I can't do this with coqc since it will not continue on failure, so I'm doing this on Coqide. The closest I've been able to come to a solution is to have my file to have goals that look like this:
Theorem/Lemma blah.
Proof. Show. my_tactic. Admitted.
The first problem with this is that Show doesn't retain the proof goals in the Messages tab of Coqide through the run of the file, and the second is that while the output of the tactic is retained in the Errors tab, I am not able to copy it. Any help would be appreciated. Thanks!

Try using the "Fail" command. This is with 8.13 (with master the contexts and errors are not correctly interleaved). I didn't try 8.14-8.17. You need to run all of the input with "run to end" or "run to cursor"; single stepping will block you at the first error:
Fail command example

Related

Enable returning multiple arguments as completion reply at once in fish shell

I am working on porting Google Cloud SDK command line auto completion feature to fish shell. When I have an unambiguous reply with multiple arguments:
A) Either the command is completed with all those arguments BUT spaces gets escaped (\ ) when I specify the function call in the complete command inside ''s or ""s, like: > complete ... -a '(__fun)'
B) or if I don't do that (just: -a (__fun)), then only the first argument of the reply gets into the completion and all the other arguments "get lost"
Is it possible to reply with multiple arguments at once in fish completion?
Could be done in a number of ways. You will have to hack it a bit, though, since as ridiculous_fish says it's not designed for this.
Easiest would be to ship your own wrapper function that can take the escaped output and pass it on in a way that works. Not very pretty, though, and would screw with autosuggestions unless you also go back and modify the history lines.
Here's something semi-hacky/semi-elegant I would propose:
If you have looked up a "sequence" of args you'd want to complete at once, at first invocation put the trailing args as the description to the first one. Once that one has been locked in, remove all other options but the first in this "description queue", keep going through it and it will simply be a matter of quickly pressing tab-tab-tab-tab.
Completions don't have to be perfect, they're mostly a lil help on the way until you have enough history lines that autosuggestions take over, imo.

Debugging functions in matlab

Question: Is there a preferred way to debug functions in matlab?
If I all calculations in a script, then every variable is in the workspace and I can easily query them to find out what's not working right. However, if I use a function, then only my outputs are visible and I can't see what's going wrong. I understand there are ways of getting around this, but thusfar they seem to be more trouble than just making one, long ugly, script. So how do YOU debug functions in matlab? Is there a preferred/efficient way of doing this?
I always make sure to enable "Stop If Error" in the Breakpoints menu and if I want to debug a specific function I set a breakpoint at the first line in that function (or at the point of interest). Note that "clear all", which is common in the beginning of scripts deletes all break points. Use "clear variables" instead.
See MATLAB settings - stop if errors for more info on how to make the Stop If Error persist when you restart Matlab.

Powershell commands?

Ok I'm having trouble and google isn't helping, so I thought I'd come to you geniuses. I'm using Powershell and posh-git, and it keeps doing something that I'm sure I can exit out of with a magic command, I just don't know it yet.
Basically, when I run git diff (or something else with a long result), it will only give me a screen's worth of information, and end the screen with a colon
:
And if I keep pressing Enter it will add more to the screen til it is done showing everything for that command, and shows
<END>
But now what? How do I get out of this and back to calling commands? Enter, Esc and the other things I thought to try are not helping. I'm sure this must be a simple thing, but I don't know how to explain to Google what I want.
Anyone know?
if you do a git config -l you may see some relevant entries like:
core.pager='less'
pager.diff=false
pager.log=true
You can enable or disable the pager for different commands, or set a different pager. https://www.kernel.org/pub/software/scm/git/docs/git-config.html has the details, check out the core.pager section and pager.<cmd> sections for specifics.
If you're using 'less' as your pager, hit 'h' at that : prompt to get lots of details about what you can do there, and as pointed out by others, q, Q, or ZZ will get you back to the command line.
You can terminate the current command using CTRL+C. Is that what you're asking?

Oddball issue arising with use of TextWrangler to edit Python 2.7 script which tests multithreading and Queue modules

I'm writing a script in Python 2.7 exploring the use of the multithreading and Queue modules. the script just defines two functions, one of which will be started in a thread instance to fill a Queue, and a second one which will be started in a second thread instance to pull something off the Queue. However, I cannot even get this script to execute, as it chokes on one of the function definitions even before it executes. The code snippet with the problem is:
def listenThread(counter):
while queue.empty() != True:
try:
outcome = queue.get()
print outcome
counter -=1
print counter
except:
return 'queue.get() command loop failing.'
The error message I am getting is:
$ python threading-and-queue-test.py
File "threading-and-queue-test.py", line 34
except:
^
IndentationError: unindent does not match any outer indentation level
$
I've searched SO and checked the docs for correct formation of the try-except construct, and it seems OK. I had earlier versions of the code (without the try-except ) working, so I am getting suspicious about the text editor, TextWrangler v4.0.1.
Can anyone suggest a debug approach or code correction?
Thanks!
Red
As you have already suspected, it is most likely an indentation error. Your text editor is probably mixing the use of tabs and spaces. Replace all tabs with spaces (or vice versa though the standard in python is 4 spaces) and you should see the error disappear.
For those who find this question later like I did it's easy to fix TextWrangler's settings and stop this issue altogether; Go to "Preferences" -> "Editor Defaults" -> "Auto-expand tabs" then set tabs to 4 spaces. Restart TextWrangler for changes to take affect. For existing documents that continue giving you a problem read this.

debug the last sentence of a program

I have used Eclipse and VS. When I insert a breakpoint and debug the program, it will stop before the breakpoint.
But what if I want to debug the effect of the last sentence of the program? Inserting a meaningless sentence(say print 'pause' in Python) is OK but seems awkward. Is there any alternatives?
In Visual Studio you can put break point on closing bracket in main (or any) method of Program (or any) class (default naming, may vary), then debugger stops just before closing application.
Is there any reason not to use a breakpoint on the last statement, like you said, then manually proceed one step? Depending on the debugger, this can also be automated. In GDB, one can use commands N, where N is the breakpoint number, to set a list of (debugger) commands to be executed immediately after a breakpoint is hit.