In Emacs, what does this error mean? “Warning: cl package required at runtime”

http://stackoverflow.com/questions/5019724/in-emacs-what-does-this-error-mean-warning-cl-package-required-at-runtime

The reason of this warning is a GNU policy which does not want a package cl to be used in Elisp. But it would be foolish as well to prohibit it completely. So they decided to show a warning.

You can find more information here

shareedit

Just in case someone reads this on his quest for proper use of cl: The methods described here are now deprecated.

As least as of emacs 24, instead of cl you should use cl-lib or, if the macros suffice, cl-macs. These are new versions of cl that work with a clean namespace. E.g. instead of defun* you have cl-defun.

The old cl-package now is only for backward-compatibility and shouldn’t be used in new code.

shareedit

Right way to have ASP.NET / IIS NOT cache PDF files

http://stackoverflow.com/questions/8233670/right-way-to-have-asp-net-iis-not-cache-pdf-files

If your link to the pdf document had a unique querystring appended I believe that would prevent caching. Time in ticks is a good one to use, eg:

string.Format("{0}?t={1}", pdfFileUrl, DateTime.Now.Ticks);
shareedit

I just had a similar issue. I have my page allows users to input data and generate new a pdf file Save clicked. The new pdf file overwrites the old one. In IE8, when user click the pdf link after the Save, the old pdf will always showed (user need to clear the cache to display the new one). After hours of searching, I found that in IIS6, go to ‘Output Caching’, add a new cache rule with file extension ‘.aspx’, tick both ‘User-mode caching’ and ‘Kernel-mode caching’ then under both options, select ‘Prevent all caching’. This is working for me!

shareedit

Automatically update packages and delete old versions

http://emacs.stackexchange.com/questions/4045/automatically-update-packages-and-delete-old-versions

The following is now part of the Paradox package. Just invoke paradox-upgrade-packages.


This should do it.

(defun endless/upgrade ()
  "Upgrade all packages, no questions asked."
  (interactive)
  (save-window-excursion
    (list-packages)
    (package-menu-mark-upgrades)
    (package-menu-execute 'no-query)))

Just check which function is called by each of the steps you enumerated, and throw them inside an interactive function. Normally, the (y or n) prompts would be an issue, but package-menu-executeconveniently takes a NO-QUERY argument.

shareimprove this answer

Windows, Emacs, Git Bash, and shell-command

http://stackoverflow.com/questions/16676750/windows-emacs-git-bash-and-shell-command

Windows 7. Emacs 24.3.1. Git 1.8.1.msysgit.1. I have the following in my equivalent .emacs file:

(if (equal system-type 'windows-nt)
    (progn (setq explicit-shell-file-name
                 "C:/Program Files (x86)/Git/bin/sh.exe")
           (setq shell-file-name "bash")
           (setq explicit-sh.exe-args '("--login" "-i"))
           (setenv "SHELL" shell-file-name)
           (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)))

This works great when I want to do M-x shell: I can pop open a shell and type “ls”.

However, M-x shell-command is failing. When I try to run “ls” via shell-command (which should print its output in the *Shell Command Output* buffer, according to C-h f shell-command), I get a single error message:

“Searching for program: permission denied, bash”

There are some very old suggestions on the Google about call-process and many questions on StackOverflow about getting the shell to work in Emacs. Please note that M-x shell works great, and what I’d like to work is shell-command.

(Reason: https://github.com/donkirkby/live-py-plugin#installing-the-emacs-mode)

shareedit

Try setting both variables to point to the same executable and make sure the path is in exec-path:

(setq explicit-shell-file-name
      "C:/Program Files (x86)/Git/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/Program Files (x86)/Git/bin")
shareedit

How to quickly copy/move file in Emacs Dired?

http://emacs.stackexchange.com/questions/5603/how-to-quickly-copy-move-file-in-emacs-dired

From the documentation:

dired-dwim-target is a variable defined in `dired.el’. Its value is nil

Documentation: If non-nil, Dired tries to guess a default target directory. This means: if there is a Dired buffer displayed in the next window, use its current directory, instead of this Dired buffer’s current directory.

The target is used in the prompt for file copy, rename etc.

Put this in your init file: (setq dired-dwim-target t). Then, go to dired, split your window, split-window-vertically & go to another dired directory. When you will press C to copy, the other dir in the split pane will be default destination.

shareimprove this answer

How to reset color theme?

http://emacs.stackexchange.com/questions/3112/how-to-reset-color-theme

When I’m trying different color themes out, it seems if a particular element is not defined in the new theme the old theme value is retained, and this leads to some clashing. This happens in emacs 24 and also previous versions using color-theme. Is there a way to reset all colors in between to default so that each color theme looks as intended?

shareimprove this question

Are you sure that you are using color themes and not Emacs custom themes? Color themes are defined by library color-theme.el. Custom themes are available starting with Emacs 24 – and they are not the same as color themes.

  1. If you are using color themes then the answer is simple: just enable the pseudo color-theme named [Reset]. That completely undoes the theme: removes all effects that it imposed.
  2. If you are in fact using Emacs custom themes then the answer is not so simple. You cannotundo the application of a custom theme. What you can do, which will help a lot, is to disable each custom theme, using disable-theme, after it has been enabled and before enabling anothercustom theme.

    Here are two ways to do this “semi-automatically”:

    See those original S.O. posts for a little more info, and see the question and other answers to it on the same S.O. page. (Caveat: The accepted answer on that page is not an answer to the problem of undoing a custom theme.)

  3. Be aware that even the solutions described in #2 are not general solutions: they do not undo the application of a custom theme – there is no way to do that. That is, disabling a custom theme does not restore any non-theme customizations (e.g., face changes) that you might have made before enabling that theme and that were overridden by that theme.

In other words, undoing a color theme is trivial; undoing a custom theme is impossible. The best you can do for a custom theme is to disable it relative to other custom themes.

The best reference for this question and for ways of switching (e.g. cycling) among both color and custom themes is the Emacs Wiki page Color and Custom Themes.

And be forewarned: There is a fair amount of misleading information in various places about Emacs custom themes in this regard. People were rightfully excited that Emacs added custom themes as a feature in Emacs 24, and some of them jumped immediately to the mistaken conclusion that custom themes were a replacement for color themes. They are not. Each has some advantages. Not being able to undo is a major disadvantage of custom themes, for example.

[This GNU Emacs bug report is an enhancement request to remedy the inability to undo a custom theme (and thus restore earlier customizations).]

shareimprove this answer