texts: How to configure mouse button to execute a program in emacs

texts:
I have a lot of video files I want to filter through and delete if they are uninteresting. I opened the directory of video files in emacs and I want a left-click on the file to play that file in vlc. If it's interesting I'll leave it, and if it's bad I'll delete it in emacs after closing the vlc window.

How do I configure emacs to open a file in dired with vlc?

If anyone knows of alternative tools to accomplish this job, I'm all ears. Thanks!


texts: package.el: How can I avoid byte-compilation

texts:
How can I tell package.el to not byte-compile?

It is generally OK to byte-compile installed packages but it makes difficult to test a new Emacs with byte compiler improvements (such as Emacs 26 from 25) if you share .emacs/elpa/ with old Emacsen.


texts:
I've switched from emacs to spacemacs, but my muscle memory still uses the standard emacs keybindings -- despite attempts at avoiding key chords.  As an example, to save a file, I continue to use Ctrl x s instead of SPC f s.

What I'd like is a function that would provide a modeline prompt for keystrokes that I'm trying to avoid.

"Ctrl x s deprecated.  Use instead: SPC f s"

Update: I used the function that muffinmad supplied with a minor tweak.  For some tasks my attention isn't focused on the modeline, so an additional audio alert helps:

    (play-sound-file "oops.wav")


texts: Persist hideshow folds between sessions?

texts:
I use hideshow (hs-mode) in almost all languages. Most of the time, i keep function header lines visible but the body hidden like this,

function func(arg1, arg2){...}

So, every time I open the file, I do C-c @ C-l to hide the function body.  But, when I close emacs, these buffer states are gone and emacs open buffers without hiding the states.

Does any other lib support persisting show/hide info and reusing it?


texts: How can I configure AUCTeX to use tab characters for leading indentation?

texts: I configure indent-tabs-mode to t so that tab characters are used for indentation by default. AUCTeX apparently changes the value of indent-tabs-mode to nil and uses some other system for handling leading indentation, and there are many customization variables in the groups "TeX Indentation" and "LaTeX Indentation". As far as I've found so far, these variables only allow you to change the number of space characters used for indentation. How can I configure AUCTeX to use tab characters for indentation?


texts: void-function when loading ido-mode in Emacs24

texts:
I'm using Emacs 24.4.1 from Debian unstable and have added the lines from question "How do I switch buffers quickly?". However this results in an error message and I found no way to resolve it.

I can reproduce it by adding the following line into the *scratch* buffer:

(use-package ido-mode)

When I press C-j I get the following message:

