mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Add emacs support, as per user requests. :) (#1633)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com> Co-authored-by: Jacob Richman <jacob314@gmail.com> Co-authored-by: matt korwel <matt.korwel@gmail.com> Co-authored-by: matt korwel <mattkorwel@google.com>
This commit is contained in:
@@ -13,7 +13,8 @@ export type EditorType =
|
||||
| 'cursor'
|
||||
| 'vim'
|
||||
| 'neovim'
|
||||
| 'zed';
|
||||
| 'zed'
|
||||
| 'emacs';
|
||||
|
||||
function isValidEditorType(editor: string): editor is EditorType {
|
||||
return [
|
||||
@@ -24,6 +25,7 @@ function isValidEditorType(editor: string): editor is EditorType {
|
||||
'vim',
|
||||
'neovim',
|
||||
'zed',
|
||||
'emacs',
|
||||
].includes(editor);
|
||||
}
|
||||
|
||||
@@ -59,6 +61,7 @@ const editorCommands: Record<
|
||||
vim: { win32: ['vim'], default: ['vim'] },
|
||||
neovim: { win32: ['nvim'], default: ['nvim'] },
|
||||
zed: { win32: ['zed'], default: ['zed', 'zeditor'] },
|
||||
emacs: { win32: ['emacs.exe'], default: ['emacs'] },
|
||||
};
|
||||
|
||||
export function checkHasEditorType(editor: EditorType): boolean {
|
||||
@@ -73,6 +76,7 @@ export function allowEditorTypeInSandbox(editor: EditorType): boolean {
|
||||
if (['vscode', 'vscodium', 'windsurf', 'cursor', 'zed'].includes(editor)) {
|
||||
return notUsingSandbox;
|
||||
}
|
||||
// For terminal-based editors like vim and emacs, allow in sandbox.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -141,6 +145,11 @@ export function getDiffCommand(
|
||||
newPath,
|
||||
],
|
||||
};
|
||||
case 'emacs':
|
||||
return {
|
||||
command: 'emacs',
|
||||
args: ['--eval', `(ediff "${oldPath}" "${newPath}")`],
|
||||
};
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -190,6 +199,7 @@ export async function openDiff(
|
||||
});
|
||||
|
||||
case 'vim':
|
||||
case 'emacs':
|
||||
case 'neovim': {
|
||||
// Use execSync for terminal-based editors
|
||||
const command =
|
||||
|
||||
Reference in New Issue
Block a user