How do I set the clipboard with a Texture in Gdk4 using Python? - gtk

nautilus-image-copypaste is a Nautilus extension that allows users to set the clipboard from image files and to create image files from the clipboard. Reading the clipboard works, however I can't figure out how to set the clipboard at line 108.
The Python Gdk4 bindings do not have the set_texture method, which would have been the obvious choice.
The set method, which is available in the bindings, requires a GType (GDK_TYPE_TEXTURE), but I've been unable find that in the bindings.

Related

emacs as an external editor for other applications (Houdini, Joplin)

I am trying to use emacs as an editor with other applications which allow people to open text in an editor (Sublime in this case), save it, and see it updated in the application. For example, in Houdini, a 3D software, I can type code in an external editor (in this case, Sublime), modify, save... and see it update in the application (Houdini). When I use emacs, it doesn't work. As an example, here I am adding a line of text using Sublime in Houdini:
Once I save and close, the text is updated in Houdini, and I can continue working:
Try as I might, I can't get this to work in emacs. I am sure the file has the same name, and when I save, it confirms the right file path.
What am I missing? I have run into the same problem with an application called Joplin: Sublime works, emacs does not.
A wild guess: Emacs has different behaviour when saving files than Sublime, and Houdini gets confused by that.
When you save a file in Emacs, Emacs creates a backup of the previous contents of the file, suffixing the file name with a tilde. By default it does this by renaming the existing file to the backup name, and then writing the contents to the real filename, thereby creating a new file.
(You can observe this by running ls -i before and after: the backup file will have the inode number that the main file had previously. Note that Emacs doesn't make backups after the first save during the same editor session, so you might need to restart Emacs or kill the buffer with C-x k to see this.)
I suspect that Houdini keeps the file open while Emacs is editing it, and so when you save the file from Emacs, the file that Houdini has open is actually the backup file.
You can configure Emacs to make backups by copying instead of renaming by setting the variable backup-by-copying to t. Add this to your ~/.emacs file (creating it if it doesn't exist):
(setq backup-by-copying t)

Is there a way to write a after-paste hook for the windows clipboard?

So say I have a specific value on the Windows clipboard and after I paste it, I want another different specific value to be pasted.
Is it possible to write a hook in say...powershell...to catch the paste of a specific value, copy the new next-value to the clipboard so I can paste the next link in the chain as it were?

emacs bookmark+ :How to create a file specific bookmark file?

bookmark+ package provides a (bmkp-this-file-bmenu-list) function. This, I suppose, loads a file specific bookmark file and filters only the bookmarks, which relate to the file.
Question: how to create this specific bookmark file for a specific file?
The result should be a filtered list of bookmarks, when using C-x p , command (which is bound to (bmkp-this-file-bmenu-list)
).
Edit: I use only one default bookmark file ~/.emacs.d/bookmarks. This file has some bookmarks for ~/.emacs file. Now, when I visit, say, ~/.emacs file, then run C-x p ,, I get the following error: bmkp-this-file-bmenu-list: No bookmarks for file ~/.emacs.
No, actually, command bmkp-this-file-bmenu-list does this (from the doc string):
Show the bookmark list just for bookmarks for the current file.
Set `bmkp-last-specific-file` to the current file name.
If the current buffer is not visiting a file, prompt for the file name.
It shows the *Bookmark List* display, listing only and all bookmarks that target the current file.
So if you use this command in a file buffer then you see displayed, in buffer *Bookmark List*, all of the bookmarks to the current file, and only those bookmarks.
This has nothing to do with using a different bookmark file.
Beyond what this command does, it's not clear to me what behavior you would like. What, for instance, do you mean by a "specific bookmark file for a specific file"?
You can create a different bookmark file using bookmark+ with M-x bookmark-load. You will be prompted for a filename. You can either merge bookmarks from different files or replace the current bookmark set entirely with this fileset by supplying a prefix argument.
Saving bookmarks bookmark-save will write all current bookmarks to the current value of the variable bmkp-current-bookmark-file , or if you supply a prefix arg you can choose a bookmark filename to save them to.
If you want a set of bookmarks in a distinct file, associated with particular files you could perhaps achieve this by running bookmark-load , and bookmark-save with prefixes. You could probably even automate this with hooks to match your editing contexts, although I expect that would be a little fiddly to achieve.
It sounds like your question might be rooted in some confusion about existing bookmark behaviour, and perhaps you don't even need to maintain separate bookmark files.

get Path of Subsystem

For documentation I need ca. 100 times a day the path of the selected/current subsystem.
That means I need some field where I can copy and past the path to use it in a document.
I just know and find the way with the Model Browser. But I have to typ the whole path.
As already stated, the currently selected block or subsystem can be retrieved by using gcb. But it is also possible to copy this directly into the clipboard. Therefore select the to be copied block and use the clipboard command:
clipboard('copy', gcb);
You can also create a Matlab shortcut (right click on the "Shortcut" toolbar and select "New Shortcut") or even a Simulink menu entry with according keyboard shortcut (search Simulink documentation for "sl_customization") for this command, if you use it that frequently.

Emacs: Can't activate input method

My default input method has always been configured this way:
(setq default-input-method "russian-computer")
Something broke, and all I get is this message (on top of the execution stack, if I'm interpreting it right) as soon as I press C-\:
activate-input-method: Can't activate input method `russian-computer'
It used to work without a hitch. There has been no intervention that I'm aware of; I'd like to get some clues.
Emacs loads the input-methods it knows from a directory called "leim" (Library of Emacs Input Methods). The location of the code to load should be something like
/usr/share/emacs/<version>/leim/leim-list.el
(For the exact location, search for an entry containing the word "leim" in your load-path variable by typing C-h v load-path.)
If you inspect that file, you should see an entry
(register-input-method
"russian-computer" "Russian" 'quail-use-package
"RU" "ЙЦУКЕН Russian computer layout"
"quail/cyrillic")
which refers to a subdirectory of the "leim" directory called "quail".
Make sure that both the file leim-list.el and the sub-directory quail exist on your system. The quail directory is distributed separately from the Emacs source code, so if you installed from source, make sure you included the leim-list package. See here (scroll to bottom):
http://ftp.gnu.org/pub/gnu/emacs/
If the leim directory is empty, you might consider re-installing emacs.