Debugger entered--Lisp error: (void-function use-package)
  (use-package ido-mode)
  eval((use-package ido-mode) nil)
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  call-interactively(eval-print-last-sexp)
  popup-menu((keymap (new-file menu-item "Visit New File..." find-file :enable (menu-bar-non-minibuffer-window-p) :help "Specify a new file's name, to edit th$
  menu-bar-open()
  call-interactively(menu-bar-open nil nil)
  command-execute(menu-bar-open)

Why occurs this message and what should I do to get


texts: Elisp program to insert line numbers into a buffer?

texts:
I am NOT looking for emacs's line-number mode. I don't want to just display line numbers. I want to insert line numbers in a buffer, starting at point and going to mark, or perhaps continuing for some number that I specify via C-u. For example, suppose I have the following lines in my buffer:

So shall I live, supposing thou art true,
Like a deceived husband; so love's face
May still seem love to me, though alter'd new;
Thy looks with me, thy heart in other place:
For there can live no hatred in thine eye,
Therefore in that I cannot know thy change.
In many's looks, the false heart's history
Is writ in moods, and frowns, and wrinkles strange.
But heaven in thy creation did decree
That in thy face sweet love should ever dwell;
Whate'er thy thoughts, or thy heart's workings be,
Thy looks should nothing thence, but sweetness tell.
      How like Eve's apple doth thy beauty grow,
      If thy sweet virtue answer not thy show!

Now i put the cursor on line 3, the line that begins with the word "May." Then, I type C-u7M-xyour-new-elisp-programRET; or I type C-space, scrape down to line 9, the line that begins with "But," and then type M-xyour-new-elisp-programRET. In both cases, I get something like:

So shall I live, supposing thou art true,
Like a deceived husband; so love's face
001 May still seem love to me, though alter'd new;
002 Thy looks with me, thy heart in other place:
003 For there can live no hatred in thine eye,
004 Therefore in that I cannot know thy change.
005 In many's looks, the false heart's history
006 Is writ in moods, and frowns, and wrinkles strange.
007 But heaven in thy creation did decree
That in thy face sweet love should ever dwell;
Whate'er thy thoughts, or thy heart's workings be,
Thy looks should nothing thence, but sweetness tell.
      How like Eve's apple doth thy beauty grow,
      If thy sweet virtue answer not thy show!

I don't know enough elisp to start this, but I vaguely recall seeing an episode of "emacs rocks" a long time ago with an insanely short snippet of code done on-the-fly to do it! I haven't been able to find the episode again.

Every other "Similar Question" suggested seems to pertain to emacs's line-number mode, which apparently doesn't help me.

EDIT: I know that multiple-cursors may have a command to do this, but multiple-cursors seems to be permanently broken in Spacemacs, and I must use Spacemacs so that I can evangelize VIM users.


texts: Count down timer whenever file is opened

texts: C-C C-x ; can start count down timer. But I want to start the timer whenever I open any org file. I want to set it default for 10 minute. Kindly help


texts: Cannot access ELPA from Emacs behind a corporate proxy (Mac)

texts:
I'm having trouble accessing ELPA on my Mac from behind a corporate proxy. Emacs 27.1.
I have http_proxy and https_proxy configured appropriately (I've also tried setting url-proxy-services).
From Emacs (M-x package-refresh-contents):
Using a proxy for https...
Contacting host: elpa.gnu.org:443
elpa.gnu.org/0 nodename nor servname provided, or not known
Package refresh done
Failed to download ‘gnu’ archive.

From Terminal:
hostname:~ 000$ gnutls-cli -V --ca-verification --x509cafile=/tmp/master.pem elpa.gnu.org
Processed 205 CA certificate(s).
Resolving 'elpa.gnu.org:443'...
Cannot resolve elpa.gnu.org:443: nodename nor servname provided, or not known

hostname:~ 000$ nslookup elpa.gnu.org
Server:     XXX.XXX.XXX.XXX
Address:    XXX.XXX.XXX.XXX#53

** server can't find elpa.gnu.org: NXDOMAIN

It looks like gnutls and nslookup are having trouble resolving the domain (nodename nor servname provided, or not known is the same error that Emacs is throwing).
However curl has no issues:
hostname:~ 000$ curl elpa.gnu.org|head
<!doctype html>
<html>
    <head>
        <title>GNU Emacs Lisp Package Archive</title>

What am I missing?


texts: Unnumbered section among numbered ones in Org-mode

texts:
It is known that the option num:nil drops the numeration of sections (when exporting from org-mode), but

How could I include a unnumbered section among numbered ones in Org-mode?


texts: How to get the same Emacs environment on a different computer?

texts:
I'm a beginner in Emacs (using it for about 2 weeks now and loving it). As I update and expand my ~/.emacs.d/init.el file, the things that I write in there depend on certain packages that I installed from MELPA using M-x package-install, on .el files that I've written myself, etc.

My question is, should I in the future switch computers for example, what is the best way to seamlessly get the same exact Emacs environment on the new computer as I have now?


texts:
Windows 10, Emacs 25.1

I have 4 open buffers.

Here

To switch from buffer "file_1.txt" to buffer "file_2.txt" I use standard command windmove-right. It is bound to <M-right>.

To switch from buffer "file_2.txt" to buffer "file_3.txt" I use standard command windmove-down. It is bound to <M-down>.

And so on. It's very comfortable. Nice.

But what if I need to SWAP buffers "file_1.txt" and "file_2.txt"?

The result must be like this:

To do this I use package ace-window and command ace-swap-window.

Here steps.
1. Start command ace-swap-window

Select number of windows I want to swap - "3"

And as result the buffer "file_1.txt" and "file_2.txt" was swapped.

But I think it's very slow.

Is it possible when I stay on buffer "file_1.txt" and press, e.g. <M-S-right> to swap buffer "file_1.txt" and "file_2.txt".

Or when I stay on buffer "file_2.txt" and press, e.g. <M-S-down> to swap buffer "file_2.txt" and "file_4.txt".

I think it will be very fast and convenient.


texts:
I'm trying to customize the workflow that goes from org-mode to latex export. When I launch the export dispatcher, I have four sub-options under [l]atex ... the standard ones. But I think it's possible to add more options, as you can see in this videoclip from an emacs meetup https://www.youtube.com/watch?v=SzA2YODtgK4&t=2380s. Specifically, I'd like to use latexmk as my default exporter for org export to latex, and I can't figure out how to configure it.

What I really want is a way to launch latexmk directly as my exporter, so any way of doing that would be great.


texts: Does Emacs Lisp functions return objects by reference or by value?

texts:
I tried to determine if Emacs returned object by reference or value, but could not find a clear answer (searching google and Emacs Lisp manual). I guess it must be "by reference", and I just overlooked it somewhere..

For example:

(defun my-get-hash ()
  (let ((h (make-hash-table :test 'equal)))
    (puthash "a" 1 h)
    h))

(let ((h2 (my-get-hash)))
  (message (prin1-to-string h2)))

Here the hash h is created with a let binding, and then return to the caller. Does the caller receive a reference or a copy of h?


texts:
Given the following function using cl-block:

(defun wh/with-block (x)
  (cl-block 'foo
    (+ x 1)))

I can evaluate it, but C-u M-x edebug-eval-defun gives an error: edebug-syntax-error: Invalid read syntax: symbolp, "failed".

Why is this? Is this an Emacs bug, or am I using edebug incorrectly?


texts: In emacs batch mode, how to evaluate/tangle a named source block in an org-mode file?

texts:
I have a org-mode file (test.org) as below:

#+NAME: my-tangle-to-file
#+BEGIN_SRC sh :tangle my_tangle_file.sh :dir /tmp :shebang "#!/usr/bin/env bash"
  me=$(basename $(test -L "$0" && readlink "$0" || echo "$0"))
  echo "I was tangled to a file (${me})"
#+END_SRC

How could I tangle/evaluate the source block my-tangle-to-file in batch mode?


texts:
I had set up an Agenda view for showing today's tasks and TODOs with tags "UPCOMING" or "PROJECT":

(setq org-agenda-custom-commands
       '(("w" "Agenda + TODOs"
          ((agenda "" ((org-agenda-ndays 1)))
           (tags-todo "UPCOMING")
           (tags-todo "PROJECT")))))

Now, after updating org-mode yesterday, it still works fine, but instead of showing just today's tasks, it shows the entire week.

Any idea what might have caused this?


texts: Org-mode: Automatic fill-paragraph for TODO Closing Note?

texts:
In Emacs org-mode, I like to use TODO items. I switched on the automatic closing note, when an entry is marked DONE.

A small annoyance is that the fill behavior of the closing note usually changes from the *Org Note* buffer, where the message is entered, to the original Org-file. To have the right filling after inserting the closing note, I have to scroll down a few lines and use the M-q (fill-paragraph).

Is there a possibility to have automatic filling for the closing note?


texts: Emacs opens gitbash in new system window

texts:
I've try to follow this question and sulution Git Bash in emacs on Windows I have this function:

(prefer-coding-system 'utf-8)
(defun git-bash ()
  (interactive)
  (let ((explicit-shell-file-name "C:/Users/jankiewj/AppData/Local/Programs/Git/git-bash.exe")
        (explicit-bash.exe-args '("--login" "-i")))
    (call-interactively 'shell)))

but when I execute this function, git bash is created in new system window instead of Emacs window. So I don't even get the same error as OP.

I've also tried to run ansi-term but got error:

apply: Spawning child process: Invalid argument

How can I make git bash work inside Emacs window on MS Windows?


texts: mu4e-org link storing - "No method for storing a link from this buffer" error

texts:
The problem
I've recently moved to using mu4e for viewing and organising my email. I'm trying to use the function org-store-link in a mu4e message buffer but I encounter the error:

No method for storing a link from this buffer

Research/tests
I looked up the problem and found someone with a similar issue:
Unable to link org-mode capture items to mu4e email messages
However, the solution in this case was to add (require 'org-mu4e) to the init.el file. I'm running mu4e version 1.5.7, and AFAIK, they have moved the link storing functions to mu4e-org.el (see https://github.com/djcb/mu/tree/master/mu4e), which is loaded by default when mu4e-org-support has value t (I have checked using M-x describe-variable and this is the case). Even if I do write (require 'mu4e-org) or (require 'org-mu4e) in my init.el file, I get the same error.
I looked at the source code for org (https://github.com/bzg/org-mode/blob/master/lisp/ol.el, I'm using version 9.3) and used M-x describe-symbol to print the value of org-link-parameters, and I can see the entry for mu4e which is:
 ("mu4e" :follow mu4e-org-open :store mu4e-org-store-link)

I also ran the code:
(cl-loop for link in org-link-parameters
       with store-func
       do (setq store-func (org-link-get-parameter (car link) :store))
       if store-func
       collect store-func)

in my scratch buffer, which is from the function org-store-link-function in ol.el, and this returns (... mu4e-org-store-link) which looks good.
So I think the problem might lie in the fact org-store-link calls this function and returns a nil value. But I've checked the mu4e-org source code and I think this should run correctly so long as I'm in the mu4e-header or mu4e-message major mode.
Does anyone have any idea where the problem is or any additional tests I should run?


texts: Can I sync github issues and milestones with org-mode?

texts: Is it possible to effectively use org-mode as a front end to github issues and milestones (with two way sync)?


texts:
I'm trying to edit a keyboard macro using kmacro-step-edit-macro.
The macro starts by isearching for a word.

C-s         ;; isearch-forward
binary_function     ;; self-insert-command * 15
RET         ;; newline

When stepping through the macro it only searches for the first letter in the word, after which it just inserts the rest into the buffer.
Am I using kmacro-step-edit-macro wrong? Is it broken?
I'm using emacs 26.1 on windows.


texts: Programmatically add birthdays/holidays to agenda view in org-mode

texts:
org-mode offers a few built-in options to add birthdays/holidays to the agenda view in org-mode; however, there is no built-in support to add those dates entirely programmatically -- without manually adding diary entries or entries in the standard org file.

http://orgmode.org/manual/Weekly_002fdaily-agenda.html

Is there a way to add birthdays/holidays to the agenda view programmatically, similar to what calendar-mode offers?  In calendar-mode, a user may define holidays and birthdays with a variable combined with functions such as holiday-fixed and holiday-float.  The same type of set-up for org-mode seems useful.


texts: Is it possible for org-publish to ignore certain sub-directories?

texts:
I am working on managing my website with ox-twbs. The directory tree of my site looks like this:

mysite/
├── bar
│   └── private
├── foo
│   ├── eggs
│   │   └── private
│   └── spam
└── img

I want org-publish to ignore all files under a directory named private. Is this possible?

My project in my .emacs looks like this

(let ((proj-base (file-name-directory load-file-name)))
  (setq org-publish-project-alist
    `(("org"
       :base-directory "~/mysite/"
       :recursive t
       :publishing-directory "~/published-pages/"
       :exclude ????
       :publishing-function org-twbs-publish-to-html)
      ("static"
       :base-directory "~/mysite/"
       :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|txt"
       :publishing-directory "~/published-pages/"
       :recursive t
       :exclude ????
       :publishing-function org-publish-attachment)
      ("website" :components ("org" "static"))
      ))

My guess is that I can exclude everything under a directory named private with something like :exclude "*/private/*" but this doesn't seem to work.


texts: How to switch to the compilation buffer automatically after compile?

texts:
Once you run compile you get a little buffer with the compilation output *compilation*. But, Emacs does not switch to it automatically and you remain in the file you compiled. How can I automatically switch to the compilation buffer once compile is ran and the *compilation* buffer is shown. I tried,
(defun switch-to-compilation ()
  (select-window (get-buffer-window "*compilation*" t)))

(add-hook compilation-mode-hook #'switch-to-compilation)

But that gives me: Wrong type argument: window-live-p, nil.


texts: auto intendation on newline doesn't stay at same indentation for python docstring

texts:
Ubuntu 19.10
emacs 26.3 from system repos
I do use elpy and evil-mode

In general when I am editing python code, indentation works just fine.  However, when I am editing doc-strings, when I type enter to get a newline, it goes all the way to column 1. (fill-paragraph) and (indent-region) will both fix the indentation, but its annoying and I'm wondering if its possible to get emacs to respect the indentation that I'm using.

below is an example of what I mean

def func():
    """a dummy function

    if I start typing here, then type enter,
then it moves here...,

    however if I type here... lorem ipsum lorem ipsum blah blah blah, need
characters to get past 80, now if I hit M-q, or highlight the region and then
(indent-region), then it changes it to:

    however if I type here... lorem ipsum lorem ipsum blah blah blah, need
    characters to get past 80, now if I hit M-q, or highlight the region and
    then (indent-region), then it changes it to:

    """


texts: Add another level to org-mode visibility cycling

texts:
The way S-TAB (org-global-cycle) switches between "top headline -> all headlines -> all content" is great for showing an outline and provide overview, but acts on the full document. Using TAB (org-cycle) works on a local part of the document, but cycles between "chosen headline -> next headline -> all content".

Thus, org-cycle does not provide the same good overview, as all the content is revealed before an outline has been shown.

Is it possible to modify (org-cycle) to cycle between four levels, e.g., "chosen headline -> next headline -> all headlines -> all content"?


texts: Saveplace (remembers your cursor position) not working anymore with Emacs 25?

texts:
Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL
Compiled from Harroogan Emacs.
Windows 7 x64 bit.

Situation:

The package saveplace remembers where your cursor/point was when you leaves the file.

When you visit the same file again, the point goes to the last place where it was when you previously visited the same file.

After upgrading to Emacs 25.0.50, I couldn't get it working.

Reproduce:

The empty dot-emacs configuration:

;; Emacs.el
(require 'package)
(package-initialize)
(require 'saveplace)
(setq-default save-place t)

Then I start the Emacs.

I open a file, edit somewhere, save it while the point is still on that place. Then I close Emacs.

And start Emacs again. Open same file again, but the cursor is on row 1.

With minimal configuration, I couldn't it get working.
This happened after upgrading from Emacs 24.5 to Emacs 25.0.5

So my first assumption is saveplace seems to be broken on Emacs 25.


texts: Editing python, yaml etc: how to show lines for each column?

texts: How can I show a barely visible line for each column so that column-based indenting for python/yaml code is easier in emacs? I understand I can see the column number, but I would like a more visual help, like a grid (except I don't want horizontal lines, only vertical ones).


texts: How to cycle between language specific abbrev tables in a buffer?

texts:
I have (human-)language-specific abbrev-tables named like lang-francais-mode-abbrev-table, lang-castellano8-mode-abbrev-table backed by my ~/.emacs.d/abbrev_defs file. The language names are the ispell dictionary names.

I can't just load all the abbreviations into memory in global-abbrev, because I then have "collisions", e.g. "dont" stays "dont" in French, but should become "don't" for English. And "ten" and "men" should stay as is in English, but become "m'en" and "t'en" for French.

To cycle between flyspell languages, I use this function from the emacs flyspell wiki page:

(let ((langs '("american" "francais" "deutsch8" "castellano8")))
  (setq lang-ring (make-ring (length langs)))
  (dolist (elem langs) (ring-insert lang-ring elem)))

(defun cycle-ispell-languages ()
  (interactive)
  (let ((lang (ring-ref lang-ring -1)))
    (ring-insert lang-ring lang)
    (ispell-change-dictionary lang)))

I would like to change cycle-ispell-languages to also cycle the active language table for this buffer. How would I do that?

I know, I can setq local-abbrev-table lang-francais-mode-abbrev-table, but that then removes(?) the other active abbrev-tables, that other (major) modes might add, or does it?

Note: I edited out a significant portion describing me at an earlier point of the same problem.


texts: How can I mark sections of a very large `org-agenda` file as read-only?

texts:
I prefer to work in one large org-agenda file. I have my appointments and notes in there from the past five years. I do not want to accidentally change any parts of my old entries while adding new information. I do not like to archive entries but keep them as they are. I would like to set some headings as "read only".
How can I do that? Or how can I at least make it more difficult for me to make any accidental changes to these headings and their contents, perhaps by "locking" them somehow?
I am running Emacs 27 on Windows 10.


texts: How to repeat an appointment within an interval

texts:
I'm using org-mode and the agenda for weekly planning, kind of like a calendar. Entries include things like "sleeping 11pm to 6am" and "gym 3pm to 5pm", or even "read dresden files 8pm to 9pm". I use regular active timestamps for this.

Say I have to be somewhere 9am to 5pm every day except Sundays for the next 5 weeks.

Things I've thought of:

Use org-clone-subtree-with-time-shift, manually delete any Sundays, and put it all in its own subtree so I can archive it later. If the schedule changes, it's quite a bit of error prone editing work.
Single headline with multiple (30) active timestamps. That way, at least I can use column editing to shift times around. Still a lot of noise, though.
Put an entry with 6 repeating stamps (every day except Sunday) in its own file, remove from agenda files when done.

I want to keep past schedules for reference (i.e.: what was my schedule 23 days ago? How much time was I putting into the gym last month? Have I been scheduling enough reading time recently? And so on), so completely removing things from the agenda (such as temporary files in agenda-files) is not very useful to me.

How would you handle a situation like this in your agenda?

Is there a reason org-mode doesn't support an "end" mark for repeating entries?


texts: Setting Spacemacs default conda environment

texts:
This question answers where spacemacs looks for conda environments and how to change them with major-mode pyvenv-workon.
There's one environment that I use for 90% of what I do. Can I set a default environment for the python layer or is it more reasonable to have a init for the python layer that calls pyvenv-workon? I'm new to emacs and spacemacs, so how would I do either of these?
There doesn't appear to be a specific variable in the python layer and the dotspacemacs/user-config () would run on any layer, so I might not want that. Despite that, what I did was write (pyvenv-workon "path/to/default/conda") in the user-config () and it seems to work for python code and likely others, but I'm not sure if it will break anything that relies on the system python.


texts: How to set major mode according to buffer name for non-file buffers

texts:
Some buffers are created by emacs and is set in fundamental mode, like the Org-Babel results. I think it is more convenient to set them in special mode, which can be closed with key q. How do set the mode for those automatic buffers or if the name contains *?

Lawlist and Drew's comments below show possible ways to do it, what I want is a special-display buffers for some buffers with ... names. The appropriate way of course is to find the function for creating the buffer and change it in the package, but it doesn't suit everybody.

Since special-display-regexps is obsolete, can anyone help me on an display-buffer-alist with a custom function to look for Org-Babel Results and set it to special mode?

Thank you for your help.


texts: Flyspell overwrites C, C. ; modifying local-set-key after flyspell-mode-hook fails to change behavior

texts:
Flyspell sets the keys C-. and C-,. I prefer to have other binds living on these keys. I would have assumed locally setting keys in flyspell-mode-hook would have fixed this:
    (add-hook 'flyspell-mode-hook
                        (lambda () ;; flyspell sets these keys. Bad flyspell.
                            (local-set-key (kbd "C-,") 'ivy-switch-buffer)
                            (local-set-key (kbd "C-.") 'other-window)
                            ))

Unfortunately, it doesn't. I found this other post, but there is no flyspell-auto-correct-binding equivalent for these two keys, so I'm stumped. https://stackoverflow.com/questions/6617507/setting-shortcuts-keys-in-specific-modes-in-emacs-e-g-ido


texts: org-mode : how to get more space between 'List of all TODO entries'

texts:
C-a-t is bound to `org-todo-list (i.e., "List of all TODO entries").

Is there a way to add space between each row in the *Org Agenda* output buffer when the list is displayed?


texts: How can I have comint buffer input histories betweens different comint sessions?

texts: I'm missing the input histories like what's in IPython. But it seems that the defaults do not keep input histories after the comint buffer is killed. Also I'd like to keep them between emacs sessions.


texts: What Emacs Lisp boolean/logical convenience functions exist?

texts:
What boolean/logical convenience functions / macros are available for Emacs Lisp in either the core set of functions or external packages?
I'm interested in just about anything other than the built-in logical operators in and, or, not (null) and conditional forms (if, when, unless, cond).  To illustrate the sort of convenience functions I have in mind:
Common Lisp has sequence predicates such as some and every and other functions like count-if (in cl-lib as cl-some, cl-every, and cl-count-if respectively).  When used with an identity function, (cl-some #'identity my-list) it performs a logical OR over elements in the list and (cl-every #'identity my-list) performs a logical AND over elements in the list.  These are convenient and are nearly ideal, but aren't purely logical functions because they require a predicate that is applied to each element.  These functions are available in cl-lib.
and and or conceptually fill the same niche, but clearly note that their use is limited because they are implemented as macros.  Expressions such as (apply #'and my-list) are not possible.
I have reviewed the list of ~1089 built-in Elisp functions and macros and only know of two relevant convenience functions.  booleanp checks if the argument's value is t or nil and not is an alias for null.
There are also numerous boolean vector convenience functions that are a part of Elisp, but as far as I can tell are only suitable for binary manipulation.
@Dan points out the use of memq to search for nil values in a list can evaluate functions of logical values of a list using variations of (memq nil my-list).
An example of a potential convenience function would be a boolean identity function that simply converts a value to its canonical boolean form.
(defun boolean-identity (x)
  (if x t nil))


texts: temporarily disable recentf without writing the list to disk?

texts:
I'm trying out the dashboard package and noticed that my .org files kept getting added to the recentf list, because dashboard uses OrgMode to generate the agenda that it displays.

So I added code to dashboard that boils down to:

;; When rendering the dashboard, do the following:

;; if recentf mode is on, turn it off
;; so we don't add items to the Most Recently Used list:
    (if (recentf-enabled-p) (recentf-mode -1))

;; render the dashboard by rendering each widget

;; if recentf mode was originally on, turn it back on
;; this is pseudocode, of course :)
    (if (recentf-WAS-enabled-p) (recentf-mode))

This works (I'm not saving the information into my recentf list) but this also has the effect of saving my recentf list every time that I disable recentf-mode.  This happens every time I switch back to the dashboard buffer.

My question: is there a way to disable recentf-modewithout flushing the list to disk?

What I'm really trying to do is temporarily get recentf-mode to stop recording new entries in the list - I'm only turning it off because there doesn't seem to be another way to do that.


texts: fix buffer invalid UTF-8 encoding characters by query/replace

texts:
When I copy text from web pages, there are some special characters like ', - etc (not UTF-8 encoding). As you can see in the following screenshot:

I checked out some similar questions in this site:

[X] How to strip invalid UTF-8 characters from a string?
[X] How to fix latin character (e.g. ç, é) incorrectly displayed in emacs ess-buffer?
[X] How encode to UTF-8 content of buffer?
[X] Character encoding when copying some text from somewhere to Emacs and saving to a file

But can't find what I want.
I want to do query/replace all invalid UTF-8 encoding characters in buffer just like [M-%] in Emacs.


texts: OS X: make Emacs frame the frontmost window-manager window, but not the "key window"

texts:
(progn (sleep-for 5) (x-focus-frame nil))

focuses the Emacs frame, but also makes it the "key window" (ie, when you type, the keypresses gets sent to this window, which may or may not be the frontmost window).

since "x-focus-frame is a built-in function in C source d", I don't know where to look for related functionality.

The motivation is that I want one of my Emacs frames to always be on top, so I can keep an eye on the terminal output, while still being able to type into whatever application I'm currently using (e.g. the browser).

Objective-C's orderFront would work, if this behavior were exposed (https://stackoverflow.com/questions/4859974/make-nswindow-front-but-not-in-focus)

also, if this is impossible, how hard you think it would be to expose this functionality for the next release? For portability, I think (some?) Linux have the same concept ("key window" versus "frontmost window"); I don't know about MS Windows.


texts: Can org-publish-project-alist follow symlinks?

texts:
I use org-publish-project-alist to maintain my personal webpage. On my local machine, I have dozens of git-repos where I develop files I want to share on my webpage. Currently, I'm using hardlinks to include these files in my project. Recently, I've realized that this project would be easier to maintain if I could put symlinks to my files in my project directory and have org publish the actual files that the symlinks point to. Is this possible?

For instance, suppose I have a file foo.pdf in a directory mylocaldir on my machine

$ tree /home/me/mylocaldir/
/home/me/mylocaldir/
├── foo.pdf

I'd like my org project to have a symlink pointing to foo.pdf

$ ln -s /home/me/mylocaldir/foo.pdf /home/me/myorgproject/foo.pdf

When I publish myorgproject, I'd like emacs to publish the file foo.pdf as a pdf, not as a symlink.


texts:
By default (e.g., in fundamental mode), emacs seems to treat the sequence of characters abcαβγ in a buffer as two separate words. In particular, a command like M-f done at the beginning will only move past the abc.

I have trouble understanding what is going on and how to change this behaviour. I thought that the definition of a word is a sequence of characters with syntax class w, but here all six characters have syntax class w yet it is treated as two different words.

I tried to use superword-mode, it seems to work for M-f for instance but double-clicking on it will still only select only one of the two halfs (maybe that’s a bug in superword-mode?)


texts: Orgmode Spreadsheet: update formula when adding new column

texts:
I have a small square orgmode spreadsheet with some data in it and 2 extra columns to the right with some formulas, like average and sum.
I want to add some new columns in the middle of my spreadsheet in order to input more data.

Question: Is there a way to update all formulas automatically in order to include the new columns?

Example: =vsum($2..$12) and I'm adding two new columns, so I want the formula to be updated to =vsum($2..$14); since there are many formulas, I want them all to be updated automatically


texts: Turn array from one-line into element-per-line

texts:
Say I have PHP array like this: $arr = ['one', 'two', 'three']; and I want to convert it to

$arr = [
    'one',
    'two',
    'three'
];

real quick.

Is there any ready to use soluions?


texts: How can I make `setf` work with `plist-get`?

texts:
There's no built-in setter for plist-get. Example:
(let ((pl '(:what (one))))
  (push 'two (plist-get pl :what))
  pl)

Error: let*: Symbol’s function definition is void: \(setf\ plist-get\)
How can I make setf work with plist-get?


texts: Specify fallback possibilities for file-local variables?

texts:
It is clear from the manual how to set file variables:

-*- mode: modename; var: value; … -*-

For example, at the top of my ~/.gitconfig file, I have

# -*- mode: conf; -*-

I recently discovered gitconfig-mode, which makes this unnecessary, except in the case that this .gitconfig is opened in an Emacs install that doesn't have gitconfig-mode.

Is there a way to write the file mode specification to have a "fallback" mode, so that gitconfig-mode is used if available, otherwise conf-mode is used?


texts: My init.el gets stuck on trying to install "spinner", a sub-dependency of cider

texts:
I've installed emacs on a new machine (macos) brew cask install emacs. My init.el file gets stuck installing cider (clojure ide) because it requires "spinner". When I do: M-x package-refresh-contents, I get the message "Failed to download 'gnu' archive" which leads me to believe elpa may be down, however, the elpa website itself does not appear to be down. If I try to manually install the package, the specific message is something to do with a "bad request".

I've tried to manually install the spinner.el file just to unblock myself, but that didn't seem to work. So the question is in two parts:

How can I dig further into the issue, see if elpa is working, and debug the problem?
How can I unblock myself? Does package installation of CIDER not check if "spinner" is already installed?


texts: org-mode latex and pdf export custom title

texts:
I'm using the latest org-plus-contrib package from the org ELPA archive under emacs 24.5 (Linux and OSX). I needed to have a custom title which includes a logo PNG in documents I export from org to PDF. I use the hitec document class as the bae article class.

I don't always need to generate this custom title, so rather than define a new custom class, I add the following to one of my org template files I use when creating a new document. The solution mostly works, but I'm not sure if my approach is really that good and would like to get some feedback or suggestions.

My requirement is to have the title include a PNG logo on the left and have the title, subtitle, author and date on the right (flushright). This is what I have in my latex preamble

\makeatletter
\def\@maketitle{
  \begin{minipage}[c][4cm][t]{\linewidth}
    \begin{minipage}[t][4cm][c]{4cm}
      \includegraphics{/home/tcross/Pictures/unelogo_medium.png}
    \end{minipage}
    \begin{minipage}[t][5cm][c]{10cm}
      \flushright
      \Large \textbf{\@title} \\
      \vspace{16pt}
      \large \@author \\
      \normalsize \@date
    \end{minipage}
  \end{minipage}}
\makeatother

What I do is define a minipage and then inside this minipage, I define two more minipages which are set to be side by side with the left minipage containing the logo and the right minipage containing the title, author, date etc.

This mostly works. I do need to tweak the left minipage a little to get the logo positioned closer to the left margin, but apart from that it seems to work OK (so far).

What I'm wondering is whether this is the best way to structure this title and logo requirement? I thought about using other possible techniques, such as a frame box etc, but reading the manual, there seemed to be other restrictions which might have been a problem.

I've been a LaTeX user for a long time, but up until now, I've just used the default styles. This is the first time I've attempted to modify something like the article title page style in a generic manner which wold work for all my future org documents which need this type of title. I don't necessarily understand exactly how this all works - I got to this point by looking at existing style files and doing a git of googling etc.


texts: How do I keep Mac Emacs from trapping M-`?

texts:
I want to use the command key on my Mac as the meta key, so I customize ns-command-modifier. But I also want to still use ⌘-` to cycle through all the windows in Emacs - just like in all other Mac apps.

If I unbind ⌘-`, then I just get an error that there is no binding for that key. I want to somehow tell Emacs not to trap that key at all.

There must be a solution because ⌘-TAB works whether or not the ⌘ key is set to be meta. But ⌘-` does not.


texts: how to convert camel case to snake case with vanilla emacs

texts:
When editing for example a ruby file,
can't emacs toggle CamelCase to snake_case out of the box?

Example ruby file

  def SecDecGov
    puts "abort"
  end


texts: How to transpose words, keeping the cursor at the same relative location to the word it moves?

texts: When transposing words, the cursor moves to the end of the word, how can the cursor be kept at the same location relative to the word?


texts: How to quote symbols in a documentation string?

texts:
In the Emacs Lisp documentation, I often come across quoted symbols like `buffer-file-name' inside docstrings. The intersting thing here is the style of quoting, by surrounding the symbol name with a backtick and a quote. I was curious where this style came from. According to this answer it could be related to a limited character set.

Another thing to notice is that these quoted symbols have syntax highlighting in emacs-lisp-mode, whereas symbols quoted with only single quotes, for example, 'buffer-file-name', does not get any syntax highlighting.

So this indicates that the backtick-quote syntax has to be a well-known convention in Emacs. But after googling the documentation, I could not find it mentioned anywhere.
In the Emacs Lisp manual there is a section named "Tips for Documentation Strings"; it says

  When a documentation string refers to a Lisp symbol, write it as it
  would be printed (which usually means in lower case), with
  single-quotes around it.

but it does not mention the style of quoting.

Type C-h f thing-at-point RET and then click the link to the source code to see some more examples of the quoting style:

  (defun thing-at-point (thing &optional no-properties)   "Return the
  THING at point. THING should be a symbol specifying a type of
  syntactic entity. Possibilities include `symbol', `list', `sexp',
  `defun', `filename', `url', `email', `word', `sentence', `whitespace',
  `line', `number', and `page'.

  When the optional argument NO-PROPERTIES is non-nil, strip text
  properties from the return value.

  See the file `thingatpt.el' for documentation on how to define a
  symbol as a valid THING."

So all this gives an indication that one should use the backtick-quote style to quote symbols, but is this style documented anywhere?


texts: Is it possible to use rgrep with compact output?

texts:
I am using following code from the elpy’s readthedocs.
(defun elpy-goto-definition-or-rgrep ()
  "Go to the definition of the symbol at point, if found. Otherwise, run `elpy-rgrep-symbol'."
    (interactive)
    (ring-insert find-tag-marker-ring (point-marker))
    (condition-case nil (elpy-goto-definition)
        (error (elpy-rgrep-symbol
                   (concat "\\(def\\|class\\)\s" (thing-at-point 'symbol) "(")))))

Which opens half window with following example output:

For the output is it possible to suppress the first 4 lines and last 2 lines, where I just want obtain the result which is: ./python_scripts/add_data.py^@7:def add_to_ipfs(results_folder):


texts: Changing HTML Table Formatting When Exporting from R

texts:
I am generating several tables in R and then exporting them to HTML(5). For instance:

#+BEGIN_SRC R :session *R-org* :results output raw :exports results
  df <- data.frame(x=0.110, y=0.132)
  rownames(df) <- "Rates"
  print(ascii(df, header=TRUE, colnames=colnames(df), rownames=rownames(df),
              digits=3, caption="Rates"),
        type="org")
#+END_SRC

This seems to work well enough, but it creates very ugly tables. How do I assign HTML attributes (as shown with the #+ATTR_HTML line in org manual) from the R block?


texts: How can I back up my init file with Git?

texts:
The docs say to keep the .emacs file in the HOME directory.

I'd like to share the file between multiple computers using a git repo. What is the best way to structure the repo without including everything else that's in HOME.

Do I have to turn HOME itself into a repo and include everything else in the directory in the .gitignore?


texts: Storing some text from a buffer into a variable

texts:
What is the "standard" way to store some text obtained from a buffer into a variable?
The only way I could think of was to use something along the lines of (let ((beg (point))) (end-of-line) (copy-region-as-kill beg (point))) and then store it with something like (setq var1 (car kill-ring)).
That feels somehow "hacky" and I was wondering if there is another function to do this, that I overlooked?


texts:
I know I can create a .clang-format file, and use this per project, but what I'd really like is a way to set the default clang-format style to one of the available formats, so I can experiment with various styles across various projects.

I would think something like setting a clang-format-style variable to "llvm" or "mozilla".   Is soemthing like this possible?

Alternatively, can I do a key binding that calls clang-format-region specifying the formatting style?


texts: Can Occur center the found text in the buffer?

texts: When selecting an item from the occur buffer, the highlighted line is at the very bottom of the visible screen. This is less useful than having it 25-50% of the way down the screen(so it's easy to read the text around the found line). Is this possible?


texts: Polymode changes from ESS-mode to Markdown-mode whenever I press enter

texts:
When I am editing .Rmd file within a polymode chunk, the mode switches from ESS to Markdown mode whenever I press enter.  However, it switches back to ess-mode whenver I save the file.

I will try to demonstrate this:
C-hvmajor-modeEnter

major-mode is a variable defined in ‘C source code’.
Its value is ‘ess-r-mode’
Original value was fundamental-mode
Local in buffer hw5.Rmd[R]; global value is fundamental-mode

x <- runif(100)

I run this command with no problem but then I hit enter

```{r}
x <- runif(100)

```

C-hvmajor-modeEnter

major-mode is a variable defined in ‘C source code’.
Its value is ‘markdown-mode’
Original value was fundamental-mode
Local in buffer hw5.Rmd; global value is fundamental-mode

Obviously, I have now lost the ess functionality until I save the file.

C-xC-s

Now it is back to ess-mode.
C-hvmajor-modeEnter

major-mode is a variable defined in ‘C source code’.
Its value is ‘ess-r-mode’
Original value was fundamental-mode
Local in buffer hw5.Rmd[R]; global value is fundamental-mode


texts:
I am a beginner of helm-mode.

Why remapping of arrow keys ((kbd "<left>"), (kbd "right"), ...) on helm-map doesn't work while others work fine?

Here are the entire settings:

(require 'helm-config)
(helm-mode 1)
(define-key global-map (kbd "C-;") 'helm-mini)
(define-key global-map (kbd "M-y") 'helm-show-kill-ring)
(define-key global-map (kbd "C-x C-r") 'helm-recentf)
(define-key global-map [remap find-file] 'helm-find-files) ;
(define-key global-map [remap execute-extended-command] 'helm-M-x)
(define-key helm-map (kbd "C-h") 'delete-backward-char)
(define-key helm-find-files-map (kbd "<left>") 'backward-char)
(define-key helm-find-files-map (kbd "<right>") 'forward-char)

;; no effects and default key bind works for following two lines
(define-key helm-map (kbd "<left>") 'backward-char)
(define-key helm-map (kbd "<right>") 'forward-char)

Thank you.


texts:
I'm using doom+magit to deal with git, and I have smerge configured to change in-file conflicts. When I enable the smerge refine mode to highligh changes on a per-word basis, I find that refines works in a bit strange way (I much prefer the way magit refines): if in branch master I change a letter A into B, this letter will be highlighted in both paragraphs, like (*...* being the highlight):
<<< HEAD
I corrected a *b*ig typo.
====
I corrected a *a*ig typo.
>>>

Is it possible to highlight it only in the paragraph that made the change, i.e. here on master?
<<< HEAD
I corrected a *b*ig typo.
====
I corrected a aig typo.
>>>

I find it easier to understand who made which change, and which version I should keep.


texts:
I am using emacs-mac-port 24.4 on OSX 10.10. My company-mode drop-down menu is ugly. The unicode symbols in it are not the same width, which results in a ragged menu. The left image is with Monaco, the right one is with DejaVu Sans Mono.

Is there a font better than DejaVu Sans Mono in this regard?

Or is it possible to use the system dropdown menu like yasnippet?


texts: How can I avoid EmacsClient to wait under MacOSX when it starts the alternate editor?

texts:
Note: I had asked this question before under https://apple.stackexchange.com/questions/181007/emacsclient-waits-when-alternate-editor-is-used.

I created the following script emc to invoke emacs (if already an emacs instance is running, the arguments should be opened in this instance, otherwise, a new instance should be started; the -n causes emacsclient not to wait):

#!/bin/bash
/Applications/MacPorts/Emacs.app/Contents/MacOS/bin/emacsclient --alternate-editor "/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs" --no-wait  ${1+"$@"}

When already an emacs is running, the script works as expected; if, however, no emacs is running so far, a new one is started and the files are opened, but emacsclient waits until this instance is closed and gives the following output:

computerName:bin user$ emc .
/Applications/MacPorts/Emacs.app/Contents/MacOS/bin/emacsclient:
can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

How can I avoid this waiting?


texts: Unable to mark files in directory listing from `C-x C-d`

texts:
I was just wondering if anyone has noticed the following behaviour after doing C-x C-d.

I use C-x C-d to navigate to a directories and subdirectories with pdfs. Then I try to mark a pdf file with M-x dired-mark, but I get the following message No subdir-alist in *Directory*.
Does anyone know what is going on here? Why do I get this message? What am I doing wrong?


texts: Repeated isearch when rebound to compound key

texts: I don't isearch backwards frequently enough to justify giving it such a valuable keybinding, so I rebound isearch-backward-regexp to C-c r and I noticed that something strange started happening. Normally isearch-backward-regexp will use the previous search string and jump to the previous match if you hit C-r twice, but the search string in the minibuffer always cleared when you rebind isearch-backward-regexp to a compound keybinding.


texts: gdb-many-windows causes hangs in emacs 24.5

texts:
When running gdb -i=miand then attach to the process for debugging, emacs hangs for like 5 minutes before I can type anything. After trial and error I found it is caused by the following line in my init.el file:

(setq gdb-many-windows t)

Start software to debug->Get Process ID->Start Emacs->Start gdb inside Emacs (with many-window)->Attach to Process->Set break point->Continue->Do things in software GUI to trigger breakpoint->Emacs show break point hit and hangs for 5 minutes

The configuration was never changed, and I only start experiencing this problem recently. So is gdb-many-windows really affecting the performance so bad or if there is some thing else possibly, like the version of emacs or debugger?

GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4).
GNU gdb (GDB) 7.10.


texts: How do I get request.el to post the contents into the buffer

texts:
I'm trying to use request.el but have no clue what I'm doing. What I want to do is create a request to Zotero that uses their citation picker using the to get a 'Cite As You Write' capability using the Better Bibtex For Zotero backend.

I have gotten this working with a do-applescript function, but it sporadically just stops working, and I get the error Emacs is not allows to send keystrokes. I have gone and reset the security preferences numerous times, and ensured the the Info.plist has the proper permissions, but I still get this error sporadically.

Can anyone guide me through the process of what I need to do? The relevant url to call is "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?format=pandoc' 2>/dev/null; exit 0". I have tested it in the scratch buffer and got the popup citation picker once (see picture). However, when I selected the references it changed focus to the Zotero apps search box, and that's as far as I got.

Subsequent requests have failed, and I get the following error:

Debugger entered--Lisp error: (void-function request)
  (request "http://localhost:23119/better-bibtex/cayw?format=pandoc 2>/dev/null; exit 0")
  eval((request "http://localhost:23119/better-bibtex/cayw?format=pandoc 2>/dev/null; exit 0") nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  #<subr call-interactively>(eval-last-sexp nil nil)
  apply(#<subr call-interactively> eval-last-sexp (nil nil))
  (let ((ido-cr+-current-command command)) (apply orig-fun command args))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> eval-last-sexp nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (eval-last-sexp nil nil))
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

I'm sorry, but this is coming across as very much a "can you do this for me" as I don't have a clue what I'm doing.

So I got it working again thanks to @lawlist, and the message I get is:

(fn &rest ARGS2)"] :url "http://localhost:23119/better-bibtex/cayw?format=pandoc 2>/dev/null; exit 0" :response #0 :encoding utf-8) #<buffer  *request curl*> nil nil ...)

Any idea how to get this working?


texts: I know about :step day, which generates an entire table per day. What I would like to get is a single table with daily clocked times, one day per row. How would I do that?


texts: Prevent coloring of org code block during html export

texts:
How can I tell emacs/org to not syntax color the outputted html when I'm exporting using org publish project feature. Alt-: Eval: (org-publish "blogproject1")

#+BEGIN_SRC sh :exports both
# bash comment
pwd
#+END_SRC

#+RESULTS:
: /tmp

What I tried (in my init el )

(setq org-src-fontify-natively nil)

In this case my motivation is: the coloring isn't compatible with a dark web theme.


texts:
In Emacs 24.5.50.1, dismissing the calendar window with calendar-exit works fine when there is a single window. However, when the window is split, the calendar buffer disappears, but the window remains.

This is reproducible with emacs -Q:

Should this be considered a bug and reported?


texts: How to implement comments outline in ESS similar to that of Rstudio?

texts:
Shifting from Rstudio to ESS took some time with me because of the steep learning curve of a versatile Emacs editor, but is was a worthwhile experience. What I am still missing in ESS is that outline or overview of the R script file based on comments (called sections in Rstudio) by pressing Ctrl+Shift+R to give # some comments or title here (see the screenshot).

After having a lot of sections and the file size becomes very large, it becomes increasingly difficult to navigate throughout a giant multi-section file. In Rstudio I press that orange button # to pop up a small window of all sections or # comments and by clicking any one of them will put me on that heading in the file.

Similar thing I found in AUCTeX is the C-c = which will show an outline clickable table to navigate that .tex file.

How to obtain this handy overview in ESS?


texts: In Spacemacs, how to customize keybindings that are condition on language file?

texts:
Here is what I would like to do. I would like to customize key bindings that point to a different command depending on the file type on which the user is operating.

For instance, if one presses f5 in a Python file .py, I would like f5 to call the equivalent of C-c C-c:

(define-key key-translation-map [f5] (kbd "C-c C-c"))

But if one presses f5 in a R file .R, I would like f5 to call the equivalent of C-c C-b:

(define-key key-translation-map [f5] (kbd "C-c C-b"))

In the user-config function defined in .spacemacs, I tried doing the following:

(with-eval-after-load 'python
  (define-key key-translation-map [f5] (kbd "C-c C-c"))
)
(with-eval-after-load 'ess
  (define-key key-translation-map [f5] (kbd "C-c C-b"))
)

But it does not work properly. The last binding is the one that sticks, then f5becomes bounded to C-c C-b despite the file type.

I also tried putting each key binding above in the individual config.el files that exist in the .emacs.d/layers/+lang/python and .emacs.d/layers/+lang/ess folders. In this case, the opposite happens: only the binding associated to the first file type of the first file loaded is the one that sticks. The keybinding does not change according to in which file the user is.

So, what would be the appropriate way to implement what I want?


texts: How to determine which variable controls indentation offset for any given mode

texts:
Each major mode seems to (quite unfortunately) have its own naming conventions for the special variable used to control indentation level.  For example, c-mode has c-basic-offset, python-mode has python-indent-offset, perl-mode has cperl-indent-level.

How can I determine which variable I should set for any given mode?


texts: improve AUCTeX macros like `\frac` and `\stackrel`

texts:
While using AUCTeX, the macro \frac is quite intelligent that when I just type C-c C-m frac RET, it will put the cursor in the first pair of braces, as

\frac{(cursor here)}{}

However, when I have selected some text and do the same, it will put the cursor at the end like

\frac{some text}{}(cursor here)

instead of putting the cursor in the second pair of braces as follows

\frac{some text}{(cursor here)}

The same thing happens to \stackrel{}{}. Is there a way to achieve this? Many thanks!

BTW

I later find out that putting the following code in the .emacs file helps

(add-hook 'LaTeX-mode-hook
  '(lambda ()
     (TeX-add-symbols
               '("frac" "Numerator" "Denominator"))))

but this does involve more interaction with the minibuffer, which seems to be an overkill for frac{}{} or \stackrel{}{}. Besides Greek letter would not work in the minibuffer, and this turns out to have been a problem since 1995.


texts: Don't open a HTML link if drag-and-dropped to Emacs

texts:
I keep my notes in Markdown. Often I would like to collect various links by drag-and-dropping them from the browser.

However, Emacs opens them instead. I know that this is probably what most people want, but is there any way to disable this, so Emacs will not open a link but just insert it as a text


texts: Typing two quote characters in a LaTeX document?

texts:
I'm working with a LaTeX document.  I want to type "" since I need this for german.sty in LaTeX.  Starting some time ago, Emacs thinks this is not a good idea.  I do not agree.

Right now I have to write " SPC " and then manually remove the blank space in between the quotation marks.

How can I type two quotation marks in a row?


texts: Error encountered when adding melpa to package-archives

texts:
I'm using emacs 25.2.1 (built from source). A strange problem happened after I tried to configure it for editing tex files.

The suspicious config file content is listed below.

(require 'package)

(add-to-list 'package-archives
         '("melpa" . "https://melpa.org/packages/") t)

(package-initialize)

(provide 'init-melpa)

Then I load it in init.el with (require 'init-melpa)

I'm using that since emacs 24.5 and it was working before I installed auctex, company-auctex... Now I've uninstalled those new packages but I am still having the following error (error dumped using --debug-init).

Debugger entered--Lisp error: (wrong-type-argument listp [(20111019 1600) nil "implementation of a hash table whose key-value pairs expire" single ((:commit . "7499586b6c8224df9f5c5bc4dec96b008258d580"))])

  package--add-to-archive-contents([(20111019 1600) nil "implementation of a hash table whose key-value pairs expire" single ((:commit . "7499586b6c8224df9f5c5bc4dec96b008258d580"))] "melpa")

  package-read-archive-contents("melpa")

  package-read-all-archive-contents()

  package-initialize()

  eval-buffer(#<buffer  *load*-196816> nil "/home/max/.emacs.d/init/init-melpa.el" nil t)  ; Reading at buffer position 297
  load-with-code-conversion("/home/max/.emacs.d/init/init-melpa.el" "/home/max/.emacs.d/init/init-melpa.el" nil t)

  #<subr require>(init-melpa nil nil)

  ad-Advice-require(#<subr require> init-melpa)

  apply(ad-Advice-require #<subr require> init-melpa)

  require(init-melpa)

  eval-buffer(#<buffer  *load*> nil "/home/max/.emacs.d/init.el" nil t)  ; Reading at buffer position 2536
  load-with-code-conversion("/home/max/.emacs.d/init.el" "/home/max/.emacs.d/init.el" t t)

  load("/home/max/.emacs.d/init" t t)

  #[0 "\205\266

It looks like the package-archives is damaged as I tried to add melpa though:

(custom-set-variabales
  '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))))

However I still have same errors.

Please help! Any advice is appreciated!

Desperate,

Max


texts:
Is there a way to emulate Vim's folding of .vimrc from Emacs?

In other words, I believe most folding and hiding packages in Emacs rely on open and closing expressions. I am not sure of the internals of these, as I have not tried to learn this much Lisp as of yet.

In Vim, folding seems to be calculated line-by-line, so the writing a function can be based on manipulating the previous fold level, as well as an absolute value.

So in a .vimrc file, we can have both

" level 1 {{{
some code
" level 2 {{{
some code
" end of section }}}
" end of section }}}
" level 1 {{{
some code
" end of section }}}

(with pairs {{{ and }}}) or

" level 1 {{{1
some code
" level 2 {{{2
some code
" level 1 {{{1

(with {{{n) as well as mixes of these; some recommend to use the absolute values for sectioning, and the relative folding for functions.

So open and closing expressions seem to correspond with declaring relative fold levels. Is there an existing way to declare absolute fold levels in Emacs? Or can anyone point me in the right direction so I can know where to head when I tackle this on a hobby day?

(Line by line function of buffer? Overlays? What is the underlying function for folding?)


texts:
I think I have a reasonable handle on agenda custom sorting, but I can't figure out how habits sort themselves within that agendas.

For a certain agenda view I sort as '(time-up habit-down todo-state-down priority-down) which largely does exactly what I want and expect.  The daily schedule is at the top and the due habits without scheduled/deadline hours are at the bottom.  Within habits anything overdue (red in default graph) is first, then anything due today (yellow in default graph), then anything available but not due today (green in default graph).  Great!

But today for example I see two tasks due today, one at C priority and one at A priority.  Why is the C priority listed first?

In the non-habit tasks 'priority-down puts A above B above C but in habits it looks reversed.

EDIT: Looking further into this only has me more confused. I can't see. any explanation for this ordering:
What I notice here that differs from the normal sorting rule mentioned above is:

In items due today an unprioritized item (#E in my config) is above an A priority item
The 'available' habits are not sorted by priority at all - CBCCB
They aren't alphabetical either: basement is before upstairs, but vacuum is before practice.
They aren't sorted by category; House is split two at the top and one at the bottom.


texts: assign priorities to todo items based on position in directory

texts:
I'm very new to extending Emacs.  I just started using org-agenda and I'm loving it so far.  My approach to todos is probably more granular than most: I have my major goals as separate org files and separate directories, which I call paths, e.g.
paths
├── master_path.org
├── get_fit
│   └── get_fit_path.org
├── get_healthy
│   └── get_healthy_path.org
├── get_productive
│   ├── deep-work.pdf
│   ├── get_productive_path.org
│   ├── get_productive_path.org~
│   └── Getting-Things-Done-book.pdf
├── learn_emacs
│   ├── eintr.pdf
│   ├── emacs_guide_1.pdf
│   ├── emacs_guide_2.pdf
│   ├── #learn_emacs_path.org#
│   ├── learn_emacs_path.org
│   └── Writing GNU Emacs Extensions - Bob Glickstein.pdf
├── learn_IT
│   ├── clean_architecture.pdf
│   ├── data_structures_and_algs_python.pdf
│   ├── learn_computer_networks
│   │   └── #learn_computer_networks.org#
│   ├── learn_databases
│   ├── learn_data_structures_and_algorithms
│   │   └── notes
│   │       ├── linked-lists.org
│   │       └── linked-lists.org~
│   ├── learn_IT_business_analysis
│   ├── learn_IT_path.org
│   ├── learn_IT_path.org~
│   ├── learn_programming_languages
│   │   └── learn_python
│   │       └── notes
│   │           └── how_python_works.org
│   ├── learn_software_engineering
│   ├── learn_software_testing
│   │   ├── laboon.pdf
│   │   └── #learn_software_testing_path.org#
│   ├── learn_version_control
│   └── notes

The org files labeled _path.org may contain the name of a subfolder that contains futher org files containing todo items.
For example:
learn_IT_path.org
* TODO learn programming languages [#A]
* TODO learn databases

Requirement 1
Now, because there is a folder called "learn_programming_languages" at the same level as learn_IT_path.org, this means any todos therein should automatically be assigned [#A] priority.  How can I do this?
Requirement 2
If a nested org file that inherits a priority status from its parent is given a priority status within that file, the statuses are combined into a string, e.g.
# learn_programming_languages_path.org
* TODO learn python [#A]
* TODO learn APL [#C]

i.e. learn Python would end up with a priority [#AA], while learn APL gets [#AC]
If I assigned [#A] to learn_IT in master_path.org, then, learn Python would get [#AAA]
The order of todo items in org-agenda would be displayed accordingly.
Would this functionality be hard to do for someone new to extending emacs?


texts: If I have a bunch of headings with sub-headings and content, how can I programmatically indent them correctly? I've tried combining bunch of elisp functions with mapping api, still can't figure it out.


texts: Export only headlines of a certain level

texts:
This one is pretty straightforward. I'm translating in emacs org-mode, and my workflow looks a bit like this:

* Source text sentence

** Translation of source text sentence

* Another source text sentence

** The translation of that other sentence

What I'd like to do is take all (and only) second level headlines (which are my translations) and copy them into a separate document. Is this possible, or am I thinking too outside the box?

Thanks!


texts: How to expand external files inline on orgmode?

texts:
I know I can use something like #+INCLUDE: "./filepath" but this has effect only when I export the file. I can also use link like [[./filepath]] but I have to type C-c C-o to go to the content.

How to automatically expand this include or this link to the current file? It is useful to use C-s (ISearch) and other practical things like edit the external content inline without change buffer or window.

Thank you.

EDIT: I know I can type C-x i to insert a content of any file inside my current org file, but it isn't what I really want. I want a two-way direct link between my current org file and external files. If I modify the external file, my current org file is automatically updated. And vice-versa.

My current application is: I have a file called mapmind.org where I have my map mind. I use the tool org-mind-map to export this into a beautiful diagram. Unfortunately this tool doesn't allow to export only a region, so this should be in a single separated file. And I have my main org file, called main.org. I have several items and one of them is:

* Map mind
See [[./mapmind.org]].
#+INCLUDE mapmind.org

When I export the entire file into a PDF, for example, I can see my mapmind there. If I put the cursor above the link, I can navigate using C-c C-o, or I can go to file using C-c ' above include line as John Kitchin said as commentary. But this is very unpractical because search commands like C-s, C-r and so on does't find anything in mapmind.org file. Also, I'd like to see and edit the content directly in my main org file without the need to navigate elsewhere.

This feature could be useful for many other applications.


texts:
There are (in my mind) two types of word wrapping:

Hard : Actually edit the file to have lines of a maximum length
Soft : Just wrap in the editor, but the underlying file still has long lines.

I can't figure out how to make Emacs do these two different types of word wrapping (most people just talk about "word wrap", without distinguishing which they are talking about).


texts: Highlight syntax of function names and their arguments in custom mode

texts:
I'm trying to create a major mode that handles the following syntax:

  function someName(value1, value2)
    # some contents
  end function

I'm using the following to highlight the keywords function, and end function.

(define-derived-mode my-mode prog-mode "My Mode"
  "Major mode for editing my mode code."
  (setq-local font-lock-defaults
              '(my-mode-font-lock))

How can I target the function name (someName) and its arguments with font lock (value1, value2)?


texts: How to disable Spacemacs from auto-balancing the split windows?

texts:
I am using Spacemacs and after using the splitting windows feature, either by splitting horizontally or vertically, Spacemacs always try to balance the split windows.

For example, when pressing C-x 3 twice, I expect something like this:

++++++++++++++++
|      |   |   |
|      |   |   |
++++++++++++++++

But Spacemacs always produces this:

++++++++++++++++
|    |    |    |
|    |    |    |
++++++++++++++++

Do you know how to disable Spacemacs from doing so?

Thank you very much!


texts: dired: is file under point local or remote?

texts:
In a dired buffer, how can I determine whether the file under the point, i.e. (dired-get-file-for-visit), is local or remote?  Is there something like (dired-local-file-p) or maybe (tramp-local-file-p file)?

I would like to call different functions for visiting local and remote files.


texts: How to make org-babel call all remote code blocks under a specific headline?

texts:
For example, I have following org file:

***** user level

****** copy system service file

At first copy system's systemd service file to systemd user level. by check it
out, and tangle it to target file.

#+begin_src shell :results code :wrap "src systemd :tangle ~/.config/systemd/user/transmission.service" :cache no
systemctl cat transmission.service
#+end_src

#+RESULTS[<2018-03-01 16:25:30> 6f8f1e5900c5be8ab0fa4ee35ff6682e6bc752f0]:
#+begin_src systemd :tangle ~/.config/systemd/user/transmission.service
# /usr/lib/systemd/system/transmission.service
[Unit]
Description=Transmission BitTorrent Daemon
After=network.target

[Service]
User=transmission
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
ExecReload=/bin/kill -s HUP $MAINPID

[Install]
WantedBy=multi-user.target
#+end_src

Then modify daemon run options:

****** specify daemon config file

#+begin_src shell :results code :wrap src systemd :cache no
gawk -i inplace '/ExecStart/ { gsub(/transmission-daemon/, "transmission-daemon -g ~/.config/transmission") }; { print }' ~/.config/systemd/user/transmission.service
cat ~/.config/systemd/user/transmission.service
#+end_src

#+RESULTS[<2018-03-01 16:31:51> 1b2d0ea649dc85ddc6e96d232d0c969888745a03]:
#+begin_src systemd
# /usr/lib/systemd/system/transmission.service
[Unit]
Description=Transmission BitTorrent Daemon
After=network.target

[Service]
User=transmission
Type=notify
ExecStart=/usr/bin/transmission-daemon -g ~/.config/transmission -f --log-error
ExecReload=/bin/kill -s HUP $MAINPID

[Install]
WantedBy=multi-user.target
#+end_src

I want to call all those src blocks under specific headline user level.
Org-mode has a remote code block call syntax like this:

#+call: si.org:figure-1()

But it need to specify one src block. When I have many blocks under headline, I
don't want to remote call one by one manually.

So is there a way to do it?


texts: My company package can't auto-complete the keywords of C/C++

texts:
When I type the first few letters of some C/C++ keywords, company does't respond until I execute company-keywords.

How could I make company auto complete C/C++ keywords while I type?


texts: Where Is The .emacs file in Windows 8.1?

texts: Hi all so last night I started using Emacs and I enjoyed it. Now I am looking to customize the look to the solarized port of Emacs. Now question is where is the .emacs file in windows 8.1?  I have heard many answers to this question, I put my Emacs in C:\Emacs.  So any ideas?


texts: Set ESS working directory from header-args with org-babel sessions

texts:
I am experiencing a very strange behavior with org-babel code blocks. When I operate without the :session tag, I am free to use :dir to set my working directory. As you can see, the following code runs as expected:

but if I now add a :session argument, babel ignores my :dir tag and instead returns my default working directory:

What am I doing wrong?


texts: How can I make emacs interpret tilde ~ as a literal tilde (never to modify letters like Ã, Ñ)

texts:
I want to always have tilde insert a literal tilde (~). How can I ensure this in emacs?
This also happens when I start emacs with -q or -Q!
Version info:
GNU Emacs 27.1
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.


texts: How to use dynamic-library-alist to load my own DLL?

texts:
I found Emacs has a dynamic-library-alist. But there's no instruction about how to use the libraries after it is been loaded...any idea?

What I want to acheive is to load a DLL on my Windows system and call the exposed function.


texts: How can I get the tags for a headline in a clock report formula?

texts:
I'd like to understand how to retrieve the tags for a headline that is being processed by a clock mode report formula. Suppose I have a clock report table defined like this.

#+BEGIN: clocktable :maxlevel 2 :scope nil :formula "$3='(headline-get-tags $1)::@2$3=string(\"Tags\")"
#+END:

I can define a simple formula that returns the length of the headline, but I have yet to find an easy way to find the tags associated with the headline.

(defun headline-get-tags (headline)
  "Return the tags for a headline"
  (length headline))

Is there a simple way to get the tags with a headline?


texts:
I cannot unbind the key M-l in org-mode.

When the cursor is in an org-mode buffer, I tried to eval (M-:)

(unbind-key "M-l" org-mode-map)
;; ^^^ from bind-key.el

(define-key org-mode-map (kbd "M-l") nil)

But C-h k M-l always says:

M-l runs the command org-demote-subtree (found in org-mode-map), which
is an interactive compiled Lisp function in ‘org.el’.

It is bound to M-l, C-c C->, <normal-state> M-l.

Same problem for other keys, e.g. C-k. I also use bind-key.el for other bindings, in case that is of interest.


texts: How to load self package with use-package?

texts:
I use Prelude, and I want to use use-package for loading and configuring my personal config files.

In ~/.emacs.d/personal/load-private-config.el, my code is below: (like https://github.com/jwiegley/dot-emacs/blob/master/init.el#L99)

(defconst zwb-private-emacs-config-path "~/.emacs.d-private/")

(eval-and-compile
  (mapc
   #'(lambda (path)
       (push (expand-file-name path zwb-private-emacs-config-path) load-path))
   '("lib""theme" "")))

(eval-and-compile
  (defvar use-package-verbose t)
  (require 'cl)
  (require 'use-package))

(use-package zwb :load-path (lambda () (expand-file-name (concat zwb-private-emacs-config-path "lib/zwb"))))

In ~/.emacs.d-private/lib/zwb/zwb.el

(message "test-zwb")
(provide 'zwb)

restart emacs, in *Message* buffer, I cann't see test-zwb

I add (message load-path) at the end of load-private-config.el, restart emacs got:

  Warning (initialization): An error occurred while loading
  `/Users/zwb/.emacs.d/init.elc':

  Wrong type argument: stringp, (/Users/zwb/.emacs.d-private/lib/zwb
  /Users/zwb/.emacs.d-private /Users/zwb/.emacs.d-private/theme
  /Users/zwb/.emacs.d-private/lib
  ~/.emacs.d/themes/color-theme-ahei-20141223.221

It seems the lib/zwb is in the load-path, so I don't how:

Why I cann't get test-zwb in *Message* buffer?
Has zwb.el been already loaded? If not, how to load it?
How to print load-path (use message method seems has some problem)?

My OS version: Mac OS X 10.11.2 beta4
My Emacs version: 24.5.1 (brew emacs-mac-emacs)


texts: Is it possible to lazy-load language mode packages?

texts:
Most of the packages I currently use are major modes for various languages that are only included in the off-chance I load a file of that type.

Is there a way to postpone loading them at startup in my init file - until a filename with a particular file extension is loaded?

Note that I'm not familiar with exactly how emacs packages are already supposed to be using auto-load, but emacs without many packages starts nearly instantly, and with them - takes ~2seconds. I've profiled the startup and while some package a clearly worse offenders than others - this isn't one single package at fault. So I was interested to lazy load where possible.


texts:
I have installed GNU Go 3.8 and am trying to use it in emacs. I have downloaded gnugo.el from here and have copied gnugo-big-xmps.el from my gnugo-3.8/interface directory, putting both in my .emacs.d. I have the following two lines in my init.el:

(autoload 'gnugo "gnugo" "GNU GO" t)
(autoload 'gnugo-xpms "gnugo-big-xpms" "GNU GO" t)

I can use M-x gnugo, and am prompted for GNU Go options:, but when I press RET, I get the error Searching for program: no such file or directory, gnugo. I don't think that this is a problem with my installation of GNU Go, since it works fine from the command line. Can anyone help?

I am using Emacs 24.5.1 on OS X El Capitan, 10.11.3.


texts: I would like to persist my compile-ring, by which I mean the history of compile commands I use, between emacs sessions.  Is there a simple way to accomplish this?


texts: Include original position from searched buffer in occur buffer

texts:
As an example, let's say I want to search for the word test.
When I type M-x occur RET test RET, the current frame is split into two windows, with the current buffer on top and the *Occur* buffer on bottom. If I click a line in the *Occur* buffer point is moved to the matching line in the top buffer. All this is fine..

But if I want to return to the original position in the top buffer, it is more difficult. First, there is no shortcut in the *Occur* buffer to return to that original position in the searched buffer. I could of course as a workaround type C-x r b before I clicked the line in the *Occur* buffer such that I got a bookmark. But I think this is not an ideal solution.

So the question is: Is it possible to add the original buffer position in the searched buffer as a single line in the *Occur* buffer (for example, the topmost line) such that I can easily return to my starting point after visiting (that is: moving to) some matches from the *Occur* buffer?


texts: Can org-mode radio targets show their definition when hovering over them with the mouse?

texts:
Org-modes radio targets are useful for automatically adding definitions to terms used in a text. You can define a term within triple angled brackets, like in this definition line:

<<<my term>>> my definition of 'my term'

and all occurrences of the term "my term" in the text will be converted to hyperlinks that links to their definition line. For instance if the term was"Emacs", the definition line could look like this:

<<<Emacs>>> a useful text editor

But clicking such radio targeted links in a text will move you to its definition line, somewhere else in the text. After reading the definition you have to orient  yourself back to the place in the text where you clicked the link, to continue your reading. This is impractical. I have two questions:

1) is there a back jump function that let m find back to the clicked link?

2) is it possible to make emacs show the definition of the linked term, as a pop-up window, when hovering the mouse over the link?


texts: how do I install emacs packages from the command line?

texts:
I'm attempting to automate deployment of my different machines by scripting installation of emacs and emacs packages. While I realize that I can set up my .emacs file to automatically install packages if they're not found, I'd rather have these packages pre-installed.

I'm executing elisp from the command line like this:

/usr/local/bin/emacs --batch --eval "(progn (package-initialize) (package-refresh-contents) (mapc 'package-install '(powerline airline-themes doom-themes sr-speedbar)))"

If all of the packages are currently installed, it works fine:

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Package refresh done
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
‘powerline’ is already installed
‘airline-themes’ is already installed
‘doom-themes’ is already installed
‘sr-speedbar’ is already installed

But, if one of the packages is not installed, it can't install the package and ends up saying it can't find a version of the package with a - appended to it (i.e. sr-speedbar becomes sr-speedbar-):

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Package refresh done
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
‘powerline’ is already installed
‘airline-themes’ is already installed
‘doom-themes’ is already installed
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
Package ‘sr-speedbar-’ is unavailable

When I paste the code into an Emacs minibuffer with M-:, it executes just fine.

How can I properly install a package from MELPA (or other repository) from the command line without an interactive session?


texts:
Upon working in org doc with source code, I want to do unittest whithin

#+BEGIN_SRC python :session my :export none :results output
  import unittest

  def square(n):
      return n ** 2

  class MyCase(unittest.TestCase):
      def test_a(self):
          check = square(3)
          self.assertEqual(check, 9)

  unittest.main()

#+END_SRC

It reported errors

Debugger entered--Lisp error: (error "Process my not running")
  process-send-string(#<process my> "\n")
  comint-send-string(#<process my> "\n")
  comint-simple-send(#<process my> "")
  comint-send-input(nil t)
  #f(compiled-function () #<bytecode 0x1913625>)()
  #f(compiled-function (send-wait body) #<bytecode 0x1913675>)(#f(compiled-function () #<bytecode 0x1913625>) "__org_babel_python_fname = '/tmp/babel-B1lTSa/python-ZsirER'; __org_babel_python_fh = open(__org_babel_python_fname); exec(compile(__org_babel_python_fh.read(), __org_babel_python_fname, 'exec')); __org_babel_python_fh.close()")
  org-babel-python-evaluate-session("*my*" "import unittest\n\ndef square(n):\n    return n ** 2\n\nclass MyCase(unittest.TestCase):\n    def test_a(self):\n        check = square(3)\n        self.assertEqual(check, 9)\n\nunittest.main()        \n" output ("replace" "output"))
  org-babel-python-evaluate("*my*" "import unittest\n\ndef square(n):\n    return n ** 2\n\nclass MyCase(unittest.TestCase):\n    def test_a(self):\n        check = square(3)\n        self.assertEqual(check, 9)\n\nunittest.main()        \n" output ("replace" "output") nil)
  org-babel-execute:python("import unittest\n\ndef square(n):\n    return n ** 2\n\nclass MyCase(unittest.TestCase):\n    def test_a(self):\n        check = square(3)\n        self.assertEqual(check, 9)\n\nunittest.main()        \n" ((:colname-names) (:rowname-names) (:result-params "replace" "output") (:result-type . output) (:results . "replace output") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:session . "my") (:export . "none")))
  org-babel-execute-src-block(nil ("python" "import unittest\n\ndef square(n):\n    return n ** 2\n\nclass MyCase(unittest.TestCase):\n    def test_a(self):\n        check = square(3)\n        self.assertEqual(check, 9)\n\nunittest.main()        \n" ((:colname-names) (:rowname-names) (:result-params "output" "replace") (:result-type . output) (:results . "output replace") (:exports . "code") (:export . "none") (:session . "my") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no")) "" nil 17321 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)

What's the problem?

The problem was solved by setting 'exit= False'

#+BEGIN_SRC python :session test  :export none :results output
  import unittest

  def square(n):
      return n ** 2

  class MyCase(unittest.TestCase):
      def test_a(self):
          check = square(3)
          self.assertEqual(check, 9)

  unittest.main(exit=False)
#+END_SRC

#+RESULTS:
: .
: ----------------------------------------------------------------------
: Ran 1 test in 0.000s
:
: OK


texts: Is there a way to change the color of org-priority face once the item is marked as DONE? Currently, the entire line aside from the item's priority gets grayed out once the item is marked as DONE.


texts:
I was reading through the projectile source file and they do the following:

(defvar projectile-command-map
  (let ((map (make-sparse-keymap)))
    ; define-keys
    map)
  "Keymap for Projectile commands after `projectile-keymap-prefix'.")
(fset 'projectile-command-map projectile-command-map)

Why do they do this?  Is it for backwards compatibility?


texts: org-mode: Scheduling item that lasts longer than one day

texts:
Is it possible to place a list-item scheduled for a period lasting longer than one day? The item should then be displayed in this when I hit C-c a a for agenda-view.

My pathetic workaround consists of placing multiple entries, one for each day, something like this:

* Weekend Workshop
** DATE Day 1 Workshop
SCHEDULED: <2018-08-04 Sa>
** DATE Day 2 Workshop
SCHEDULED: <2018-08-05 Su>


texts: How to find the unicode control string received by emacs for a command?

texts:
I usually ssh into a machine at my university and run emacs on screen.
I want to figure out what unicode strings code for a particular command ?
For example when I changed the preferences in my OSX terminal app and associated the following actions to keyboard buttons then Emacs interpreted them as useful command.

Button  Action  Keystroke
end     \005    CTRL+e
home    \001    CTRL+a
pgdown  \026    CTRL+v
pgup    \033v   ESC v

I want to make more such bindings. For example if I could find out the right action for "Ctrl+_"(Undo) then I could associate that to one of the useless function keys.

So basically how can I find out what "Action" triggers a Keystroke ?


texts: Agenda sort by custom org timestamp property not working

texts:
The comparison function below meant to compare headings using custom CREATED property which store org timestamp. The problem is, it doesn't work - the sorting fallback to next sorting strategy which is alpha-up.
(defun jarfar/org-agenda-cmp-user-defined-created-date (a b)
  "Org Agenda user function to sort tasks based on CREATED property."
  (let* (
          (marker-a (get-text-property 0 'org-marker a))
          (marker-b (get-text-property 0 'org-marker b))
          (time-a (if marker-a (org-entry-get marker-a "CREATED") nil))
          (time-b (if marker-b (org-entry-get marker-b "CREATED") nil))
          (time-a (if (jarfar/is-org-timestamp time-a) (org-time-string-to-time time-a) nil))
          (time-b (if (jarfar/is-org-timestamp time-b) (org-time-string-to-time time-b) nil)))

    (if (and time-a time-b)
      (if (org-time< time-a time-b)
        -1
        (if (org-time> time-a time-b) 1 nil))
      (if time-a -1 1)
      )))

(defun jarfar/is-org-timestamp (arg)
  "Returns 't' if 'arg' is org timestamp string, otherwise returns nil."
  (and arg (stringp arg) (string-match org-ts-regexp0 arg)))

Example data file:
* Tasks
** TODO Task 1
:PROPERTIES:
:CREATED: [2020-03-01 Sun]
:END:

** TODO Task 2
:PROPERTIES:
:CREATED: [2020-05-01 Fri]
:END:

** TODO Task 3
:PROPERTIES:
:CREATED: [2020-07-01 Wed]
:END:

** TODO Task 4
:PROPERTIES:
:CREATED: [2020-06-01 Mon]
:END:

Any idea what is wrong with the function?


texts: Magit version post-installation does not look as in the manual

texts:
I have just installed Magit from Melpa as per the instructions in the official Magit manual. I then proceeded to follow the manual's Post-Installation Tasks section, which states

  After installing Magit you should verify that you are indeed using the Magit, Git, and Emacs releases you think you are using. [...]

  M-x magit-version RET

  should display something like

  Magit 2.8.0, Git 2.10.2, Emacs 25.1.1, gnu/linux

The results of my running M-x magit-version RET are

  Magit 20170401.1145, Git (unknown), Emacs 25.1.1, darwin

This doesn't seem to match the expected output.

The Magit version number doesn't have the expected format.
Git does not have a version number at all.

Is this a problem? If so, what should I do to fix it?

Attempted Steps

Is Git installed on my system? Opening a Terminal window and running git --version yields git version 2.10.1. In particular, Git is installed on my system.
Are the Git executables on emacs' PATH? Evaluating (getenv "PATH") in emacs yields a string that starts with /usr/bin. Opening a Terminal window and running ls /usr/bin brings up a list that includes git. So the Git executables are on emacs' PATH.
Are the Git executables on emacs' exec-path? Checking the value of emacs' exec-path variable by entering C-h v exec-path RET in emacs yields a string that starts with "/usr/bin", so the Git executables are on emacs' exec-path.
Maybe the Git executables that the shell uses are in a different place than /usr/bin/. Try running which git from a Terminal window. I ran which git from a Terminal window, and indeed the result was different to /usr/bin/, namely /usr/local/bin/. So I added the following lines of code to my .emacs file:

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin/"))
(setq exec-path (append exec-path '("/usr/local/bin/")))

and restarted Emacs, but the problem remained. So, yes, the Git executables that the shell uses are indeed in a different place, but appending the correct location to the end of PATH/exec-path has no effect.
If appending to PATH/exec-path doesn't do the trick, how about prepending? I added the following lines of code to my .emacs file:

(setenv "PATH" (concat "/usr/local/bin/:" (getenv "PATH")))
(setq exec-path (append '("/usr/local/bin/") exec-path))

and now it works!
An alternative solution: Taking a lead from a comment by npostavs below, I installed Xcode from the Apple store, restarted my computer (not sure this step was necessary; I decided to do this on my own), and ran sudo xcodebuild -license from a Terminal window to accept Xcode's license agreement. Now Magit works even without modifying Emac's PATH and exec-path, and also the Git version is more up-to-date (it was 2.10.1 before; now it's 2.11.0 (Apple Git-81)).

The downside is that Xcode takes a big chunk of memory (4.53 GB), it has received many very bad reviews on the Apple store, I had to sign a license agreement with Apple, and aside from the convenience of not having to modify the Emacs path for Magit to work, I have no use for this mammoth, since I'm not an Apple developer.

Operating system: macOS Sierra, Version 10.12.4
Emacs version: 25.1.1


texts: Minimal working example of Cask project with ert-test?

texts:
I want to use Cask for development, but have trouble getting it set up.

Could anyone please show a minimal example with one package file, one function and one ert-test and which commands you need to 1) run the tests and 2) install the package?

Just something simple like an add function, and a test for 2+2.


texts: get "jump to column" behavior of fundamental mode in a major mode

texts:
I noticed that when in fundamental-mode or prog-mode (basically any mode without an indent-line-function) the TAB key will jump between columns. For example if I have

foo   bar   baz
fot   bat|

with the cursor at the | and I hit TAB it will move my cursor to align with baz.

foo   bar   baz
fot   bat   |

This is really nice when doing something like adding ports to a port list in Verilog. However in verilog-mode (and every other programming major mode I have tested) hitting TAB will just indent the line.

My question is, what is this fundamental-mode mechanism called and how can I add it to another major mode?


texts: How to know whether a function is implemented in C or Elisp?

texts:
I want to switch some behavior in my .emacs based on whether I have the new native fast json-serialize which is implemented in C rather than Elisp.

Is there a simple way to detect whether a function is implemented in C rather than Elisp? I assume there must be because C-h f json-serialize knows it.


texts: Can someone recommend a good text editor for Emacs?

texts: I'm looking for a good way to edit text within Emacs. Can someone give some good recommendations for text-editors for Emacs.


texts:
I wanted something that highlighted a snippet of code that I wanted to keep in mind - NOT marking it, I just want it to pop out visually. As a bonus, I'd like it to get pushed to the mark ring so I can navigate back to it easily. highlight.el and similar packages are annoying though, because if the region is not active, they'll highlight the entire buffer - for what reason, I have no idea but it makes them unusable imo, as I want to be able to tag stuff with a single keystroke. So:

;; highlights line if region not active
(defun highlight-region (beg end)
  (interactive "r")
  (unless  (use-region-p)
    (setq beg (line-beginning-position))
    (setq end (line-end-position)))
  (push-mark beg)
  (set-text-properties
   beg end
   '(font-lock-face (:background "yellow" :foreground "black")
                    highlighted t
                    help-echo "highlighted")))

This works great, along with some related functions I stole from somewhere. But what I'd like is for the full line, from col 1 to col 80, to be highlighted - not just the columns that contains text and none of the overflow at col 81+. I'd need something like

(setq end (point-at-col 80))

does something like this exist?


texts:
I have wrote the following abbrev definition file, and saved it as my_abbrev.el:

(define-abbrev-table 'global-abbrev-table '(
    ("else__" "else begin

end")
    ))

;; turn on abbrev mode globally
(setq-default abbrev-mode t)

I loaded it from my init.el:

(load-file "~/.emacs.d/my_abbrev.el")

However, when typing "else__" followed by a space, it is not expanding. when evaluating the expression list-abbrev, I see the following (as I expected):

(global-abbrev-table)

"else__"       0    "else begin

end"

What am I missing? why is my abbrev not expanding?


texts: navbar - multi-page website with one org-mode file

texts:
I'm generating multiple html pages from one org file. Function below generates html page for every heading level=1. I want to add simple navbar to every page.
Example content:
* home
** some heading
    this is home site
* about
** some heading
   this is about site

Function to modify:
(defun my-org-export-each-level-1-headline-to-html (&optional scope)
  (interactive)
  (org-map-entries
   (lambda ()
     (let* ((title (car (last (org-get-outline-path t))))
            (dir (file-name-directory buffer-file-name))
            (filename (concat dir title ".html")))
       (org-narrow-to-subtree)
       (org-html-export-as-html)
       (write-file filename)
       (kill-current-buffer)
       (widen)))
   "LEVEL=1" scope))

Example navbar:

home

about


texts:
I have foo-mode and would enable bar-minor-mode for it. So which way is more common and preferable?

A

(add-hook 'foo-mode-hook 'bar-minor-mode)

B

(add-hook 'foo-mode-hook (lambda ()
                           "Turn on `bar-minor-mode' mode."
                           (bar-minor-mode 1)))

C

(defun bar-minor-mode-on ()
  "Turn on `bar-minor-mode' mode."
  (interactive)
  (bar-minor-mode 1))

(add-hook 'foo-mode-hook 'bar-minor-mode-on)

D

• variant C, but function pushed to upstream

E

• variant C, but function stored in plugin's recipe


texts: How can I quit entering keywords when I auto-insert with Helm?

texts:
When I M-x find-file RET file.el RET and then run M-x auto-insert, I am eventually presented with a list of keywords that Helm will complete for me.  Trouble is, I have no idea how to finish the Helm completion without with quitting the entire function (with C-g).

How do I finish Helm completion and allow auto-insert to continue its work?


texts: Ghost code in Emacs configuration, how to find it?

texts:
I use the package vimish-fold.

The package contains, for example, two functions, called as:

Function 1
Function 2

There is a new commit to the package vimish-fold on Github, which will add the new function 3. But the changes are not reflected yet in MELPA.
I wanted to try it out, so I upgrade it manually.

I made the mistake of changing the contents of the package manually.

I copied the new code from Github, pasted the new code over the old code in the .el-file in the same package. And in the same package, I bytecompiled manually the .el-file in the same directory. So the .elc-file is also updated.

After restarting Emacs, I don't see the function 3 appearing when calling the commands lists with M-x.

After that, I deleted the package vimish-fold in package.el and reinstalled it. I waited until the update for vimish-fold appeared in MELPA, and update it with package.el.

In the same Emacs session, the new features of vimish-fold works fine, like function 3. But when I restarted Emacs, I see the new commands when I do M-x:

Function 1
Function 2
Function 3

I call the function 3, I get the message "Autoloading failed to define function function 3" But the function 1 and function 2 works fine, except the new function 3. So I guess somewhere the old package is still active. Then I remove the package vimish-fold in package.el, and reinstall it. In the same Emacs session the function 3 works again. But when I restarted Emacs, Function 3 is visible in the list of all commands, but I get the same error when I call the function 3.

So it seems the right package is enabled, but I get the autoloading fail error again. Note this is after deleting and reinstall the same package with the MELPA package manager/paradox.

It seems the others also struggled with the same issue. Without any succes. When I do a grep, I can't find any other same package as vimish-fold. Notice that I use Windows, and I have my .emacs.d in my PATH.

Any suggestion in order to solve it?


texts:
I am using Ubuntu 14.04LTS 64bit.

I encounter this problem when I opened too many files by a emacs function.
Error is signaled as a message and prevent me from opening more files.

I checked my ulimit -a which shows my open files limit is 1024.
So I changed the files limit to 4096 by this method.

After that, when I tried to open files more than 1024, emacs quit instantly without signaling any error.

Any suggestion to this problem?