如何使球拍成为geiser中的默认实现

时间:2016-12-27 20:44:51

标签: emacs racket geiser

geiser文档建议设置Sub CopyFileForEachName() Dim rRenameList As Range Dim rNameCell As Range Dim sFileToCopyPath As String Dim sFolderPath As String Dim sFileName As String Dim sExt As String Dim sNewSubFolder As String Dim sCopyErr As String Dim sResultsMsg As String Dim lSuccessfulCopies As Long Dim i As Long 'These are invalid characters for the subfolder name (the double quote "" will be evaluated as a single double quote") Const sInvalidChar As String = "\/:*?""<>|" If Len(ActiveWorkbook.Path) > 0 Then ChDir ThisWorkbook.Path 'Start in same folder as the active workbook sFileToCopyPath = Application.GetOpenFilename("All Files, *.*") 'Prompt user to select file to copy If sFileToCopyPath = "False" Then Exit Sub 'Pressed cancel sFolderPath = Left(sFileToCopyPath, InStrRev(sFileToCopyPath, Application.PathSeparator)) 'Extract the folder path sExt = Mid(sFileToCopyPath, InStrRev(sFileToCopyPath, ".")) 'Extract the extension 'Prompt user to select the range of cells that contain the rename list 'Pressing cancel will cause an error, resume next will suppress the error and GoTo 0 will remove the On Error condition On Error Resume Next Set rRenameList = Application.InputBox("Select the cells that contain the rename list.", "Rename Cells Selection", Selection.Address, Type:=8) On Error GoTo 0 If rRenameList Is Nothing Then Exit Sub 'Pressed cancel 'If the list of rename cells is ALWAYS in the same location, you can comment out the above code, and uncomment the following: 'With ActiveWorkbook.Sheets("Sheet1") ' Set rRenameList = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp)) ' If .Row < 2 Then Exit Sub 'No data 'End With 'Prompt user to enter the destination subfolder name 'Change the Default parameter to provide a desired default subfolder name sNewSubFolder = InputBox(Prompt:="Please enter the name of the subfolder that will store the copied and renamed files." & Chr(10) & _ "Note that if the subfolder doesn't already exist, it will be created.", _ Title:="Destination Subfolder", _ Default:="ABC") If Len(Trim(sNewSubFolder)) = 0 Then Exit Sub 'Pressed cancel 'Verify valid subfolder name For i = 1 To Len(sInvalidChar) sNewSubFolder = Replace(sNewSubFolder, Mid(sInvalidChar, i, 1), " ") Next i sNewSubFolder = WorksheetFunction.Trim(sNewSubFolder) If Right(sNewSubFolder, Len(Application.PathSeparator)) <> Application.PathSeparator Then sNewSubFolder = sNewSubFolder & Application.PathSeparator 'Attempt to create the subfolder Err.Clear On Error Resume Next MkDir sFolderPath & sNewSubFolder On Error GoTo 0 If Err.Number <> 0 Then 'Failed to create the subfolder 'Check if the folder already exists If Len(Dir(sFolderPath & sNewSubFolder, vbDirectory)) = 0 Then 'Subfolder does NOT exist, the provided subfolder name must be invalid MsgBox "Unable to create subfolder named [" & Replace(sNewSubFolder, Application.PathSeparator, "") & "] because it is an invalid name." & Chr(10) & "Exiting macro." Exit Sub Else 'Subfolder already exists, got error due to duplicate name Err.Clear End If End If 'Loop through each cell and rename the file For Each rNameCell In rRenameList.Cells 'Make sure to use the extension of the file being copied If Right(rNameCell.Text, Len(sExt)) = sExt Then sFileName = Replace(rNameCell.Text, sExt, "") Else sFileName = rNameCell.Text End If 'Attempt to copy and rename the file to the destination subfolder Err.Clear On Error Resume Next FileCopy sFileToCopyPath, sFolderPath & sNewSubFolder & sFileName & sExt On Error GoTo 0 'Record successes and failures If Err.Number <> 0 Then sCopyErr = sCopyErr & Chr(10) & sFileName & sExt Else lSuccessfulCopies = lSuccessfulCopies + 1 End If Next rNameCell 'Build results message sResultsMsg = "Successfully copied [" & sFileToCopyPath & "] " & lSuccessfulCopies & " times into subfolder [" & sNewSubFolder & "]" If Len(sCopyErr) > 0 Then sResultsMsg = sResultsMsg & Chr(10) & Chr(10) & "Failed to copy with the following names: " & Chr(10) & sCopyErr End If 'Display results message MsgBox sResultsMsg End Sub 是阻止geiser-default-implementation提示方案实施的一种方法。 geiser文档建议的另一种方法是将run-geiser设置为以下值:

geiser-implementations-alist

在这两种情况下,文档都没有给出如何设置的示例。我尝试了涉及(((regexp "\\.scm$") guile) ((regexp "\\.ss$") racket) ((regexp "\\.rkt$") racket)) setq等的各种咒语,但每当我运行defcustom时,我都会继续提示您执行所需的方案。 alist甚至没有正确评估:首先,regexp函数似乎不存在;另一方面,我认为需要某种引用来防止未定义的guile / racket符号出错。如果有人能够举例说明在两种情况下都需要添加(例如).emacs的例子,将不胜感激。

还想了解为什么会这样......

run-geiser

......似乎没有用。

1 个答案:

答案 0 :(得分:0)

您可以从活动实现列表中删除其他实现:

(setq geiser-active-implementations '(racket))