Package: emacs;
Reported by: Emil Marklund <emil.marklund <at> elastisys.com>
Date: Thu, 27 Sep 2018 15:21:02 UTC
Severity: wishlist
Tags: moreinfo, wontfix
Found in version 25.2
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Emil Marklund <emil.marklund <at> elastisys.com> To: 32852 <at> debbugs.gnu.org Subject: bug#32852: 25.2; No option for emacsclient to open files in specific mode Date: Thu, 27 Sep 2018 14:56:18 +0200
Feature request: add option for emacsclient to open files in a specific mode Zsh has a built-in feature that enables users to edit the current command using $EDITOR. Specifically, Zsh uses the following function: ``` edit-command-line () { () { exec < /dev/tty setopt localoptions nomultibyte noksharrays (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2] local editor=${${VISUAL:-${EDITOR:-vi}}} case $editor in (*vim*) integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 )) ${=editor} -c "normal! ${byteoffset}go" -- $1 ;; (*emacs*) local lines=(${(f):-"$PREBUFFER$LBUFFER"}) ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1 ;; (*) ${=editor} $1 ;; esac (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1] print -Rz - "$(<$1)" } =(<<<"$PREBUFFER$BUFFER") zle send-break } ``` However, emacs will by default open the file in fundamental mode. It would be neat if one could specify for the case where EDITOR=emacsclient to open file in shell-script-mode since the syntax should be compatible. A current workaround is to add the following to init file: ``` (add-to-list 'auto-mode-alist '("/tmp/zsh.*" . shell-script-mode)) ``` since the temporary file created by zsh for editing always will begin with the name "zsh". In GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian built on lgw01-amd64-050 Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 18.04.1 LTS Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs25-jYekUr/emacs25-25.2+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LC_MONETARY: sv_SE.UTF-8 value of $LC_NUMERIC: sv_SE.UTF-8 value of $LC_TIME: sv_SE.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Org Minor modes in effect: org-bullets-mode: t recentf-mode: t helm-mode: t diff-auto-refine-mode: t pyvenv-mode: t shell-dirtrack-mode: t TeX-PDF-mode: t company-quickhelp-mode: t company-quickhelp-local-mode: t global-company-mode: t company-mode: t show-paren-mode: t editorconfig-mode: t url-handler-mode: t nyan-mode: t display-time-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Setting up indent for shell type zsh Indentation variables are now local. Indentation setup for shell type zsh Mark activated Mark deactivated (No changes need to be saved) Mark set Press C-c C-c when you are done editing. Enter a change comment. Type C-c C-c when done Checking in /home/eeemil/dotfiles/.emacs.d/configuration.org...done Load-path shadows: /usr/share/emacs/25.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs25/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/25.2/lisp/language/thai-word Features: (shadow sort mail-extr emacsbug sendmail helm-swoop vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-dir ewoc eieio-opt network-stream nsm starttls url-cache url-dav url-http tls gnutls url-auth org-bullets org-element org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view image-mode org-bibtex bibtex org-bbdb org-w3m tar-mode jka-compr recentf tree-widget helm-x-files helm-for-files helm-bookmark helm-adaptive bookmark pp flyspell ispell log-edit message rfc822 mml mml-sec epg mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util vc vc-dispatcher tramp-cache misearch multi-isearch vc-git editorconfig-core editorconfig-core-handle editorconfig-fnmatch dired helm-external helm-net image-file winner helm-command helm-elisp helm-eval edebug helm-info helm-mode helm-files helm-buffers helm-tags helm-locate helm-grep helm-regexp helm-utils helm-help helm-types helm helm-source eieio-compat helm-multi-match helm-lib async jison-mode bison-mode gitignore-mode conf-mode go-mode find-file yaml-mode dockerfile-mode sh-script smie executable company-jedi jedi-core python-environment epc ctable concurrent deferred highlight-indentation elpy find-file-in-project ivy delsel colir ivy-overlay ffap windmove diff-mode elpy-shell elpy-profile elpy-django elpy-refactor python tramp-sh ido grep files-x pyvenv esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util php-mode php-project mode-local imenu speedbar sb-image ezimage dframe add-log cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs markdown-mode+ markdown-mode thingatpt haskell-emacs-base haskell-emacs ac-haskell-process haskell haskell-completions haskell-load haskell-commands highlight-uses-mode haskell-modules haskell-sandbox haskell-navigate-imports haskell-repl haskell-svg haskell-collapse hideshow haskell-debug haskell-interactive-mode haskell-presentation-mode haskell-compile haskell-process haskell-session json map haskell-hoogle haskell-mode haskell-cabal haskell-utils haskell-font-lock haskell-indentation haskell-string haskell-sort-imports haskell-lexeme haskell-align-imports haskell-compat haskell-complete-module haskell-ghc-support dabbrev haskell-customize auto-complete popup flymake-haskell-multi flymake-easy flymake compile w3 w3-menu url-tramp tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell url-queue browse-url url-nfs url-file url-dired url-irc url-gw w3-emulate w3-parse w3-fast-parse w3-display w3-mouse w3-imap url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf w3-widget url-util mailcap w3-vars w3-keymap w3-cus css font disp-table devices w3-compat auctex-latexmk tex-buf latex tex-ispell tex-style tex dbus xml crm org-beautify-theme yasnippet ace-window subr-x avy company-quickhelp pos-tip cus-edit cus-start cus-load wid-edit company-oddmuse company-keywords company-etags etags xref project company-gtags company-dabbrev-code company-dabbrev company-files company-capf company-cmake company-xcode company-clang company-semantic company-eclim company-template company-css company-nxml company-bbdb company paren editorconfig url-handlers url-parse auth-source eieio eieio-core gnus-util mm-util help-fns mail-prsvr password-cache url-vars edmacro kmacro wheatgrass-theme nyan-mode time smart-mode-line-powerline-theme powerline powerline-separators color powerline-themes smart-mode-line advice rich-minority s cl-seq iso-transl use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key use-package-core org org-macro org-footnote org-pcomplete pcomplete org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs finder-inf tex-site rx cl-macs info cl package epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 767071 99906) (symbols 48 61758 380) (miscs 40 4220 387) (strings 32 181449 11495) (string-bytes 1 5214306) (vectors 16 95388) (vector-slots 8 2231087 224398) (floats 8 1240 1654) (intervals 56 11602 5333) (buffers 976 92))
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.