在 Emacs Lisp 函数中,我想知道任意文件夹的 VC 根目录(如果在源代码控制下),就像 vc-print-root-log 一样。我正在尝试从 VC 文件/文件夹之外执行此操作(尽管创建一个临时缓冲区来执行此操作会很好)。我目前通过 magit - 有一个仅限 git 的解决方案(magit-get-top-dir dir-name)。
我尝试使用(vc-deduce-backend)'root 命令,但 vc-deduce-backend 检查的变量似乎只在现有的 vc 模式(例如 log-view-mode)缓冲区中设置。
有没有一种简单的方法可以从 VC 中解决这个问题?
我正在使用Flash TextField控件在Flash演示文稿中显示一些HTML内容,以便在大型触摸屏自助服务终端上显示.遗憾的是,如果显示的HTML内容中的任何图像标记指向不存在的图像,则会显示带有错误消息的对话框
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
Run Code Online (Sandbox Code Playgroud)
我试图避免弹出对话.通过loader类加载内容的解决方案是捕获IOErrorEvent.IO_ERROR,但我已经尝试在TextField上监听,在舞台上,Main和loaderInfo都无济于事.我试过用try-catch包装整个东西,但这也行不通.
这是我用来寻找解决方案的简化代码:
package {
import flash.display.Sprite;
import flash.errors.IOError;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
public class Main extends Sprite {
public function Main():void {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
var html:TextField = new TextField();
html.type = TextFieldType.DYNAMIC;
html.multiline = true;
html.htmlText = "Bogus image: <img src=\"foo.jpg\" />";
addChild(html);
}
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:这是整个工作代码.
当然,对于动态内容等,您需要一个图像列表和一个生成处理程序的函数等. …