Emacs: can I change the name of a started process? - emacs

I can use process-name to get the name of the process, but can I change the name after starting it? I looked in the manual, and even in the source and haven't found anything that seems like it would do this.

There's only one line in Emacs' process.c source file where p->name is set for a process p, and that is in the function make_process. All other functions just read that value, they never (re-)set it. So it seems the answer to your question is "no".
You could, of course, try to implement your own function that changes the name of a process. See here
for more information.

Related

Search files by name - Is it possible to define the ignored characters?

In VS-Code you can use cmd + p to quickly open a file.
Very often I copy a ruby class name from a stacktrace or from the code, which usually is something like MonduleName::ClassName (for example Admin::User), which by convention is located under module_name/class_name (in the example, would be admin/user.rb).
The problem is that the separator :: is not in the file path and VS-Code does not find it, so I have to
to delete those :: every time, which turns pretty annoying very quickly.
So the question here is pretty obvious, is there a way to tell VS-Code to ignore the : when performing the file search?
No, it is not possible.
I have added an issue in the VS Code project, which sounded reasonable to some maintainer, but it did not get enough upvotes from the community to be implemented and got closed/discarded.
I still miss this feature, so if somebody decides to reopen it, I would be glad to get a comment here.

Disabling thing-at-point inside helm-ff-guess-ffap-filenames

I have helm-find-files bound to C-x C-f since it provides a much more convenient way to open files. Unfortunately for me, if point is currently inside something that looks like a filename then that alters helm-find-files's behaviour, often changing its current directory. (See https://github.com/emacs-helm/helm/issues/1178 )
Is there a straightforward way for me to nobble thing-at-point inside helm-find-files-initial-input so that it never believes point is inside a filename? I thought that defadvice would help but I'm having trouble working out how.
Or perhaps there's a better way to make helm-find-files behave consistently no matter where point is without modifying its implementation directly?
You can set helm-find-file-ignore-thing-at-point to t.
Documentation:
Use only ‘default-directory’ as default input in ‘helm-find-files’.
I.e text under cursor in ‘current-buffer’ is ignored.
Note that when non-nil you will be unable to complete filename at point
in ‘current-buffer’.

What am I looking for to debug this elisp?

I have an org-mode file that I'm trying to export to a Beamer LaTeX PDF through XeTeX. It was working fine last night on this machine, and just as well on another machine on which I edited it afterward. Both are running org-mode 8, Emacs 24, same export process (3 runs of XeLaTeX)
When I synced back to this machine and tried to export again, I got the error Wrong block type at a headline named "". I checked all my headlines and gave them all names, but still got the same result.
Thanks to the wonders of indexed searchable FLOSS code, I immediately found the snippet online:
(env-format
(cond ((member environment '("column" "columns")) nil)
((assoc environment
(append org-beamer-environments-extra
org-beamer-environments-default)))
(t (user-error "Wrong block type at a headline named \"%s\""
raw-title))))
I'm not really solid on elisp at all, though, and I don't know most of what's going on here. From this snippet, what would I do to start debugging? (I realize I can start the emacs debugger, but it's not a PKE meter, I can't just wave it around.)
IMHE the best way to figure out what's wrong when you've found the relevant snippet of code is to use Edebug.
You should read the documentation to learn more about it, but basically here is my procedure:
identify the part of the code that crashes
instrument the code with Edebug (C-uC-M-x)
re-execute the code and go step by step to figure out what's going on (n)
If the problem is in another function, jump to it GOTO 2.
Iterate until you've understood the code and find a way to fix it.
Posting this answer just so that the specific solution to the particular problem the error was flagging is understood.
Apparently the version of Beamer I have on the other machine has a "normal" Beamer environment that specifies an otherwise blank, unformatted block. This is not present in this machine's install, or at least org/XeLaTeX don't know about it.
My steps were:
Search for all unnamed headings
Name each of them uniquely
Reproduce the error with the identifying string
Check the block type property against the available type list given in org-beamer-mode
Remove the offending type and replace it with another one
This is great and all, but I don't think it's the "best answer" because it involves no actual understanding of what the emacs interpreter was trying to tell me. If I didn't have a good idea of what was going on generally with the TeX, there's no way it would have worked. Dunno if this technique would impress anybody at an interview ;)

Eclipse Auto-Correct?

Is there a way to have Eclipse auto-correct certain misspellings? For example, I tend to type "System" as "Sysetm", and Eclipse catches it. However, it only tells me it's an invalid package, and I have to manually correct it. I'm hoping there's a way like in Microsoft Word, where you can add words to be auto-corrected.
Trust me you don't want something like that. It would make it almost impossible to write code with it changing what it thinks you want a variable called. Also its use would be very limited.
I have a hard enough time trying to convince word I mean colour and not color.
try to use "alt+/" after input 'sys'

what is difference between before-save-hook and write-file-functions

I read the manual at http://www.gnu.org/software/emacs/manual/html_node/elisp/Saving-Buffers.html#Saving-Buffers, but still not quite understand what is the difference between the two. It seems to me they both work as a hook to run whatever function you set before saving the buffer to the visited file. could anyone explain with examples? Thanks.
write-file-functions can be used to simply do arbitrary things before saving the file, but its stated purpose is to allow some non-default function to actually do the work of saving the file (or perhaps to manipulate the content for the purposes more directly related to the saving mechanism itself).
If modifying the mechanism for saving a file is not what you wish to do, I strongly suspect you should be using before-save-hook.
See also C-hig (elisp) Saving Buffers RET
write-*-functions provide a strict superset of what before-save-hook can do. More specifically, write-*-functions can replace the normal saving mechanism with another one. This means that a function added to write-*-functions might end up unused because some earlier function has already saved the buffer.
Well I would say that before-save-hook is here to modify the content. While write-*-functions are in charge of coding systems (compress the file content for instance or following any other file format) and the backup files.
Moreover write-*-functions may be buffer local while it does not seem to be the case for before-save-hook. But then I am not sure to know what it implies.