尽管存在数千个Emacs Lisp库,但GNU Emacs在版本24.1之前没有(内部)包管理器.
我想大多数用户会同意,目前查找,安装并特别是保持最新的Emacs Lisp库是相当不方便的.
使生活更轻松的页面
对于早于24.1的Emacs版本:
一些包管理员
并不是没有人尝试过.(当问到这个问题时,其中一些不存在.)
UPDATE - package.el包含在GNU Emacs中,从版本24.1开始
包已包含在Emacs主干中.epkg还没有准备好,目前还没有.至少install-elisp,插件和use-package似乎不再被主动维护.
我创建了一个包含所有这些包管理器作为子模块的git 存储库.
一些可能有用的实用程序
包管理器可以使用这些实用程序和/或它们可以用于维护包的镜像.
我知道在Java中,静态方法就像实例方法一样继承,不同之处在于,当重新声明它们时,父实现被隐藏而不是被覆盖.好吧,这很有道理.但是,Java教程指出了这一点
接口中的静态方法永远不会被继承.
为什么?常规和接口静态方法有什么区别?
当我说静态方法可以继承时,让我澄清一下我的意思:
class Animal {
public static void identify() {
System.out.println("This is an animal");
}
}
class Cat extends Animal {}
public static void main(String[] args) {
Animal.identify();
Cat.identify(); // This compiles, even though it is not redefined in Cat.
}
Run Code Online (Sandbox Code Playgroud)
然而,
interface Animal {
public static void identify() {
System.out.println("This is an animal");
}
}
class Cat implements Animal {}
public static void main(String[] args) {
Animal.identify();
Cat.identify(); // This does not compile, because interface …Run Code Online (Sandbox Code Playgroud) 我检查了关于枚举的C#语言规范部分,但无法解释以下代码的输出:
enum en {
a = 1, b = 1, c = 1,
d = 2, e = 2, f = 2,
g = 3, h = 3, i = 3,
j = 4, k = 4, l = 4
}
en[] list = new en[] {
en.a, en.b, en.c,
en.d, en.e, en.f,
en.g, en.h, en.i,
en.j, en.k, en.l
};
foreach (en ele in list) {
Console.WriteLine("{1}: {0}", (int)ele, ele);
}
Run Code Online (Sandbox Code Playgroud)
它输出:
c: 1
c: 1
c: 1
d: 2 …Run Code Online (Sandbox Code Playgroud) 如何从列表中删除重复值?例如,
(remove-duplicates ["a" "b" "c" "a"])
=> ("a" "b" "c")
Run Code Online (Sandbox Code Playgroud) 当我使用时git config --global <some option> <some value>,Git会在我的相关条目中写入~/.gitconfig,缩进一个标签.由于我~/.gitconfig是版本控制的,我希望它不会一团糟,然后我必须手动进入并用空格替换选项卡.
添加条目时,Git可以被告知自动使用空格~/.gitconfig吗?
(请注意,这不是我在Git中提交的代码中的缩进,而是Git自己的配置文件中的缩进.)
我想在全局安装一些Haskell库,例如hindent我的编辑器的Haskell集成使用它.建议的方法是什么?
我认为这stack install hindent是正确的方法.但是,我想更新我的包,发现没有办法做到这一点.根据我发现的GitHub问题报告,
stack涉及管理项目的本地构建沙箱.它不打算成为全球包经理.
似乎有一些解决方法,比如在我想要安装的软件包上维护一个带有人为依赖性的虚拟项目.这听起来像一个可怕的黑客,我一直无法找到任何关于应该采取什么方法的官方文件.
使用我的系统软件包管理器(Homebrew)安装Haskell软件包不是一个选项,因为它们没有打包.
我本来会打开一个针对Stack的问题报告,但是贡献指南要求我在haskell-stack标签下提出问题.
根据文档SafeVarargs,@SafeVarargs注释只能应用于构造函数或变量arity方法,它们是static或者final.我已经读过,这是为了消除注释继承的问题; 也就是说,只有在无法覆盖该方法时才允许对方法进行注释.显然,构造函数,static方法和final方法不能被覆盖.但是,无论是private方法还是方法都没有final class.有人抱怨无法指定@SafeVarargs private方法,但这些问题都没有得到解决.总的来说,似乎没有人真正关心.我错过了什么吗?我抱怨没有任何实际应用的东西吗?要么... ?
在这个未回答的问题和另一个未解答的问题中描述的类似问题中,我在Eclipse Luna Service Release 1(4.4.1)(20140925-1800)中收到警告,"(已恢复)在lambda形状分析期间检测到内部不一致".代码如下:
public static <T> T findFirst(Iterable<T> list, Predicate<T> condition) {
/* ... */
}
public static Integer findFirstPrime(Iterable<Integer> integers) {
return findFirst(integers,
integer -> {
/* return either true or false */
}
);
}
Run Code Online (Sandbox Code Playgroud)
在文本阅读时引发警告integer ->.有一个错误报告指出问题已针对Eclipse Mars 4.5修复,但在此期间我还能做些什么?如果我想使用@SuppressWarnings,我怎么知道要提供什么警告类型?
我有一个抽象类AssociativeFunction,它扩展了Expr.有不同的函数是AssociativeFunction的子类,还有其他表达式是Expr的子类,但不是AssociativeFunction.
在AssociativeFunction类中的方法中,我需要检查Expr对象是否是当前类或其子类之一的实例,
即Product(扩展AssociativeFunction)并继承此方法; 因此,对于所有Product对象和所有CrossProduct(extends Product)对象,检查应返回true,但对于所有Sum(扩展AssociativeFunction)和Number(扩展Expr)对象,则返回false.
为什么以下不起作用?如何使用instanceof运算符使其工作?如果我不能,为什么不呢?
if (newArgs.get(i) instanceof getClass()) {
Run Code Online (Sandbox Code Playgroud)
Eclipse产生错误:
令牌"instanceof",== expected)上的语法错误
这段代码似乎有用,这是正确的吗?为什么它与(1)不同?
if (getClass().isInstance(newArgs.get(i))) {
Run Code Online (Sandbox Code Playgroud)我得到了一些C++代码,它具有以下结构的列表/迭代器.
typedef struct{
int x;
int y;
}my_struct;
std::list<my_struct> the_list;
std::list<my_struct>::iterator the_iter = the_list.begin();
Run Code Online (Sandbox Code Playgroud)
然后代码以the_iter这种方式访问x和y :
(*the_iter).x;
(*the_iter).y;
Run Code Online (Sandbox Code Playgroud)
我想将这些更改为更易读的版本:
the_iter->x;
the_iter->y;
Run Code Online (Sandbox Code Playgroud)
从我的C角度来看,这对于指针解除引用来说完全没问题.迭代器也是如此吗?有没有理由说我的同事会用(*pointer).而不是p->
我想在Java Swing菜单栏中添加快捷键.以下是我的尝试.
jMenuItem1.setText("Create");
jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEvent.CTRL_MASK));
Run Code Online (Sandbox Code Playgroud)
在这里,我想要三个KeyEvent.VK_C, KeyEvent.CTRL_MASK,和KeyEvent.SHIFT_MASK.
java ×5
inheritance ×2
annotations ×1
c# ×1
c++ ×1
clojure ×1
eclipse ×1
emacs ×1
enums ×1
git ×1
haskell ×1
indentation ×1
instanceof ×1
interface ×1
java-8 ×1
jmenuitem ×1
keyevent ×1
lambda ×1
list ×1
listiterator ×1
menuitem ×1
overriding ×1
packages ×1
spaces ×1
swing ×1
type-erasure ×1