find-file-noselect patch
Hadrien Lacour <[email protected]> Sat, 15 Apr 2017 01:21:28 +0200
| Newsgroups | gmane.editors.qemacs.devel |
|---|---|
| Message-ID | <[email protected]> |
--rxknglebqsem6556
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hello,
here's a little patch to do the same as GNU emacs' find-file-noselect. Found it
pretty useful to load multiple files.
--rxknglebqsem6556
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="find-file-noselect.patch"
Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.265
diff -u -r1.265 qe.c
--- qe.c 14 Apr 2017 06:59:17 -0000 1.265
+++ qe.c 14 Apr 2017 23:17:31 -0000
@@ -6864,7 +6864,8 @@
* test the resulting data_mode, loading the file if raw_mode
* selected.
*/
- switch_to_buffer(s, b);
+ if(!(lflags & LF_NOSWITCH_BUFFER))
+ switch_to_buffer(s, b);
if (access(b->filename, W_OK)) {
b->flags |= BF_READONLY;
}
@@ -6944,6 +6945,11 @@
qe_load_file(s, filename, LF_KILL_BUFFER, bflags);
}
+void do_find_file_noselect(EditState *s, const char *filename, int bflags)
+{
+ qe_load_file(s, filename, LF_NOSWITCH_BUFFER, bflags);
+}
+
void do_load_file_from_path(EditState *s, const char *filename, int bflags)
{
qe_load_file(s, filename, LF_LOAD_RESOURCE, bflags);
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.247
diff -u -r1.247 qe.h
--- qe.h 12 Apr 2017 07:33:20 -0000 1.247
+++ qe.h 14 Apr 2017 23:17:32 -0000
@@ -1939,10 +1939,11 @@
#endif
/* file loading */
-#define LF_KILL_BUFFER 1
-#define LF_LOAD_RESOURCE 2
-#define LF_CWD_RELATIVE 4
-#define LF_SPLIT_WINDOW 8
+#define LF_KILL_BUFFER 1
+#define LF_LOAD_RESOURCE 2
+#define LF_CWD_RELATIVE 4
+#define LF_SPLIT_WINDOW 8
+#define LF_NOSWITCH_BUFFER 16
int qe_load_file(EditState *s, const char *filename, int lflags, int bflags);
/* config file support */
Index: qeconfig.h
===================================================================
RCS file: /sources/qemacs/qemacs/qeconfig.h,v
retrieving revision 1.65
diff -u -r1.65 qeconfig.h
--- qeconfig.h 25 Mar 2017 18:00:52 -0000 1.65
+++ qeconfig.h 14 Apr 2017 23:17:32 -0000
@@ -142,6 +142,10 @@
"find-alternate-file", do_find_alternate_file, ESsi, 0,
"s{Find alternate file: }[file]|file|"
"v") /* u? */
+ CMD3( KEY_NONE, KEY_NONE,
+ "find-file-noselect", do_find_file_noselect, ESsi, 0,
+ "s{Find file: }[file]|file|"
+ "v") /* u? */
CMD2( KEY_CTRLX('i'), KEY_NONE,
"insert-file", do_insert_file, ESs,
"*s{Insert file: }[file]|file|") /* u? */
--rxknglebqsem6556
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Qemacs-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/qemacs-devel
--rxknglebqsem6556--