Add partial combined SDL2 and ncurses build#1329
Conversation
src/lem.lisp
Outdated
| filename))) | ||
| ((member arg '("-i" "--interface") :test #'equal) | ||
| (let ((interface (pop args))) | ||
| (unless (and interface (/= 0 (array-total-size interface))) |
There was a problem hiding this comment.
Are you looking for plusp and length for strings?
There was a problem hiding this comment.
Those would work. I chose array-total-size since it only handles arrays (which strings are), but it does hurt readability and the performance loss from the type check when checking arguments is so close to zero that it is basically irrelevant. As for plusp, that would also work. Mainly make it more clear.
I've changed to them in the latest commits.
src/lem.lisp
Outdated
| ((member arg '("-i" "--interface") :test #'equal) | ||
| (let ((interface (pop args))) | ||
| (unless (and interface (/= 0 (array-total-size interface))) | ||
| (error "Please, specify an interface to use.")) |
There was a problem hiding this comment.
I don't think erroring here is cool. I'd rather have a default.
Also an error throws a backtrace right? A simple message to the user might have been nicer.
There was a problem hiding this comment.
Makes sense. I've changed it to printing a string to stderr in a new commit.
src/lem.lisp
Outdated
| (unless (and interface (/= 0 (array-total-size interface))) | ||
| (error "Please, specify an interface to use.")) | ||
| (setf (command-line-arguments-interface parsed-args) | ||
| (intern (string-upcase interface) "KEYWORD")))) |
There was a problem hiding this comment.
Also alexandria:make-keyword (with the string upcase)
Interns the string designated by NAME in the KEYWORD package.
but if this works it works.
There was a problem hiding this comment.
I switched it to alexandria:make-keyword in a commit I just pushed to make it more clear what is happening to someone skimming the code fast.
…nt a message to stderr if an interface argument isn't given or it has zero length rather than erroring.
…ocessing in src/lem.lisp to using alexandria:make-keyword.
|
Bringing the discussion of the command line argument in #1327 over here. Right now, the Emacs uses Of course, it would be nice to make it autodetect if it is on a tty and default to using ncurses then and default to SDL2 if it isn't, but I am not sure how to do that. ncurses doesn't seem to have any function to detect this. Nor does SDL2. My best guess is to try |
…n is interactive (probably a terminal) and SDL2 otherwise.
|
OK, I had a "duh" moment and figured out why my attempts at using |
|
A potentially simpler scheme for the command line arguments could be
How does this sound? |
|
mmh I find "-nw" not so explicit. What about
but wait, simply:
|
Why not both?
|
…--ncurses, --sdl2, and --sdl.
|
I added them. |
|
Thank you for the great PR. |
This adds a partial combined SDL2 and ncurses build to address #1327 . The changes add a
-i,--interface INTERFACEoption to specify the desired interface:sdl2orncurses(case-insensitive). If whatever is given is not available, the logic goes down the existing chain of finding a default implementation.But, there are a few issues with this merge request, which are: