Emacs hacks This needs to incorporate some posts from entry://../pool Entry: cscope hacks Date: Wed Aug 10 12:56:02 CEST 2011 What I want to speed up code reviews is to have 2 windows, the calling side in the left window, and the called site in the right, and a possibility to "shift" through the stack this way. CALL can be implemented by `cscope-find-global-definition' RETURN can be implemented by a real stack The definition of cscope-find-global-definition is in (Debian install) /usr/share/emacs/site-lisp/xcscope.el Looking at the source of cscope-call, it seems that the following variable determines whether the cscope buffer is displayed. It could be overridden in a dynamic variable. cscope-display-cscope-buffer's value is t A useful function then becomes (the name is temporary..) (defun cscope-enter () (interactive) (let ((cscope-display-cscope-buffer nil)) (cscope-find-global-definition-no-prompting))) This is not what is described above, but already a bit more usuful than the plain function. Entry: magit Date: Sun Oct 30 12:13:10 EDT 2011 Found magit[1] on HN[2]. magit-status magit-diff (D) magit-diff-working-tree (d) magit-revert-item (v) [1] http://zagadka.vm.bytemark.co.uk/magit/magit.html [2] http://news.ycombinator.com/item?id=1817324 [3] http://daemianmack.com/magit-cheatsheet.html Entry: acer timelinex color theme Date: Fri Dec 30 21:59:59 EST 2011 I don't like the way a black background works on that laptop. Currently color-theme-deep-blue (after color-theme-install) seems to be best on the eyes. Entry: emacs with debugging symbols on debian Date: Mon Jan 2 18:52:18 EST 2012 I'd like to do some debugging on emacs on debian. What's the simplest way to get the build I'm used to, but with debugging symbols? I'm using the emacs sources from debian 23-3-1. Let's just build it and see if this is because of strip, or because of missing -g. Yep, I see the gcc console lines flying by and they definitely have -g. Simplest way seems to be to install from the generated .deb files an then just copy the non-stripped emacs binary from debian/build-x/src/emacs Entry: Set the buffer encoding system (dos / unix) Date: Thu Jan 5 12:40:04 EST 2012 I always forget this, because I look for "encoding" instead of "coding", and because it begins with "set-buffer-" instead of "buffer-". M-x set-buffer-file-coding-system dos / unix Entry: Keyboard macros Date: Mon Jan 9 11:41:58 EST 2012 `C-x (’ – start defining a keyboard macro `C-x )’ – stop defining the keyboard macro ‘C-x e’ – execute the keyboard macro [1] http://www.emacswiki.org/emacs/KeyboardMacros Entry: Window layout stuff Date: Thu May 31 16:57:16 EDT 2012 Looking for a solution to save emacs window layout. Looks like workgroups.el[2] is what I need. Other things I found are ECB[1], Escreen[3], ElScreen[4]. [1] http://ecb.sourceforge.net/ [2] https://github.com/tlh/workgroups.el [3] http://www.emacswiki.org/emacs/EmacsScreen [4] http://www.emacswiki.org/emacs/EmacsLispScreen Entry: Blocking Date: Fri Jun 8 08:53:08 EDT 2012 Emacs freezes when I suspend a host (broebel) that's logged in with emacsclient -t. Also, that host is exporting NFS shares so that might be the problem. Running gdb attach gives the following. Attach only completes after waking up broebel. If the attach is correct, the trace stops in stat called from Ffile_readable_p / file-readable? Probably NFS then. Indeed I found some /net/broebel buffers.. EDIT: Verified: Looks like it was NFS. When stopping autofs, making sure /net/broebel is no longer mounted, even if emacsclient -t is running on the host that is shut off, emacs doesn't block. What I do get is annoying pauses, I guess when the /net/broebel files are checked, and autofs times out. tom@zoo:~$ ps aux|grep emacs tom 475 0.0 0.0 7692 844 pts/20 S+ 08:43 0:00 grep emacs tom 4587 0.3 1.7 356884 100980 ? Dsl May17 114:01 emacs --daemon tom 32385 0.0 0.0 4008 240 ? S May18 0:00 emacsclient -c tom@zoo:~$ gdb /usr/bin/emacs GNU gdb (GDB) 6.8.50.20090628-cvs-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: ... (gdb) attach 4587 Attaching to program: /usr/bin/emacs, process 4587 ^C^CQuit (gdb) bt #0 0x00007f848a0ffcd5 in ?? () #1 0x000000000051b513 in stat (filename=) at /usr/include/x86_64-linux-gnu/sys/stat.h:457 #2 Ffile_readable_p (filename=) at fileio.c:2616 #3 0x000000000055d091 in Ffuncall (nargs=, args=) at eval.c:3031 #4 0x0000000000597562 in Fbyte_code (bytestr=, vector=, maxdepth=) at bytecode.c:680 #5 0x000000000055cc0f in funcall_lambda (fun=33885061, nargs=, arg_vector=) at eval.c:3220 #6 0x000000000055cebb in Ffuncall (nargs=, args=0x2050b80) at eval.c:3088 #7 0x0000000000597562 in Fbyte_code (bytestr=, vector=, maxdepth=) at bytecode.c:680 #8 0x000000000055cc0f in funcall_lambda (fun=33008069, nargs=, arg_vector=) at eval.c:3220 #9 0x000000000055cebb in Ffuncall (nargs=, args=0x1f7a9c0) at eval.c:3088 #10 0x000000000055e5ec in Fapply (nargs=2, args=0x7fffd9f53ac8) at eval.c:2449 #11 0x000000000055d105 in Ffuncall (nargs=, args=) at eval.c:3012 #12 0x0000000000597562 in Fbyte_code (bytestr=, vector=, maxdepth=) at bytecode.c:680 #13 0x000000000055c704 in Feval (form=) at eval.c:2356 #14 0x000000000055eef0 in internal_lisp_condition_case (var=11661874, bodyform=, handlers=) at eval.c:1437 #15 0x00000000005966a3 in Fbyte_code (bytestr=, vector=, maxdepth=) at bytecode.c:870 #16 0x000000000055cc0f in funcall_lambda (fun=10081381, nargs=, arg_vector=) at eval.c:3220 ---Type to continue, or q to quit--- #17 0x000000000055cebb in Ffuncall (nargs=, args=0x99d460) at eval.c:3088 #18 0x000000000055e15a in call1 (fn=, arg1=) at eval.c:2812 #19 0x00000000004ed28b in timer_check_2 (do_it_now=) at keyboard.c:4760 #20 timer_check (do_it_now=) at keyboard.c:4811 #21 0x00000000004ed54a in readable_events (flags=1) at keyboard.c:3700 #22 0x00000000004f2bf5 in get_input_pending (flags=1, addr=) at keyboard.c:7086 #23 0x00000000004f2e3a in detect_input_pending_run_timers (do_display=1) at keyboard.c:10762 #24 0x000000000059f849 in wait_reading_process_output (time_limit=, microsecs=, read_kbd=-1, do_display=, wait_for_cell=, wait_proc=, just_wait_proc=0) at process.c:5064 #25 0x00000000004f40ab in kbd_buffer_get_event (commandflag=, nmaps=, maps=, prev_event=, used_mouse_menu=, end_time=0x0) at keyboard.c:4183 #26 read_char (commandflag=, nmaps=, maps=, prev_event=, used_mouse_menu=, end_time=0x0) at keyboard.c:3081 #27 0x00000000004f627b in read_key_sequence (keybuf=, bufsize=, prompt=, dont_downcase_last=, can_return_switch_frame=, fix_current_buffer=) at keyboard.c:9567 #28 0x00000000004f8810 in command_loop_1 () at keyboard.c:1645 #29 0x000000000055b60f in internal_condition_case (bfun=, handlers=, hfun=) at eval.c:1492 #30 0x00000000004f101e in command_loop_2 () at keyboard.c:1362 #31 0x000000000055b73a in internal_catch (tag=, func=, arg=) at eval.c:1228 #32 0x00000000004f1a41 in command_loop () at keyboard.c:1341 ---Type to continue, or q to quit--- #33 0x00000000004f1e1a in recursive_edit_1 () at keyboard.c:956 #34 0x00000000004f1f57 in Frecursive_edit () at keyboard.c:1018 #35 0x00000000004e525c in main (argc=0, argv=0x7fffd9f55278) at emacs.c:1833 Entry: Inline images Date: Sun Mar 17 11:59:45 EDT 2013 I'd like to show some plots as part of the build output. It seems that this is possible using iimage-mode[1] using hook 'compilation-finish-functions. See also [2]. (insert-image (create-image "/tmp/test.png")) [1] http://vwood.github.com/emacs-images-in-buffer.html [2] http://stackoverflow.com/questions/9780124/insert-image-into-text-buffer Entry: Geiser Date: Wed May 8 09:39:01 EDT 2013 See [1] [1] entry://../plt/20130409-131821 Entry: Linux coding style Date: Tue Jul 16 11:03:23 EDT 2013 I've been using cc-mode coding style. I need a way to switch between Linux with tabs and cc-mode with 4 spaces. Entry: emacs flycheck Date: Sun Jan 26 22:45:05 CET 2014 M-x install-package flycheck M-x install-package flycheck-hdevtools cabal install hdevtools ln -s ~/.cabal/bin/hdevtools ~/bin/ Entry: COLUMNS in shell window Date: Sun Feb 9 14:14:26 CET 2014 In a shell buffer, COLUMNS seems to be set to 80 independent of the buffer width. How to adjust to actual width? [1] http://stackoverflow.com/questions/7987494/emacs-shell-mode-display-is-too-wide-after-splitting-window Entry: C IDE Date: Sun Aug 24 09:42:48 CEST 2014 [1] http://tuhdo.github.io/c-ide.html Entry: installing geiser Date: Wed Oct 1 15:06:26 CEST 2014 cleaning up .emacs http://www.nongnu.org/geiser/geiser_2.html Entry: gud-mi fix Date: Thu Jan 8 20:07:22 EST 2015 For now this fixes it. TODO: figure out what the intention is - might be misconfiguration. diff --git a/gdb-mi.el b/emacs/gdb-mi.el index 0c81a85..bbe1173 100644 --- a/gdb-mi.el +++ b/emacs/gdb-mi.el @@ -2142,7 +2142,7 @@ a GDB/MI reply message." (cond ((string-equal prefix "~") (gdbmi-bnf-console-stream-output c-string)) ((string-equal prefix "@") - (gdbmi-bnf-target-stream-output c-string)) + (gdbmi-bnf-console-stream-output c-string)) ((string-equal prefix "&") (gdbmi-bnf-log-stream-output c-string))) t)))) Entry: images Date: Fri Feb 20 21:50:23 EST 2015 (insert-image (create-image "data.." 'png)) Entry: cpp broken Date: Wed Mar 18 13:10:00 EDT 2015 Invoking /lib/cpp -C on region...done c-macro-expansion: Search failed: " ??? !!! ??? start of c-macro expansion ??? !!! ???" Trying some things that don't work well: /* Emacs config (setq c-macro-preprocessor "/home/tom/humanetics/src/modules/cpp.sh") */ /* Emacs config (set (make-local-variable 'c-macro-preprocessor) "./cpp.sh") */ #!/bin/bash # For Emacs c-macro-expand cd $(dirname $0) exec ./toolchain/gcc-arm-none-eabi-4_8-2014q2/bin/arm-none-eabi-gcc -I ... -E -include - Entry: x-get-selection: Timed out waiting for reply from selection owner Date: Sat Apr 18 13:41:09 EDT 2015 (setq x-selection-timeout 10) Entry: creating default views Date: Fri Feb 26 10:35:59 EST 2016 Something I wanted to be able to do for a very long time: have a function recreate a specific split layout. Entry: remote edits / tramp. Date: Mon Mar 28 11:16:18 EDT 2016 I've been doing development on a couple of machines, moving git&darcs archives around, but it is really too much of a hassle. I'd like to switch to something more convenient. I tried tramp mode before, but it has a couple of annoying bits that interfere with work flow. Most prominent one is autosave, which freezes until connection is finished. Maybe switch that off? Or put backups in a separate directory: http://www.gnu.org/software/emacs/manual/html_node/tramp/Auto_002dsave-and-Backup.html The security bits mentioned there is not an issue, since I'm not editing any root-owned files in a user emacs session. (setq tramp-auto-save-directory "~/emacs/backup/") Cool feature: run M-x shell in a dired tramp dir, and it will start a remote shell with working tab completion. After that, M-x shell will start remote shell. Entry: recentralization Date: Fri May 6 08:59:20 EDT 2016 Have been working on multiple machines lately, where I spend too much time manually merging repositories. A different strategy is needed. The main driver for working locally is: - convenience (no network latencies or mount security problems). - local hardware interfaces (USB). NFS would really solve this, but I'm not keen on deploying it because of its own security issues. Local security model is that local network is not trusted, but local VPN is. Maybe trust NFS on VPN? Another simplification: run only one emacs session, centrally. Otherwise different emacsen will still get out of sync. This allows server-side edit & source control & build, but local execution for hardware access. For HATD it's even possible to run most software on server and use rinetd for forwarding over VPN. Entry: Timed out waiting for reply from selection owner Date: Sat May 14 13:02:41 EDT 2016 ;; This is really starting to annoy me.. This workaround doesn't work either. ;; https://www.google.com/search?q=%22timed+out+waiting+for+reply+from+selection+owner%22&ie=utf-8&oe=utf-8 ;; https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-01/msg00922.html New approach: - "emacs24 -nw" under screen - "emacsclient24 -c" under X This should make it possible to restart the server. Main emacs instance is then the one running in screen, which is otherwise not used. Also maybe use lucid version, as it doesn't have the bug hanging on remote X from disconnected hosts (e.g. laptop sleep). EDIT: just restart for processes, also make it easy to restart those. Maybe ther is really no way around this Erlang OTP idea of just restarting when one of those intermittent hard-to-reproduce bugs occurs. They are part of life. Deal with it! Entry: simpleclip Date: Sat May 28 18:33:37 EDT 2016 Still have trouble with "timed out waiting for reply from selection owner". It's getting seriously on my nerves. I'm ready to switch to terminal sessions only and learn how to live there :) Simpleclip seems to work. Needs "apt-get install xsel". http://blog.binchen.org/posts/the-reliable-way-to-access-system-clipboard-from-emacs.html https://github.com/rolandwalker/simpleclip Entry: stop using xterms Date: Sat May 28 18:50:42 EDT 2016 This might be the real problem. If copy-paste is needed, use comint or term in emacs. To escape from term: C-c C-j switch to line (edit) mode C-c C-k switch to term mode Entry: distel -- Distributed Emacs Lisp for Erlang. Date: Sun May 29 10:19:39 EDT 2016 https://github.com/massemanet/distel/ Entry: modern emacs setup for erlang Date: Fri Jun 24 02:21:41 EDT 2016 http://www.lambdacat.com/post-modern-emacs-setup-for-erlang/ http://www.lambdacat.com/post-erlang-ide-for-emacs-edts/ Entry: imap email Date: Sat Jul 2 14:34:40 EDT 2016 https://www.reddit.com/r/emacs/comments/16ju6p/what_package_do_people_use_to_read_imap_mail_now/ Entry: ~/.erlang_history Date: Sun Jul 17 10:26:02 EDT 2016 Who writes that file? Erlang or comint? I keep loosing history in comint when I switch buffers. Entry: Compilation regexp broke Date: Fri Jul 29 09:50:46 EDT 2016 Maybe first limit it a little. (pp-eval-expression 'compilation-error-regexp-alist) (vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst verilog-leda verilog-verilator verilog-vcs-4 verilog-vcs-3 verilog-vcs-2 verilog-vcs-1 verilog-xsim verilog-verbose verilog-surefire-2 verilog-surefire-1 verilog-IES verilog-xl-2 verilog-xl-1 vhdl-directory vhdl-advance-ms vhdl-advance-ms-file vhdl-aldec vhdl-cadence-leapfrog vhdl-cadence-nc vhdl-ghdl vhdl-ibm-compiler vhdl-ikos vhdl-ikos-file vhdl-modelsim vhdl-leda-provhdl vhdl-quartus vhdl-quickhdl vhdl-savant vhdl-simili vhdl-speedwave vhdl-synopsys vhdl-synopsys-design-compiler vhdl-synplify vhdl-vantage vhdl-vantage-file vhdl-veribest vhdl-viewlogic vhdl-viewlogic-file vhdl-xilinx-xst absoft ada aix ant bash borland python-tracebacks-and-caml comma cucumber msft edg-1 edg-2 epc ftnchek iar ibm irix java jikes-file maven jikes-line gcc-include ruby-Test::Unit gnu lcc makepp mips-1 mips-2 msft omake oracle perl php rxp sparc-pascal-file sparc-pascal-line sparc-pascal-example sun sun-ada watcom 4bsd gcov-file gcov-header gcov-nomark gcov-called-line gcov-never-called perl--Pod::Checker perl--Test perl--Test2 perl--Test::Harness weblint) Looks like the vhdl mode adds to the variable on every compile. (absoft ada aix ant bash borland python-tracebacks-and-caml comma cucumber msft edg-1 edg-2 epc ftnchek iar ibm irix java jikes-file maven jikes-line gcc-include ruby-Test::Unit gnu lcc makepp mips-1 mips-2 msft omake oracle perl php rxp sparc-pascal-file sparc-pascal-line sparc-pascal-example sun sun-ada watcom 4bsd gcov-file gcov-header gcov-nomark gcov-called-line gcov-never-called perl--Pod::Checker perl--Test perl--Test2 perl--Test::Harness weblint) compilation-mode-hook (vhdl-error-regexp-add-emacs verilog-error-regexp-add-emacs) Maybe clearing compilation-mode-hook will solve it? Entry: Strange escape code Date: Thu Aug 11 12:20:36 EDT 2016 Keeps popping up in terminal when starting emacsclient with TERM=xterm-256color: 41;322;0c Entry: Lisp crashes on emacs client connect Date: Fri Aug 19 10:22:24 EDT 2016 Error disappears before I can copy it. Tried an upgrade to see if it works: Unpacking emacs24-lucid (24.5+1-6+b2) over (24.4+1-5) ... Entry: erlang mode should not read/write ~/.erlang_history Date: Fri Aug 19 10:23:36 EDT 2016 This messes up multiple erlang sessions -- don't want them to share commands. I had this figured out... Why does it keep appearing? EDIT: /usr/share/emacs/site-lisp/erlang/erlang.el (defvar erlang-input-ring-file-name "~/.erlang_history" "*When non-nil, file name used to store Erlang shell history information.") in erlang-shell-mode: (setq comint-input-ring-file-name erlang-input-ring-file-name) (comint-read-input-ring t) This sets comint input ring from a file name as long as the -file-name variable is non-nil. Solution should be: (setq erlang-input-ring-file-name nil) Or a variable that is derived from the "current project". Is the directory know at that point? Entry: find-named-dired Date: Wed Nov 9 09:54:41 EST 2016 https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-and-Find.html Entry: Date: Thu Dec 1 22:13:18 EST 2016 " *net-fsm*" has running process - kill it? http://stackoverflow.com/questions/7299893/getting-rid-of-buffer-has-running-process-confirmation-when-the-process-is-a-f (defun fsm-open-socket (host port) (let ((buf (generate-new-buffer " *net-fsm*"))) (fsm-with-error-cleanup (kill-buffer buf) (let ((p (open-network-stream "netfsm" buf host port))) (set-process-coding-system p 'no-conversion 'no-conversion) + (set-process-query-on-exit-flag p nil) (when (fboundp 'set-process-filter-multibyte) (set-process-filter-multibyte p nil)) p)))) but make sure to recompile in distel/ Entry: data entry Date: Tue Dec 13 23:36:26 EST 2016 http://emacsredux.com/blog/2013/06/13/using-emacs-as-a-database-client/ This year's tax adventure, how to make it interesting: - build a erlang-sqlite interface - build a cowboy website for visualization Entry: xterm vs native x Date: Sat Dec 24 09:58:36 EST 2016 Going back to native X for a bit, to see if that "selection timeout" problem pops up again. Changed: (global-set-key [mouse-2] 'mouse-yank-primary) Entry: font-lock doesn't update Date: Tue Jan 17 14:49:46 CET 2017 Sometimes in Erlang mode font lock gets stuck. In C and Shell mode it seems fine. Even in Erlang mode when creating a new file it seems fine. Restarting Emacs fixes it. Entry: emacs deadlock Date: Fri Feb 10 15:59:06 EST 2017 ps aux|grep emacs gdb /usr/bin/emacs (gdb) bt #0 0x00007f43814b156d in poll () at ../sysdeps/unix/syscall-template.S:84 #1 0x00007f4380b7c150 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1 #2 0x00007f4380b7dc0f in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1 #3 0x00007f4380b7dd22 in xcb_wait_for_reply () from /usr/lib/x86_64-linux-gnu/libxcb.so.1 #4 0x00007f4385ea5317 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #5 0x00007f4385ea0cad in XSync () from /usr/lib/x86_64-linux-gnu/libX11.so.6 (gdb) bt #0 0x00007f43814b156d in poll () at ../sysdeps/unix/syscall-template.S:84 #1 0x00007f4380b7c150 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1 #2 0x00007f4380b7dc0f in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1 #3 0x00007f4380b7dd22 in xcb_wait_for_reply () from /usr/lib/x86_64-linux-gnu/libxcb.so.1 #4 0x00007f4385ea5317 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #5 0x00007f4385e9ba42 in XQueryTree () from /usr/lib/x86_64-linux-gnu/libX11.so.6 killing the sshd instance that had the emacsclient will eventually release the deadlock. it has something to do with how i start this up.. Entry: remote issues seem solved now Date: Sat Mar 4 10:17:15 EST 2017 Problem has always been: 1. How to properly launch a remote X session 2. How to make sure that sessions don't get stuck Solution: tom@tp:~$ cat bin/core-emacs.sh #!/bin/bash # Apparently dmenu doesn't source this.. . ~/.bashrc exec ssh -n -X -o ServerAliveInterval=5 -o ServerAliveCountMax=3 core emacsclient -c Remote end is running emacs24-lucid 24.5+1-7 I still have to manually kill sshd and emacsclient processes on the host side as they tend to accumulate, but this doesn't seem to be a problem. Entry: change terminal name if opened via tramp Date: Thu Mar 30 21:44:04 EDT 2017 M-x my-shell Entry: emacsclient zombies? Date: Mon Apr 3 23:39:05 EDT 2017 tom@core:~$ pstree init─┬─dbus-daemon ... ├─18*[emacsclient] ... └─sshd─┬─2*[sshd───sshd───emacsclient] └─sshd───sh tom@core:~$ Not zombies. How to make sure emacsclient dies when parent sshd dies? Anyways... how to reap these? Kill all emacsclient processes that are no longer chhildren of sshd? This gives the emacsclients that are parented by init: tom@core:~$ pgrep -P 1 emacsclient It's probably ok to kill those. tom@core:~$ pkill -P 1 emacsclient Maybe do this every time a new session is started. Entry: ssh -f Date: Mon Apr 3 23:53:16 EDT 2017 I need to read more man pages... -f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This implies -n. The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm. Entry: C-x C-+/- text-scale-adjust Date: Fri Apr 7 00:04:43 EDT 2017 Works per buffer in X11. text-scale-adust Entry: font lock update delays when logged in Date: Wed Jun 21 11:51:25 EDT 2017 https://stackoverflow.com/questions/5630157/how-to-force-a-syntax-highlighting-refresh-in-emacs No answer as to why this happens, but it seems that it is normal behaviour that when logged in remotely, the fontify doesn't update frequently. How to find out how to configure this delay? Entry: fun() indentation level in emacs mode Date: Thu Jun 29 11:47:16 EDT 2017 https://www.reddit.com/r/emacs/comments/4fa3m5/how_can_i_use_4space_indent_in_erlang_mode/ https://stackoverflow.com/questions/5120385/emacs-erlang-mode-indenting-twice-what-erlang-indent-level-specifies If I understand correctly, it's because fun() -> is both a function definition and a keyword? (defun erlang-at-keyword () "Are we looking at an Erlang keyword which will increase indentation?" (looking-at (concat "\\(when\\|if\\|fun\\|case\\|begin\\|" "of\\|receive\\|after\\|catch\\|try\\)\\b"))) EDIT: Couldn't make much sense of it. Entry: eshell Date: Sat Jul 22 08:25:26 EDT 2017 http://www.howardism.org/Technical/Emacs/eshell-fun.html Entry: email Date: Sat Jul 22 19:18:39 EDT 2017 https://www.reddit.com/r/emacs/comments/16ju6p/what_package_do_people_use_to_read_imap_mail_now/ mu4e and offlineimap Entry: Terminals in emacs Date: Sun Aug 13 23:35:55 EDT 2017 Let's get used to this. It's really just the bindings that are hard to learn. C-c C-j term-line-mode C-c C-k term-char-mode Trying to run erlang like this because remsh doesn't work without tty. How to allow distel command completion in line mode? Yes that just works: local-set-key TAB to erl-complete. Then the distel "focus" just needs to change. Entry: eshell Date: Mon Aug 14 01:28:51 EDT 2017 Giving it a try. Mapped shells under F9-F12 Entry: Problem with erlang mode not font-locking Date: Tue Aug 22 19:29:14 EDT 2017 erlang-mode-hook seems to run, as flycheck is started. so why is it not fontlocking? second time the same file loads it's fine. Entry: flycheck for C Date: Tue Aug 22 19:36:04 EDT 2017 needs some setup.. Entry: Cleaned out desktop file Date: Thu Aug 24 20:32:58 EDT 2017 See if it is still slow. Might have just been because of huge number of buffers open. Entry: Better navigation -- "back" button, or just use registers? Date: Thu Aug 24 20:37:25 EDT 2017 E.g. M-. needs a back button. Possible to C-x r w window-configuration-to-register To restore: C-x r j Maybe keep a stack of registers as I don't use them for anything anyway? Or just learn how to use these registers. They seem quite useful. What I'm looking for: https://www.emacswiki.org/emacs/WinnerMode Also: https://github.com/tlh/workgroups.el Entry: Start gdb in emacs from shell Date: Thu Aug 31 00:04:02 EDT 2017 See emu.erl Entry: Registers Date: Tue Sep 5 11:00:30 EDT 2017 Instead of putting terminals under the ctrl-Fx keys, put window configurations. Either from registers, or by explicit commands. (jump-to-register (car (string-to-list "j"))) (jump-to-register ?j) Entry: Dedicated compilation frame Date: Mon Nov 13 11:51:52 EST 2017 If there is another frame on the same X display that has a compilation window open, do not open a new one. Entry: projectile Date: Sat Nov 18 13:56:26 EST 2017 Projectile is a project interaction library for Emacs https://github.com/bbatsov/projectile Entry: emacs everything Date: Sat Nov 25 23:13:51 EST 2017 https://www.reddit.com/r/emacs/comments/6y3q4k/yes_eshell_is_my_main_shell/ Entry: dired shell command on path Date: Sun Nov 26 00:03:23 EST 2017 Now that I have a canonical network path layout, time to use it! Entry: helm Date: Sun Nov 26 02:50:29 EST 2017 https://tuhdo.github.io/helm-intro.html Entry: parse: error output -> source location links Date: Mon Nov 27 12:15:37 EST 2017 - erlang stack traces - nix compilation errors Entry: open link in browser on current frame Date: Mon Jan 8 01:12:19 EST 2018 How to do this? How to get access to the mozilla instances starting just from a DISPLAY variable? Entry: Custom start file location on windows Date: Tue Jan 23 09:05:54 EST 2018 Setting up Emacs for coworkers. Will be hosting everything on a Windows share. It appears to be looking in C:\Users\AppData\Roaming\.emacs.d\init.el I'm moving that directory out of the way. I want it to load from the windows share. Apparently it's possible to set the HOME environment variable. Maybe use a batch script? Yes, and set icon from .exe in link. Entry: htmlize + links? Date: Mon Jan 29 11:10:21 EST 2018 https://www.emacswiki.org/emacs/Htmlize https://www.emacswiki.org/emacs/SaveAsHtml Broke in recent htmlize, emacs versions. https://www.emacswiki.org/emacs/PrintWithWebBrowser Entry: minibuffer, multiple frames Date: Sat Apr 14 11:12:55 EDT 2018 If one frame is in minibuffer input mode, the other frames do not respond. This might be the problem I've been trying to debug for a while now... Entry: emacs asm mode is annoying Date: Mon May 21 10:30:52 EDT 2018 Mostly fill-paragraph doesn't work with comments. https://stackoverflow.com/questions/2668563/emacs-indentation-in-asm-mode Entry: linux code style Date: Tue Jun 12 15:44:26 EDT 2018 Set tab display to 4 characters. Private only, so it doesn't matter. Make sure that TAB key inserts tab char. Highlight non-tab spaces? Entry: bugs Date: Thu Dec 6 19:27:09 EST 2018 - cd: No such directory found via CDPATH environment variable - error in process filter: Assertion failed: (> (length arg) 2) Entry: multiple erlang projects Date: Thu Dec 6 22:15:49 EST 2018 It would be nice to be able to figure out which daemon to go to by traversing the filesystem upwards. Entry: Distel node switching Date: Sat Dec 8 11:36:25 EST 2018 Problem: hitting M-. connects to the wrong node. erl-find-source-under-point Would it be easier to have a hub node instead? No. The problem is that my module namespace is not compatible, so an additional hierarchical name space extension is necessary. So I'm having trouble use local-set-key I even run it interactively and actually press the damn key. Is it because there is a minor mode active? See next post. Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption Desktop-Save Display-Time Electric-Indent Erlang-Extended File-Name-Shadow Font-Lock Global-Font-Lock Line-Number Mouse-Wheel Shell-Dirtrack Simpleclip Tooltip Transient-Mark Winner Xterm-Mouse It's in erlang-extended-mode, which is from distel.el, in the distel-keys const. So the questions: How to override a keymap in a minor mode? local-set-key doesn't cut it here, because minor mode overrides buffer local variables. It might be possible to implement what I want (pick a different distel node) by other means. Entry: Active keymaps Date: Sat Dec 8 12:10:11 EST 2018 Something I've not understood for a while now.. https://www.gnu.org/software/emacs/manual/html_node/elisp/Active-Keymaps.html See discribe-modes Usually, the active keymaps are: (i) the keymap specified by the keymap property, (ii) the keymaps of enabled minor modes, (iii) the current buffer's local keymap, and (iv) the global keymap, in that order. Emacs searches for each input key sequence in all these keymaps. Override minor mode keybindings? This sets the map: https://stackoverflow.com/questions/46867410/override-minor-mode-keybinding-in-emacs Entry: Per file emacs node config Date: Sat Dec 8 13:53:03 EST 2018 First, make my-start-exo work again. I've removed ssh functionality. Maybe start it directly on the host. It's starting: exo on panda is now running inside the erlang terminal, however I still get: error in process filter: Assertion failed: (> (length arg) 2) It says nodedown: ... with a bad node. erl-nodename-cache is still set to the wrong one. Entry: distel mod prob? Date: Sun Dec 9 12:19:55 EST 2018 Since a while, the distel autocomplete is printing things on the console. I probably added something, but I do not remember where. How to find out? Is there a diff? On M-. it prints out the module name. The simplest is probably to trace the execution flow from that key binding. distel:find_source I wonder if this is lingering ebin code. I.e. there was something there before, but I've reverted the code but not the ebin. Yes that was it. 'make' solved it. Entry: distel Date: Sun Dec 9 12:50:44 EST 2018 Another problem on tab completion: Unexpected reply: [rex [badrpc [EXIT [undef ([xref start (distel_completions ([xref_mode modules])) nil] [distel start 1 ([file "src/distel.erl"] [line 1079])] [distel xref_query 1 ([file "src/distel.erl"] [line 1059])] [distel xref_modules 1 ([file "src/distel.erl"] [line 710])] [rpc -handle_call_call/6-fun-0- 5 ([file "rpc.erl"] [line 187])])]]]] http://erlang.org/pipermail/erlang-questions/2009-September/046433.html The module xref is not found, while it is there: tom@panda:/usr/lib/erlang$ find -name xref.erl ./lib/tools-2.9/src/xref.erl tom@panda:/usr/lib/erlang$ find -name xref.beam ./lib/tools-2.9/ebin/xref.beam Does this have something to do with start options? Ok I see. The release _does_ include all the erlang library files, just not the run system. So xref needs to be added. Adding 'tools' application to exo deps worked. EDIT: This breaks the initial startup! Fucking shite. Entry: CDPATH problem Date: Wed Dec 12 11:15:11 EST 2018 It seems to happen only when the focus is on an Erlang interaction buffer. tom@panda:/usr/share/emacs/24.5$ zcat `find -name '*.el.gz'` | grep CDPATH "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" "apid" "cdpath" "CDPATH" "history" "home" "ifs" "noexport" "path" "apid" "apids" "cdpath" "CDPATH" "history" "home" "ifs" "path" "pid" "CDPATH" "IFS" "OPTARG" "OPTIND" "PS1" "PS2") "Value of the CDPATH environment variable, as a list. If your environment includes a `CDPATH' variable, try each one of (setq cd-path (or (parse-colon-path (getenv "CDPATH")) (setq cd-path (or (parse-colon-path (getenv "CDPATH")) (error "No such directory found via CDPATH environment variable")))) ./files.el.gz "Value of the CDPATH environment variable, as a list. If your environment includes a `CDPATH' variable, try each one of (setq cd-path (or (parse-colon-path (getenv "CDPATH")) (setq cd-path (or (parse-colon-path (getenv "CDPATH")) (error "No such directory found via CDPATH environment variable")))) /usr/share/emacs/24.5/lisp/files.el.gz Added a print statement in the 'cd' function and found the path that way. A directory that did not exist. The eventual error was that default-directory local buffer variable was set to a directory that did not exist. Entry: easily switch distel nodes Date: Wed Dec 19 09:32:46 EST 2018 Where is this currently set? So first thing: in emacs.el, add my-distel-hatd. Now, some mechanism needs to switch between these two, e.g. switching buffers. Most importantly, M-. should pick the correct node. Entry: hide compilation window Date: Mon Jan 7 23:11:03 CET 2019 https://emacs.stackexchange.com/questions/62/hide-compilation-window Entry: Make a distel call Date: Sat Feb 2 10:52:13 EST 2019 In a situation where distel is connected to the correct node, how to make an RPC call or send a message? Maybe sending a message is simplest? There is a CPS style rpc function: erl-rpc is a Lisp function in `erl-service.el'. (erl-rpc K KARGS NODE M F A) Call {M,F,A} on NODE and deliver the result to the function K. The first argument to K is the result from the RPC, followed by the elements of KARGS. So it appears that switching is not necessary? Entry: Disable flycheck when "make flycheck.env" doesn't work Date: Thu Feb 7 11:03:25 EST 2019 This should not go into library code. It's a top level project feature. Use something similar to .push_change Problem is that flycheck uses shell commands for configuration, not lisp code. flycheck-gcc does: make flycheck.env 2>&1 >/dev/null . ./flycheck.env $FLYCHECK_GCC "$@" EDIT: Is it possible to run flycheck-define-checker in a hook or something? I need some Emacs code to determine which code to run based on the file. flycheck-command-wrapper-function (defun my-flycheck-command-wrapper (args) ;; Allow flycheck to depend on indirection stored in the file ;; system, e.g. in parent directory hierarchy. (message (format "flycheck: %s %s" default-directory args)) args) (setq flycheck-command-wrapper-function 'my-flycheck-command-wrapper) I think this is going to work. Generalize .push_change Entry: Parameterize behavior based on config files in the file system Date: Fri Feb 8 09:17:28 EST 2019 It's quite clear what this means -- environment variables stored in the file system. And it would be great to find a package for this because this idea cannot be original. Let's call it 'fs-context'. EDIT: Got it figured out, but there is a lot of indirection, and it's all dynamically typed coded. So good luck figuring out how it works when it breaks in a month or so! Entry: Pattern matching Date: Mon Feb 11 09:08:14 EST 2019 https://www.gnu.org/software/emacs/manual/html_node/elisp/Pattern-matching-case-statement.html Entry: How to have auto-revert-mode stay on the same line? Date: Sat Apr 6 08:49:26 EDT 2019 EDIT: I found something better: ghcid. Fixed up ghcid.el and put it in emacs_tools repo Entry: Code navigation Date: Sun Apr 7 08:42:41 EDT 2019 I want the same as in Erlang: M-x haskell-mode-jump-to-def ( which is not bound by default ) It complains: haskell-interactive-session: No session associated with this buffer. Try M-x haskell-session-change or report this as a bug. It seems best to just keep open a session. http://haskell.github.io/haskell-mode/manual/latest/Interactive-Haskell.html Entry: llvm-mode Date: Sat Apr 13 10:43:21 EDT 2019 Not in path. Also, it's old. (load-file "/usr/share/emacs/site-lisp/llvm-3.8/llvm-mode.el") (require 'llvm-mode) Entry: compile mode utf-8 issue Date: Sat May 25 09:21:38 EDT 2019 I don't completely understand what's going on, but this is what it looks like: gcc produces error messages with control characters: warning: initialization discards \342\200\230const\342\200\231 qualifier This happens when TERM=screen (why is it set like that?) but not if TERM=dumb 0xE2 0x80 0x98 Which is https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128 U+2018 ‘ e2 80 98 LEFT SINGLE QUOTATION MARK EDIT: The problem is in distel, converting emacs binaries to 8-bit strings. (decode-coding-string "\342\200\230const\342\200\231" 'utf-8) Entry: a distel process Date: Fri Nov 8 14:55:09 EST 2019 https://pdfs.semanticscholar.org/27e5/62f8e94df1c3289cee7900be18fb637150a0.pdf "The process has its own buffer,which can be used in any way" Look for 'defvar-local' in distel code? (get-buffer "*pid <0.52.0>*") erl-self is buffer local, so: (erl-pid-p (save-excursion (set-buffer "*pid <0.52.0>*") erl-self)) =>t (erl-S (save-excursion (set-buffer "*pid <0.52.0>*") erl-self)) All processes are in erl-process-buffer-alist So how does the buffer map to the currently active receive and the message queue? Entry: errors in processes Date: Sun Nov 17 08:24:39 EST 2019 condition-case seems to not be able to capture errors properly solve it by spawning a process for each command. Entry: reverted distel Date: Fri Feb 7 11:30:25 EST 2020 Applied Leo Liu's fix for float encoding, but had to revert back after other problems popped up unrelated to that fix. Currently back to 826b37a23ec1414f589ce93e0b45ee9ebc085320 deps/distel (4.1.1-9-g826b37a) Entry: TabNine Date: Tue Mar 10 21:43:41 EDT 2020 https://tabnine.com/ Entry: pow Date: Mon Mar 16 09:23:36 EDT 2020 (defun pow (x y) (exp (* (log x) y))) Entry: email in emacs Date: Wed Mar 18 18:39:35 EDT 2020 https://emacs.stackexchange.com/questions/12927/reading-and-writing-email-with-emacs I might not need it. Mutt + emacsclient works ok. Entry: the distel problem Date: Sat Apr 18 08:54:40 EDT 2020 Posted on the issue tracker but didn't find any responses, so let's just decode the term by hand. A = << 131, %% ETF 104,4, %% SMALL_TUPLE_EXT 97,6,%% SMALL_INTEGER_EXT 103, %% PID_EXT 100, %% ATOM_EXT 0,18, 100,105,115,116,101,108,95,50,55,50,49,49,64,112,97,110,100,97, %% Node: "distel_27211@panda" 0,0,188,139, %% ID 0,0,0,0, %% Serial 0, %% Creation 100, %% ATOM_EXT 0,0, 100, %% ATOM_EXT 0,3, 114,101,120>>. 131, %% ETF 104,2, %% SMALL_TUPLE_EXT 103, %% PID_EXT 100, %% ATOM_EXT 0,18, 100,105,115,116,101,108,95,50,55,50,49,49,64,112,97,110,100,97, 0,0,188,139, %% ID 0,0,0,0, %% Serial 0, %% Creation 104,5, %% Small tuple ext 100, %% ATOM_EXT 0,4, 99,97,108,108, 100, %% ATOM_EXT 0,4, 99,111,100,101, 100, %% ATOM_EXT 0,13, 101,110,115,117,114,101,95,108,111,97,100,101,100, 108, %% LIST_EXT 0,0,0,1,100,0,6,100,105,115,116,101,108,106,103,100,0,18,100,105,115,116,101,108,95,50,55,50,49,49,64,112,97,110,100,97,0,0,0,1,0,0,0,0,0>> B = << 131, 103, %% PID_EXT 100, %% ATOM_EXT 0,18, 100,105,115,116,101,108,95,50,55,50,49,49,64,112,97,110,100,97, %% Node: "distel_27211@panda" 0,0,188,139, %% ID 0,0,0,0, %% Serial 0 %% Creation >>. %% Let's try to change that node name to see if it makes a difference C = << 131, 103, %% PID_EXT 100, %% ATOM_EXT 0,18, %% 100,105,115,116,101,108,95,50,55,50,49,49,64,112,97,110,100,97, %% Node: "distel_27211@panda" "distel_18198@panda", 0,0,188,139, %% ID 0,0,0,0, %% Serial 0 %% Creation >>. So question: the format seems to be ok. Why does this create a bad term error? EDIT: It started happening again. And suspiciously, pid numbers are >32k *pid <0.34093.0>* 0 Fundamental Entry: distel pid numbers Date: Wed Apr 22 09:32:51 EDT 2020 Two questions: why doesn't it wrap properly in distel? And how on earth can there be only 15 bits for pids? Isn't Erlang supposed to be supporting many more processes? http://erlang.org/doc/apps/erts/erl_ext_dist.html erl-pid-counter is the culprit. I can probably just reset it? erl-pid-counter ;; 34109 (setq erl-pid-counter 0) That removed the error but it broke other things. Entry: Merge with upstream? Date: Wed Apr 22 09:50:59 EDT 2020 Maybe it's time to merge with upstream. Many of the mods I made are no longer necessary. So here's a list. I'm parking it in a zwizwa branch. Let's just see what happens if I just don't use these... I'm now running https://github.com/massemanet/distel/commit/f9c5067e8b31661c87af9a8eecca1bd4bdce026b tom@panda:~/exo/distel$ git diff 0ca3d73d90e87e72bdcaeb7de2126553ad5742fd diff --git a/elisp/derl.el b/elisp/derl.el index 2361245..4fcc7e8 100644 --- a/elisp/derl.el +++ b/elisp/derl.el @@ -28,8 +28,13 @@ mynode@cockatoo, FSM is the net-fsm process of the connection.") (defvar derl-cookie nil "*Cookie to use in distributed erlang connections, or NIL. +When NIL, we use derl-node-to-cookie or read ~/.erlang.cookie.") + +(defvar derl-node-to-cookie nil + "*Function mapping node to cookie. When NIL, we read ~/.erlang.cookie.") + ;; Local variables (defvar-local derl-connection-node nil @@ -211,11 +216,16 @@ complete and we become live." "Generate a message digest as required for the specification's gen_digest() function: (md5 (concat challenge-as-ascii-decimal cookie))" + (message (format "dbg: derl.el: %s" derl-connection-node)) (derl-hexstring-to-binstring (md5 (concat (derl-cookie) (derl-int32-to-decimal challenge))))) +(message "dbg: derl.el") + (defun derl-cookie () (or derl-cookie + (and derl-node-to-cookie + (funcall derl-node-to-cookie derl-connection-node)) (with-temp-buffer (insert-file-contents (concat (getenv "HOME") "/.erlang.cookie")) (while (search-forward "\n" nil t) diff --git a/elisp/erl-service.el b/elisp/erl-service.el index 7bda273..badefa0 100644 --- a/elisp/erl-service.el +++ b/elisp/erl-service.el @@ -890,6 +890,11 @@ Value is non-nil if search is successful." ;;;; Completion +;; [tom] This replaced distel:modules/1 and distel:functions/1 with +;; distel:code_modules/1 and distel:code_functions/2, which do not use +;; XREF. The latter misses some references for reasons I cannot +;; figure out. + (defun erl-complete (node) "Complete the module or remote function name at point." (interactive (list (erl-target-node))) @@ -913,13 +918,13 @@ Value is non-nil if search is successful." (pref (match-string 2 str)) (beg (+ beg (match-beginning 2)))) (erl-spawn - (erl-send-rpc node 'distel 'functions (list mod pref)) + (erl-send-rpc node 'distel 'code_functions (list mod pref)) (&erl-receive-completions "function" beg end pref buf continuing #'erl-complete-sole-function))) ;; completing just a module (erl-spawn - (erl-send-rpc node 'distel 'modules (list str)) + (erl-send-rpc node 'distel 'code_modules (list str)) (&erl-receive-completions "module" beg end str buf continuing #'erl-complete-sole-module))))))) diff --git a/elisp/erl.el b/elisp/erl.el index 010a004..2fb71a0 100644 --- a/elisp/erl.el +++ b/elisp/erl.el @@ -101,7 +101,7 @@ passed back to Emacs.") Processes spawned by other processes will inherit their GL, but \"brand new\" ones will use this.") -(defvar erl-popup-on-output t +(defvar erl-popup-on-output nil "Popup *erl-output* when new output arrives.") (defvar erl-stop-on-error nil diff --git a/elisp/erlext.el b/elisp/erlext.el index 3739d6c..c8a1629 100644 --- a/elisp/erlext.el +++ b/elisp/erlext.el @@ -297,11 +297,11 @@ (defun erlext-write-float (n) (cond - ((fboundp 'frexp) - ;; Function `frexp' was introduced in emacs 24.1; - ;; Erlang R11B-4 and later is able to decode this representation. - (erlext-write1 (erlext-get-code 'newFloat)) - (mapc #'erlext-write1 (erlext-encode-ieee-double n))) +; ((fboundp 'frexp) +; ;; Function `frexp' was introduced in emacs 24.1; +; ;; Erlang R11B-4 and later is able to decode this representation. +; (erlext-write1 (erlext-get-code 'newFloat)) +; (mapc #'erlext-write1 (erlext-encode-ieee-double n))) (t (erlext-write1 (erlext-get-code 'float)) (let ((f (format "%.20e" n))) diff --git a/elisp/net-fsm.el b/elisp/net-fsm.el index 4fedae7..117defe 100644 --- a/elisp/net-fsm.el +++ b/elisp/net-fsm.el @@ -47,11 +47,14 @@ addition to being passed as an argument.") ;; External API ;; ---------------------------------------------------------------------- + + (defun fsm-open-socket (host port) (let ((buf (generate-new-buffer " *net-fsm*"))) (fsm-with-error-cleanup (kill-buffer buf) (let ((p (open-network-stream "netfsm" buf host port))) (set-process-coding-system p 'no-conversion 'no-conversion) + (set-process-query-on-exit-flag p nil) (when (fboundp 'set-process-filter-multibyte) (set-process-filter-multibyte p nil)) p)))) @@ -265,6 +268,7 @@ buffer." (defun fsm-replace-process-buffer (process buffer) (let ((oldbuffer (process-buffer process))) (set-process-buffer process buffer) - (kill-buffer oldbuffer))) + (kill-buffer oldbuffer) + )) (provide 'net-fsm) diff --git a/src/distel.erl b/src/distel.erl index b02ecc9..b5bc4d6 100644 --- a/src/distel.erl +++ b/src/distel.erl @@ -23,6 +23,8 @@ -export([apropos/2, describe/4, get_arglists/2]). -export([xref_callgraph/1, who_calls/3, rebuild_callgraph/0]). +-export([code_modules/1, code_functions/2]). + -include_lib("kernel/include/file.hrl"). -import(lists, [any/2, @@ -684,16 +686,36 @@ stack_pos(#attach{stack={Pos,_Max}}) -> Pos. %% ---------------------------------------------------------------------- modules(Prefix) -> - case otp_doc:modules(Prefix) of - {ok,Ans} -> {ok,Ans}; - {error,_}-> xref_modules(Prefix) - end. + %% log:info("modules()~n"), + case otp_doc:modules(Prefix) of + {ok,Ans} -> {ok,Ans}; + {error,_} -> xref_modules(Prefix) + end. functions(Mod, Prefix) -> case otp_doc:functions(Mod,Prefix) of {ok,Ans} -> {ok,Ans}; {error,_}-> xref_functions(Mod,Prefix) end. +%% Alternatives, bypassing xref since it doesn't list everything and I +%% can't figure out why. See corresponding modification in +%% erl-service.el +code_modules(Prefix) -> + {ok, filter_prefix(Prefix, [atom_to_list(M) || {M,_Src} <- code:all_loaded()])}. +code_functions(Mod, Prefix) -> + MI = try Mod:module_info(exports) catch _:_ -> [] end, + {ok, filter_prefix(Prefix, [atom_to_list(F) || {F,_Nargs} <- MI])}. +filter_prefix(Prefix, List) -> + Re = "^" ++ Prefix, + lists:filter( + fun(M) -> + case re:run(M, Re) of + {match,_} -> true; + _ -> false + end + end, + List). + xref_completions(F,A) -> fun(server) -> distel_completions; (opts) -> [{xref_mode, modules}]; @@ -702,7 +724,9 @@ xref_completions(F,A) -> end. rebuild_completions() -> - xref_rebuild(xref_completions("",[])). + Opts = xref_completions("",[]), + %% log:info("Opts: ~p~n", [Opts]), + xref_rebuild(Opts). %% Returns: [ModName] of all modules starting with Prefix. %% ModName = Prefix = string() @@ -1089,3 +1113,5 @@ get_code_path(XREF) -> true -> code:get_path() end. + + Entry: Package assoc is obsolete! Date: Wed Apr 22 10:18:23 EDT 2020 Save abbrevs in ~/.emacs.d/abbrev_defs? (y or n) Package assoc is obsolete! Core issue seems to be: "Package assoc is obsolete!" https://github.com/joaotavora/yasnippet/issues/242 Simply removing (require 'assoc) from yasnippet.el fixes the issue for me and doesn't seem to have any negative effects so far. I removed visual-basic-mode and now the error is no longer there. Entry: distel Date: Fri May 1 18:14:49 EDT 2020 https://github.com/massemanet/distel/issues/68 Entry: gitlab org mode site Date: Fri May 8 07:50:01 EDT 2020 https://gitlab.com/pages/org-mode Entry: Distel issues Date: Sun May 10 12:13:48 EDT 2020 The pid problems seem to be solved, but after reverting I see this error pattern coming up. Often I see: *net-fsm* has a running process, kill it? Then I also ran into an error: net-fsm is not running That I could only resolve by restarting emacs. Entry: distel Date: Wed May 20 01:11:59 EDT 2020 Currently running this, which mostly works. tom@panda:~/exo/deps/distel$ git-log |head baaa46bc4af425ae906a914a5c821dc74a25a9cf Use pid as key for erl-process-buffer-alist Upgrading to: