-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the emacs search #11
Comments
Good idea. In the meantime, if you are on a Debian-derived distro, you can use the 'alternatives' system to make sure |
Hi!
Unfortunately, it doesn't work. I need to pass the --script flag to Emacs.
I've tried with "#!/usr/bin/env emacs --script". On some systems it works.
On other systems, "env" see "emacs --script" as one argument (not two) and
fails to locate Emacs.
If you have any suggestions on how to fix this, please let me know.
…-- Anders
On Fri, Oct 2, 2020 at 8:05 AM Phil Hudson ***@***.***> wrote:
Good idea. In the meantime, if you are on a Debian-derived distro, you can
use the 'alternatives' system to make sure /usr/bin/emacs points to your
preferred version. See https://gitlab.com/-/snippets/2015138 for the
script I use.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYGGQCZDYBM266MMFY7XCTSIVURTANCNFSM4SA7X76A>
.
|
As a possible external workaround, would putting the preferred version's containing directory at the head of the |
The best general approach I know for running #!/bin/sh
":"; exec emacs -Q --script "$0" -- "$@" # -*-emacs-lisp-*-
(pop argv) ; Remove the "--" argument
;; (setq debug-on-error t) ; if a backtrace is wanted
;; (defun stdout (msg args) (princ (format msg args)))
;; (defun stderr (msg args) (princ (format msg args)
;; #'external-debugging-output))
;; [script body]
(kill-emacs 0) ; Always exit explicitly. This returns the desired exit
; status, and also avoids the need to (setq argv nil). See https://stackoverflow.com/questions/6238331/emacs-shell-scripts-how-to-put-initial-options-into-the-script#6259330 regarding the main trickery at the start. This approach enables you to use any arbitrary command-line, and also to support arbitrary command-line arguments to the script itself. https://lunaryorn.com/blog/emacs-script-pitfalls/ is a good overview. |
Hi!
Personally, I try to stay away from hacks, as they often tend to come back
and bite you.
I would rather have an officially sanctioned solution, like an executable
which is distributed with emacs that start emacs in batch mode. In fact,
that binary could omit everything GUI-related, making it lean and fast, and
with sane option parsing rules. (And elisp will take over the scripting
world -- don't forget where you heard it first.)
…-- Anders
On Sat, Oct 3, 2020 at 5:51 AM phil-s ***@***.***> wrote:
The best general approach I know for running emacs --script is:
#!/bin/sh":"; exec emacs -Q --script "$0" -- "$@" # -*-emacs-lisp-*-
(pop argv) ; Remove the "--" argument;; (setq debug-on-error t) ; if a backtrace is wanted;; (defun stdout (msg args) (princ (format msg args)));; (defun stderr (msg args) (princ (format msg args);; #'external-debugging-output));; [script body]
(kill-emacs 0) ; Always exit explicitly. This returns the desired exit
; status, and also avoids the need to (setq argv nil).
See
https://stackoverflow.com/questions/6238331/emacs-shell-scripts-how-to-put-initial-options-into-the-script#6259330
regarding the main trickery at the start. This approach enables you to use
any arbitrary command-line, and also to support arbitrary command-line
arguments to the script itself.
https://lunaryorn.com/blog/emacs-script-pitfalls/ is a good overview.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYGGQDJMYZC7QKMTRHCDVLSI2NSZANCNFSM4SA7X76A>
.
|
It's undeniably a hack, but the shell part is POSIX behaviour, and Elisp isn't ever going to stop using |
Hi:
I have a different emacs path in my system so I need to update e2ansi-cat header everytime I download it:
Could you consider to use:
#!/usr/bin/env emacs
?
Thanks in advance,
Ergus
The text was updated successfully, but these errors were encountered: