texts: mu4e with second account with a different stream type fails to send messages

texts:
I use Emacs and mu4e for email. I successfully set up Amazon WorkMail IMAP with Emacs and mu4e as a second account. My first account works with TLS:
(setq ; ...
      smtpmail-smtp-server         "smtp.server.com"
      message-send-mail-function   'smtpmail-send-it
      smtpmail-smtp-service 587
      smtpmail-stream-type 'starttls
      smtpmail-auth-credentials ; ...
)

I was unable to set up SMTP: Amazon's page mentions that STARTTLS is not supported. I followed this page on SSL:
(defvar my-mu4e-account-alist
  '(
    ("mainAccount" ; ...
     )
    ("AWS"
     (user-mail-address "me@domain.com")
     (smtpmail-smtp-server "smtp.mail.eu-west-1.awsapps.com")
     (smtpmail-stream-type 'ssl)
     (smtpmail-smtp-service 465)
     )
    ))

And I get this error:
open-network-stream: Invalid connection type ssl

How can I fix this?


texts: Cannot enable sound when building from source

texts:
I can't seem to enable sound support when building Emacs from source:

  Does Emacs support sound?                               no

It does not seem to be doing anything even if I do:

  ./configure --with-sound=yes

Looking at more of the output I see the lines:

  checking for machine/soundcard.h... no
  checking for sys/soundcard.h... no

I'm using macOS 10.13 with the latest version of Emacs.

Does this mean that Emacs cannot see/access my soundcard? My computer works fine with sound by the way.

Here is the configuration output after running ./configure:

Configured for 'x86_64-apple-darwin17.4.0'.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc -g3 -O2
  Should Emacs use the GNU version of malloc?             no
    (The GNU allocators don't work with this system configuration.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    nextstep
  What toolkit should Emacs use?                          none
  Where do we find X Windows header files?                NONE
  Where do we find X Windows libraries?                   NONE
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   no
  Does Emacs use -ljpeg?                                  no
  Does Emacs use -ltiff?                                  no
  Does Emacs use a gif library?                           no
  Does Emacs use a png library?                           no
  Does Emacs use -lrsvg-2?                                no
  Does Emacs use cairo?                                   no
  Does Emacs use -llcms2?                                 yes
  Does Emacs use imagemagick (version 6)?                 no
  Does Emacs support sound?                               no
  Does Emacs use -lgpm?                                   no
  Does Emacs use -ldbus?                                  no
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               no
  Does Emacs use a file notification library?             yes (kqueue)
  Does Emacs use access control lists?                    yes
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              no
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   no
  Does Emacs use -lsystemd?                               no
  Does Emacs use -ljansson?                               no
  Does Emacs directly use zlib?                           yes
  Does Emacs have dynamic modules support?                no
  Does Emacs use toolkit scroll bars?                     yes
  Does Emacs support Xwidgets (requires gtk3)?            no
  Does Emacs have threading support in lisp?              yes

Any help to point me in the right direction will be greatly appreciated.

Thanks!


texts: helm-info list of info pages cannot find newly installed packages?

texts:
I like reading my documentation using emacs. The nature of documentation is that you often want to read documentation immediately after installing it.

Whilst running emacs I installed the documentation for gnuplot (sudo apt-get install gnuplot-doc), and the command info gnuplot shows me documentation. However, helm-info doesn't list gnuplot.

Now obviously I could restart emacs... but I don't like restarting emacs for obvious reasons. I've tried running  (setq helm-info--pages-cache nil) and killing then *helm Info* buffer.


texts: sr-speedbar width size options on start not working

texts:
By default, sr-speedbar seems to always want to take 50% of available window space.

I'm trying to change it's default size to something smaller (like 40 px), but I can't seem to figure out how as the option sr-speedbar-width-x doesn't seem to do anything.

Here's a snippet from my init.el.  All the other options are working just fine

(setq
    sr-speedbar-width-x 40
    speedbar-use-images nil
    speedbar-show-unknown-files t
    sr-speedbar-right-side nil
    )

(when window-system
    (sr-speedbar-open))


texts:
There are times I prefer to work in a sparse tree instead of an agenda, namely ease of quick edits.

However the sparse tree, even with all folds level set to on (e.g. org-show-siblings and others), still the tree still shows tasks/headlines in a folded state.  I would prefer them to be entirely hidden, just like org-narrow-to-subtree (C-x n s).

This only works with a single subtree.  Is there a way to extend the narrowing to all of the sparse tree, and completely hide the non-sparce tasks/headlines?


texts: Export handout with notes using org-mode and beamer

texts:
I'm having a lot of trouble getting a nice solution to this problem.

I want to export a handout for a beamer presentation using org-mode. I can write a note using \note{sample note}, which creates a separate notes page, but I can't have line breaks in the note and I can't do \note[itemize]{\item ...} either. Not sure what's going on here. But I would like the slide on the top half of the page and the notes on the bottom (which aren't displayed on the slide). Below is the sample code.

#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [handout]
#+LATEX_HEADER: \usepackage{pgfpages}
#+LATEX_HEADER: \mode<handout>{\setbeameroption{show notes} \pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]}


texts:
wl-summary-goto-folder (keybinding g in Summary mode), permits to jump to a folder whose name is entered interactively.

What I'd like is to pass it the folder name by argument, in order to call it at emacs startup time, with something like

emacsclient -c --eval "(wl-folder-goto-folder 'folder_name)"

Is there a way I can do that ?


texts: Can I determine the difference of declaring (and not declaring) a file to use lexical-binding?

texts:
I have been trying to understand what difference it makes if you set the file variable lexical-binding to t for a particular source file.

As mentioned in emacswiki that in order to use lexical-bindings in your source files, you specifically have to opt for it by setting the local file variable.

However, with all that I tried, I could not find any difference in the behavior of the source code within the file and being able to access variables declared in the file from outside and vice-versa.

Is there a way I can see the difference myself for how using ;;; -*- lexical-binding: t -*- in the first line of my source files enables lexical-binding instead of using dynamic-binding?


texts: Show stderr, by default, in the output section of evaluated code blocks

texts:
The context
I'm currently using org-mode to take notes on the grep command.
The grep version I have on my system doesn't support searching multiple patterns when the -P (i.e. --perl-regexp) flag has been used, so executing (see below) shows the following error
$ grep -R -P -e '(?<=\()bind' -e '(?<=\()set' ~/SourceCode/cmus
grep: the -P option only supports a single pattern

The problem
If that command is written in a code block and it is evaluated
#+begin_src sh :results output
grep -R -P -e '(?<=\()bind' -e '(?<=\()set' ~/SourceCode/cmus
#+end_src

the error is not shown in the #+RESULTS section
#+RESULTS:

Additional context
The following does show stderr in the #+RESULTS section but this implies using 2>&1. I would like stderr be shown in the #+RESULTS section of every code block, by default.
#+begin_src sh :results output
grep -R -P -e '(?<=\()bind' -e '(?<=\()set' ~/SourceCode/cmus 2>&1
#+end_src

#+RESULTS:
: grep: the -P option only supports a single pattern

The question
How can I make stderr to be shown, by default, in the #+RESULTS section of all code blocks whose language is sh?


texts: Display count of tasks in agenda, instead of tasks, based on tag

texts:
I've read through all the questions here, and searched extensively online.

Since I've started using org-drill, I have a lot of scheduled tasks with the tag :drill:. Instead of having all these tasks show up in my agenda, I just want to show something like Org-Drill: 42 cards today..

I ripped this off org-effectiveness:

(defun drill-card-count()
  "Print a message with the number of todo tasks in the current buffer"
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (message "Number of cards: %d" (count-matches ":drill:"))))

I can run this in my agenda but of course it doesn't do what I'd like.

To summarize, I'd like to:
1. Filter any tasks tagged drill from my agenda.
2. Display instead the count of those tagged tasks.
3. Otherwise display the agenda as normal.

Thanks for any help!

ETA:
Lawlist's comment below is helpful. I've added this, and it hides the tasks tagged :drill:, but doesn't count them. So, 1 and 3 accomplished, but don't know how to insert a task showing the drill items count.

(defun my-skip-tag(tag)
    "Skip entries that are tagged TAG"
    (let* ((entry-tags (org-get-tags-at (point))))
      (if (member tag entry-tags)
          (progn (outline-next-heading) (point))
        nil)))

(setq org-agenda-custom-commands
      '(("x" "again"
     ((agenda ""
          ((org-agenda-overriding-header (drill-card-count))
           (org-agenda-skip-function '(my-skip-tag "drill"))))))))


texts: Org source block for Octave session fails with large matrices

texts:
Sometimes I have to analyze quite large matrices with octave as part of a documented reproducible work.
Org files with Octave source blocks are the ideal format for that purpose.
One defines the matrix in one Octave source block running a session and analyzes the matrix in successive Octave source blocks with the same session and with descriptive texts in between.
Pityingly, bigger matrices cannot be read in an Octave session.
The following Elisp-script generates an Octave source block with a 26x26 matrix.
The execution of the Octave source block fails in the session oct with the following output in the inferior octave buffer:
The error output:
'org_babel_eoe'
> parse error:

  syntax error

>>> if isch
     ^

octave> parse error:

  syntax error

>>> else, dlmwrite('/tmp/babel-N8s61a/octave-TCIyvs', ans, '\t')
       ^

octave> parse error:

  syntax error

>>> end
      ^

octave> ans = org_babel_eoe
octave>

The Elisp script that generates the Octave source block. The script is also an Org source block. You can copy it to an Org file and execute it.
#+BEGIN_SRC emacs-lisp :var n=26 :results raw
(cl-flet ((printrow (n row)
            (dotimes (col (1- n))
              (insert (format "%d.%d, " row col)))
            (insert (format "%d.%d" row n))))
  (with-temp-buffer
    (insert "#+BEGIN_SRC octave :session oct\n"
        "ans = [\n")
    (dotimes (row (1- n))
      (printrow n row)
      (insert ";\n"))
    (printrow n n)
    (insert "]\n"
        "#+END_SRC")
    (buffer-string)))
#+END_SRC

Can anybody reproduce the effect? What is going on? Any chance to fix it?
I've tested the 26x26 matrix already in octave-cli in the shell. That works.
Reproduction conditions:

Operating system: Ubuntu 18.04.1
Emacs: 26.3
Org-version: 9.2.6


texts:
Emails sent using smtpmail / mu4e appear in Gmail Inbox, both when checked in mu4e and Gmail interface.

I have the following in my .init.el:

(setq
 mu4e-maildir       "~/.mail"   ;; top-level Maildir
 mu4e-drafts-folder "/gmail/[Gmail]/Drafts"
 mu4e-sent-folder   "/gmail/[Gmail]/Sent Mail"
 mu4e-trash-folder  "/gmail/[Gmail]/Trash"
 mu4e-refile-folder "/gmail/[Gmail]/All Mail"
 mu4e-user-mail-address-list '("[email]"))

(setq message-send-mail-function 'smtpmail-send-it
     smtpmail-stream-type 'tls
     smtpmail-default-smtp-server "smtp.gmail.com"
     smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg")
     smtpmail-smtp-server "smtp.gmail.com"
     smtpmail-smtp-service 465)

(setq mu4e-sent-messages-behavior 'delete)

My .mbsync has the following contents:

IMAPAccount gmail
# Address to connect to
Host imap.gmail.com
User [email]
SSLVersions TLSv1.1
# Pass ***************
# To store the password in an encrypted file use PassCmd instead of Pass
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
#
# Use SSL
SSLType IMAPS
# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.
CertificateFile /etc/ssl/certs/ca-certificates.crt
#CertificateFile ~/.cert/imap.gmail.com.pem
#CertificateFile ~/.cert/Equifax_Secure_CA.pem

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
Subfolders Verbatim
# The trailing "/" is important
Path ~/.mail/gmail/
Inbox ~/.mail/gmail/Inbox

Channel gmail
Master :gmail-remote:
Slave :gmail-local:
Patterns * ![Gmail]* "[Gmail]/Sent" "[Gmail]/Drafts" "[Gmail]/Trash" "[Gmail]/Starred" "[Gmail]/All Mail"
Create Both
SyncState *
Sync All

My .mail dir has the following structure:


texts: Search for "foo bar" ignoring comments and newlines

texts:
How do I search for "foo bar" ignoring comments and newlines in emacs? For example, given the tex file fragment

blah blah foo % comment 1
% comment 2
bar blah blah

I'd like to be able to type "foo bar" at the emacs search prompt and have my cursor land at the end of "bar" in the third line.

Qualification: I'm actually using Aquamacs in OS X, but hopefully a good answer for emacs would carry over.


texts: Is there an integration between projectile and python-mode that allows for one python interpreter buffer per projectile project?

texts:
I use projectile with python (and anaconda mode) to work in emacs. When starting an ipython interpreter buffer, the first such session works fine. However, attempting to start a second session, for example, to have another project-specific shell, results in the commands from the second project being sent to the first project's python interpreter. Renaming python interpreter buffers seems to work at least sometimes, but I have not figured out how to specify on a per-project basis which interpreter buffer to use, even when renamed. I am aiming for the emacs/python equivalent of the ESS/R experience, which enables and works well with project-specific interpreter buffers. Any suggestions?

FYI, this was also posted to reddit.


texts:
I actually know very little about cask. I discover it after browsing the emacs module of prezto

In this prezto module, the cask command alias will not be created unless there exists a .cask file.

I have run cask init but the file is still absent. Is it right for me to expect this file to be created by cask init?

Here is the link to the key file in the said emacs module https://raw.githubusercontent.com/sorin-ionescu/prezto/master/modules/emacs/init.zsh


texts: Unable to load my CSS during org-publish-project

texts:
I want to write an static website using org-mode and publish it from emacs.  For this, I followed the tutorial I found in org-mode site.

My site directory tree is as follows:

~/org
    css/
      stylesheet.css
    index.org

My org-publish-project-alist looks as follows:

(setq org-publish-project-alist
      '(
        ("org-notes"
        :base-directory "~/org"
        :base-extension "org"
        :publishing-directory "~/public_html"
        :recursive t
        :publishing-function org-html-publish-to-html
        :headline-levels 4             ; Just the default for this project.
        :auto-preamble t
        )

        ("org-static"
        :base-directory "~/org"
        :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
        :publishing-directory "~/public_html"
        :recursive t
        :publishing-function org-publish-attachment
        )

        ("org" :components ("org-notes" "org-static"))
        ))

I have not been able to link my stylesheet.css in the index.html generated.  This is how I tried to set the local variable org-export-html-style at the bottom of index.org

# Local Variables:
# org-export-html-style: "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/stylesheet.css\" />"
# End:

What am I missing?


texts: How to prevent "the function ‘->’ is not known to be defined." warning

texts:
How do I prevent flycheck from triggering a warning for the following code:

(defun file-path-last-segment ()
  "Get last segment of file path for use in snippets."
  (-> default-directory
      (file-name-directory)
      (directory-file-name)
      (file-name-nondirectory)))

The following warning appears in my flycheck errors:

the function ‘->’ is not known to be defined.


texts: How to prevent emacs hanging when 'accept-process-output' is called multiple times on a single process?

texts:
I'm running into a bug where Emacs locks up when accept-process-output is being called on the same process multiple times.

In this case this is the ispell-process, however I don't think that matters so much.

Is there a way to detect if a process is 'in-use' to avoid multiple functions calling it at once?

Note some alternatives I've found which I'm not so happy with:

Have a separate ispell-process which is set for cases where multiple callers may overlap.
Use locking variables to avoid multiple callers using it at once.


texts:
CentOS 7, Emacs 27.1
Suppose I wan to to connect to the remote host (by ssh).
Approach#1
Opent Linux terminal and run the next command
ssh someLogin@10.222.11.111

Type password and after about 3 seconds I success connected to the remote host.
Nice.
Now I want do same by Emacs.
Approach#2
I use Tramp mode.
I my bookmarks I already has link to remote host.
So I only jump to bookmarks like this;
mybookmarskEntity  /ssh:someLogin@10.222.11.111:/home/someLoginHome/

and wait ... about 30 seconds. And only after 30 seconds I success connected to the remote host.
Why so slowly?


texts: calendar date selector not displaying date in capture mode

texts:
I am having trouble with inserting dates in Capture mode.

The problem: I invoke Capture mode (C-c c for me). I type my task ** TODO some task. I invoke calendar to schedule C-c C-s. I pick a date and hit return.

Strangely, the usual SCHEDULED: [date] doesn't appear below the TODO item. When I save and close Capture mode, the entry is filed with the chosen date. So, the date is being recorded properly. The odd thing is that it doesn't display properly in the Capture buffer.

Anyone else seen such behavior? Any suggestions on how to fix?

GNU Emacs 26.3, Org mode v 9.3


texts: "No such file or directory, bind-key" after installing use-package

texts:
I'm using Emacs on Windows 10. I want to override key bindings, so after reading How to override major mode bindings, I installed use-package with the built-in package manager (via M-x package-install RET use-package RET). The package came from the package archive at http://melpa.milkbox.net/packages/.

When I write (require 'bind-key) in my .emacs I get the error:

File is missing: Cannot open load file, No such file or directory, bind-key

Which makes I can't use the commands bind-key*, bind-keys* etc. What should I do to be able to use bind-key?


texts: Call an interactive function without asking for user input

texts:
I would like to call an interactive function that requires user input (projectile-test-project, for instance) by using a predefined argument and therefore executes without asking the user anything.
I am guessing it's possible to call the interactive function with initial content followed by a simulated RETURN stroke but that seems a bit wonky.


texts: How to convert this add-to-list call into a function

texts:
I have a bunch of add-to-list calls that I'd like to shorten in my .emacs file. They all look like this:

 (add-to-list 'align-rules-list
              '(haskell-comment
                (regexp . "\\(\\s-+\\)--\\s-+")
                (mode   . '(haskell-mode))
                (repeat . nil)))

I don't know lisp but I tried to define a local function that I can call repeatedly. I'm not getting very far:

(let ((f (lambda (name re)
          (add-to-list
           'align-rules-list
           (list name
                 ('regexp . re)
                 '(mode . (haskell-mode))
                 '(repeat . nil))))))
 (funcall f 'haskell-comment "\\(\\s-+\\)--\\s-+"))

Can someone point out my problem with the code above?

After much googling, I've arrived at something that seems to work:

(let ((f (lambda (name re)
          (add-to-list
           'align-rules-list
           (list name
                 (cons 'regexp re)
                 '(mode . '(haskell-mode))
                 '(repeat . nil))))))
 (funcall f 'haskell-comment "\\(\\s-+\\)--\\s-+")

But it seems messy. Quotes everywhere, cons, list. Is there a cleaner way?


texts: Creating a macro/elisp function for HASH using calc

texts:
In my workflow, I need to do binary operations quite often. I am wondering if there is a clean way of creating macro/elisp-function to return value of following HASH function.

Input 16bit hex number: NUM
Hash function return value = NUM[15] ^ NUM[13] ^ NUM[11] ^ ... ^ NUM[1]
(here ^ means XOR)
For example:

If NUM(in hex)=0001, hash=0
if NUM(in hex)=8000, hash=1
if NUM(in hex)=000A, hash=0


texts: How do you add command line options to flycheck's C++ checker?

texts:
I needed to specify stdlib options in a certain environment, so I changed the flycheck executable to clang -std=c++11 -stdlib=libc++, which is needed to compile the file.

However, I got the error Error while checking syntax automatically: (error "Output file descriptor of flycheck-c/c++-clang is closed") after doing so, and searches don't turn anything up.

How do I help flycheck out?


texts:
I am trying to bind CTRL-B to perform the Evil command :buffers. The reason I am doing this is because I want to scroll through the open buffers with j and k and then press <RET> to make the selection.

What I tried was adding the following code to my configuration file:

;; Switch Evil-mode buffers
(define-key evil-normal-state-map (kbd "C-B") ":buffers")

The result of reloading this configuration (:eval-buffer) and then pressing CTRL-B leads to:

  After 0 kbd macro iterations: Can't find "

How can we bind to an Ex-mode command?


texts:
I've seen in some Emacs videos, the author would type

#+BEGIN_SRC

in their buffer, and emacs auto inserts #+END_SRC.

Is this a feature I can "turn on" in vanilla Emacs? If not, which package can I use?


texts: 'editable-field' widget is not playing nice with `widget-value-set'

texts:
When I evaluate the following form,

(defun magithub-issue-form ()
  (interactive)
  (with-current-buffer (generate-new-buffer "*magithub issue*")
    (switch-to-buffer-other-window (current-buffer))
    (widget-value-set (widget-create 'editable-field
                                     :tag "Title"
                                     :format "%t: %v\n\n"
                                     :size 76)
                      "Some default title")
    (use-local-map widget-keymap)
    (widget-setup)))

I get a buffer that looks like this:

Title: Some default title<editable field starts here>

widget-value-set works for other widget types (like checklist), so why does it misbehave for editable-field?

A similar issue is happening for widget type text:


texts: How to force an org-babel session to reset or initialize?

texts:
If I run the following babel shell blocks

#+BEGIN_SRC sh :session one :results output
  ssh staging
#+END_SRC

#+BEGIN_SRC sh :session one :results output
  hostname
#+END_SRC

Org creates a shell buffer called one, runs ssh staging and then after connecting, executes hostname on staging. However, if I tweak the ssh command and run it again it attempts to run it from within session one, from the staging host. If I close the buffer one it resets the session as the next time any command is run with that session name it recreates it. What I haven't been able to find is a method to force a particular babel block to always initialize a new session.

I'm aware that for some languages (elisp in particular) this would not be possible. I suppose I could prepend the session with an elisp block containing (kill-buffer "one"), but would rather this was a header argument if possible. I'm also aware that for this example I could simply combine the two into a single block with no session, but I'm interested in more complicated sequences.

Is there a :prologue command or some other special argument to :session that forces that block to initialize a new shell on every invocation?


texts: Prompt can be be deleted in run-scheme but not in run-python?

texts:
Prompt can be deleted when I do a run-scheme but not in run-python. Is there a way to make it standard i.e not to delete the prompts? I checked the comint-mode manual but couldn't find anything that controlled this behavior.

Are there any advantages using comint over ansi-term? I am thinking if I should stick with ansi-term because the default behaviour is better. Only problem I have is to sync with my source code in a correct way (other than hacks like copy paste the clipboard etc)


texts: Creating table of content with the package titletoc in Org Mode for LaTex export produces strange lines of text

texts:
I use the LaTeX package titletoc to produce table of contents in some chapters or sections for Org-Mode LaTeX / PDF export with

#+TOC: headlines 1 local

But in the PDF file there is for example the following text before the table of content:

  section.1 section.2 section.3 subsection.3.1 subsubsection.3.1.1 subsubsection.3.1.2
  subsubsection.3.1.3 subsubsection.3.1.4 subsubsection.3.1.5 subsection.3.2

I have no idea about that. Perhaps somebody can give me a hint.


texts: In Org mode: How can I move point (up) to the current heading (or the first line under the heading)?


texts: How connect to remote machine by private key on Tramp mode?

texts:
From my machine Windows 10, I connect to remote Linux machine by private like this (in console)

ssh -i d:\Remote\key\privatekey myLogin@some_remote_host

success connect:

Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.15.0-1026-gcp
x86_64)

Nice.
Now I want by Tramp mode to connect:

C-x C-f

/pscp:mylogin@ip_address:

But I get error:


texts: Angular and Tern.js - ReferenceError in angular.js

texts:
I'm trying to configure Emacs with Tern.js to use AngularJS in it.
When add angular to .tern-project like:

{
  "plugins": {
    "node": {
    },
    "angular": {
    }
  }
}

and type app.| I get ReferenceError in Angular itself printed in minibuffer:

/my/project/home/angular.js:26307
})(window, document);
   ^
ReferenceError: window is not defined
    at Object.<anonymous> (/my/project/home/angular.js:26307:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at loadPlugins (/usr/local/lib/node_modules/tern/bin/tern:111:15)
    at startServer (/usr/local/lib/node_modules/tern/bin/tern:136:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/tern/bin/tern:132:14)
)

Does anyone have some experience with this or advice?


texts:
Is there a way to show Apple Calendars in org-mode? All I need is to be able to see them in org-mode, I am not (currently) interested in syncing or anything like that. Ideally, the Apple Calendars should show up as a Readonly buffer (or diary, or whatever the term ends up being).

There is org-mac-iCal, but it is severely out of date and does not work any more. I suppose the way to do it is to parse the Calendar files and put them where org-mode would see them, but I am curious if this is done already by somebody?


texts: How can I prevent a command from using specific windows?

texts:
Typically, I have a frame split into four windows, where two at the bottom are dedicated to my *compilation* and *grep* buffers. When browsing compilation errors, next-error will eventually replace my *grep* buffer with one of the target file.

How can I configure next-error to not use the window containing the *grep* buffer?

My specific use-case is the next-error command, but more general answers are welcome as well.


texts:
Im looking for a way to copy (clone) a file into same dired buffer.

For example if i have a test.zip file in ~ i would issue it and it would copy test.zip file to ~. a bonus would be if one can assign a number/string to the new cloned file like test1.zip


texts: select text to end of line, without moving point

texts:
I often want to quickly mark everything from point to the end of line, leaving point at the same place.

I tried to write simple function for that purpose:

(defun mark-from-point-to-end-of-line ()
  "Marks everything from point to end of line"
  (interactive)
  (save-excursion
    (progn
      (set-mark-command nil)
      (move-end-of-line nil)
      (set-mark-command nil)
      )))

However, it behaves not as expected, e.g. if you place point over m in line (move-end-of-line nil) and execute this command this will mark everything from beginning of buffer to point. I guess this is somehow related to save-excursion function, but can't be certain. How should I fix that?

P.S. Sorry for question title, don't know how to name it better.


texts:
For typing mathematical formulas in emacs I often run into the problem that certain characters are not available as subscript (or superscript) characters. Since I would like a simple solution without involving rendering of LaTeX formulas I was wondering if I could put characters with a small font size to simulate subscript.
Here my questions:

Can I directly change the font of a displayed character in a buffer (maybe using overlays etc)?
Can I display character of a buffer using different charsets that involve e.g. the same font but with different font sizes (one for normal character and the other for "subscript").
Is there a different/easier solution?

Any suggestions are highly appreciated! :)


texts: Is there a universal 'after-theme-load' hook?

texts: I would like to set several face variables for use with any theme in my personal init-file. Is there a hook I could use to insure it is theme independent?


texts:
I am trying to define this seemingly innocuous function:

(defun previous-window ()
  (interactive)
  (other-window -1))
(define-key evil-window-map (kbd "o") 'previous-window)

and I am running into this problem:

Debugger entered--Lisp error: (wrong-number-of-arguments (lambda nil (interactive) (other-window -1)) 3)
  previous-window(#<window 6 on *scratch*> nil nil)
  byte-code(...)
  #[(count &optional all-frames) "..."
  ad-Advice-other-window(#[(count &optional all-frames) "..."
  apply(ad-Advice-other-window #[(count &optional all-frames) "..."
  other-window(-1)
  previous-window()
  call-interactively(previous-window nil nil)
  command-execute(previous-window)

If I change that -1 to 1, everything works fine. The documentation for other-window

  other-window is an interactive compiled Lisp function in `window.el'.

  It is bound to C-x o.

  (other-window COUNT &optional ALL-FRAMES)

  :around advice: `ad-Advice-other-window'

  Select another window in cyclic ordering of windows. COUNT specifies
  the number of windows to skip, starting with the selected window,
  before making the selection.  If COUNT is positive, skip COUNT windows
  forwards.  If COUNT is negative, skip -COUNT windows backwards.  COUNT
  zero means do not skip any window, so select the selected window.  In
  an interactive call, COUNT is the numeric prefix argument.  Return
  nil.

states clearly that negative arguments are used to cycle backwards. Therefore, this is really weird to me. Has it got anything to do with an interactive call? Can someone please explain what is going on here?

I am using GNU Emacs 24.5.1.

Thanks.


texts: Emacs- visual-line-mode and latex tabular environment

texts: I am using GNU Emacs 24.4.1 with visual-line-mode turned on for LaTeX editing. This works great, except in tabular environments, where it would be nice to have the word-wrapping turned off. Is this even possible? My Lisp skills are limited so not sure where to start with this.


texts: Automatically fixing bad indentation (Scheme-Lisp)

texts:
Let's say I make this code with bad formatting: is there an emacs command that can automatically fix indentation? I know this question has been asked a few times before, but all the answers I've seen seem very technical (I'm a CS noob).

(define (count-until x y list1)

    (define (iter list1 score)
    (if (eq? (car list1) x)
    (iter (cdr list1) (+ score 1))
    (iter (cdr list1) score)))

    (iter list1 0))


texts: Getting the full list of colors available in Emacs

texts:
When I run list-colors-display I get the following:

which I think is a very small subset of colors that my Emacs supports, isn't it?

For example, I know Emacs supports other colors (gray20, blue15, etc). Why am I not seeing them as a result of the list-colors-display command?

How can I see the full list?

In case it matters, my version is:

"GNU Emacs 25.0.95.1 (x86_64-apple-darwin15.5.0, NS appkit-1404.47 Version 10.11.5 (Build 15F34)) of 2016-06-20"

If I evaluate:

(defined-colors)

I get:

("alternateSelectedControlColor" "alternateSelectedControlTextColor" "controlBackgroundColor" "controlColor" "controlDarkShadowColor" "controlHighlightColor" "controlLightHighlightColor" "controlShadowColor" "controlTextColor" "disabledControlTextColor" "gridColor" "headerColor" ...)


texts:
I created such a snippet

$ cat snippets/diary_template
# -*- mode: snippet -*-
# name: diary template
# key: dt
# condition: t
# --

**** Personal_Notes
**** Personal_Tasks
**** Project_Notes
**** Project_Tasks(base)

set yas-snippet-dirs as

;;yasnippet
(require 'yasnippet)
(setq yas-snippet-dirs
      '("~/.doom.d/snippets"                 ;; personal snippets
        ))

(yas-global-mode 1) ;;

Reload the config file and activate the  yas-minor mode

In the sdiary.org input dt and strike dt. nothing happened.

What's the problem with my operations?


texts: Using different theme on tramp buffers (and buffer-related themes in general)?

texts:
Is it possible to configure emacs so it uses different theme for tramp buffers than for defaults? Say, I use twilight by default, but while editing sth via ssh I'd like to switch to pastels-on-dark...

Changing colors are great at providing a feeling that ”something is different”…

This question in fact covers a few problems:

a) whether there is any natural way to use per-buffer theme (I failed to find one)

b) if not, what is the best way to hook emacs so it switches theme depending on the current buffer (so far I have preliminary solution I am not happy with, see below)

c) and, specifically, how to adapt that to tramp case

Note: I found load-theme-buffer-local. For some reason it does not work for me (once I call it on some buffer, the same theme remains active for every other buffer too).

Here is a partial solution for b) case I found some-time ago. I am not happy  with it (it fires only when I open new file and does not react to buffer switch, it fails to revert to default in some cases, and it works only for per-dir-tree case), but maybe it could be improved:

;; in .emacs

(defvar my-local-theme nil
   "Name of current theme (intended to be overriden where necessary)")

(defun my-set-local-theme ()
   "If variable mkylocal-theme is set, loads this theme."
   (interactive)
   (when (bound-and-true-p my-local-theme)
       (unless(member my-local-theme custom-enabled-themes)
       (message "Setting local theme to %s on %s" my-local-theme (current-buffer))
       (load-theme my-local-theme t))))

(add-hook 'hack-local-variables-hook 'my-set-local-theme)

;; In .dir-locals.el on top of some source tree

(
  (nil
    (my-local-theme . twilight-anti-bright)
  ))

For completeness: I also use the following trick to load themes cleanly, so the code above does not unload themes.

(add-hook 'after-init-hook
      (lambda nil
        (defadvice load-theme
          (before theme-dont-propagate activate)
          (mapcar #'disable-theme custom-enabled-themes))))


texts: How to prevent Emacs from opening error buffer

texts:
I got someone ask this question:

  How can I prevent errors that should really just be a bell or flashing
  screen not open a window with an error?


texts: Org-mode: Exclude specific headlines from TOC when exporting

texts:
Q: How can I tell org-mode to exclude specific headlines from the table of contents when exporting?

For example, exporting

* Headline 1: Put me in TOC
* Headline 2: Put me in TOC
* Headline 3: DO NOT put me in TOC

to HTML produces

...

1. Headline 1: Put me in TOC

2. Headline 2: Put me in TOC

3. Headline 3: DO NOT put me in TOC

...

but I want it to produce

...

1. Headline 1: Put me in TOC

2. Headline 2: Put me in TOC

...

The Table of contents section of the org-mode manual doesn't have any information on this.

Also, I know that I can keep org-mode from exporting headlines by setting the COMMENT keyword via C-c ; (org-toggle-comment) or by tagging them with :noexport:. While this does keep affected headlines from showing up in the TOC, it also causes their contents to be omitted from the resulting document, which is not what I want.


texts: Restore default colors (black text on a white background)

texts:
I played around with elpy and after following the tutorial, it changed the emacs theme to a black background.

When trying to revert this, I managed to get a white font on a white background persistently after startup :-) .

How do I revert all colour- and theme- settings back to the default emacs theme? I am unable to find any relevant changes in my .emacs.

I am using the emacs 25 snapshot.

I used this turorial


texts:
When I run M-xgdb, Emacs opens a new frame with the code being debugged.  This is while having two buffers open in the original frame: the one with debugger's console and another one with the program's output.
Question
Is it possible to not open this extra frame?


texts:
I have this function that reload a file but it don't work when I have same buffer opened in 2 different windows:

(defun reload ()
  "Reload a file

it will kill buffer, open file again and jump to position where cursor when called"
  (interactive)
  (let ((filename buffer-file-name)
        (postion (point)))
    (if filename
        (progn
          (kill-buffer)
          (find-file filename)
          (goto-char postion)))))


texts: Can I completely replace xterm with emacs' term mode?

texts: What short comings can I expect from this mode, and what are some use cases for which I should really prefer my operating system's terminal emulator?


texts:
Is there a key-binding to go back a page in the eww web browser?

I can't find a page which lists all the key bindings.


texts: Multiple Emacs instances each with their own server?

texts:
In my setup, I have several (GNU) Emacs instances running simultaneously on my local machine, one for each project or task that I'm currently working on.

I would like to be able to open buffers in an already running Emacs instance, for example by a command like

$ emacs file.txt

The typically suggested solution to this is to run Emacs in server mode. However, this conflicts with my use of multiple Emacs instances, as I understand that by default only a single emacsclient can be active at any time.

How can I open files as buffers in existing (possibly multiple) Emacs instances? The final goal is to open the file in the Emacs instance that is in the current workspace (Compiz), or to create such an instance if it doesn't already exist.


texts: emacsclientw does not use font specified in init.el (Windows)

texts:
Emacs version: GNU Emacs 25.3.1 (x86_64-w64-mingw32)

I have set up a shell-script which runs Emacs server at Windows startup as mentioned in Emacs Wiki. I have set up a shortcut on my desktop which I can double-click to run emacsclientw.exe with this command

H:\emacs-25.3-x86_64\bin\emacsclientw.exe -n -c -a ""

But emacsclientw.exe does not use the font I have specified in my init.el. This is strange, since everything else in my init.el works perfectly (macros, packages, etc).

How do I get emacsclientw.exe to use the font I have set up in my init.el?

I have this Elisp code in my init.el to set font and frame size on startup

;; Select a desirable font-size, frame position and frame size when Emacs starts up
(defun originalPosition ()
  (interactive)
  (set-frame-font "Courier New-14" t t)
  (set-frame-position (selected-frame) 100 50)
  (when window-system (set-frame-size (selected-frame) 82 28))
  )
(originalPosition)


texts: It looks pretty usefull to see where the buffer ends. For example, with help of black dashes column, like at this screenshot (look at left grey-colored border). How to implement this solution in my .emacs file?


texts: How do I reset minibuffer when it seems to act like a regular buffer?

texts:
Occasionally the minibuffer acts somewhat like a "regular" buffer. By that I mean that when I type C-x o my cursor jumps to that buffer and then waits for me to type something.

But I can't write anything to it. For example, when I type n a new frame is opened.

The label for this buffer seems to be *Minibuf-0* - it is a minibuffer.

(Messages are still printed OK to the echo area, which is in the same location as the minibuffer.)

What I would like to do is "reset" the minibuffer so that it acts normally. I tried killing that buffer with C-x k but that doesn't change anything. The only thing that seems to fix it is a reboot of Emacs.

Is there a way to "reset" the minibuffer?


texts: Exit minibuffer and execute a command afterwards?

texts:
I am trying to bind a key in minibuffer-local-map to a command which uses
abort-recursive-edit or exit-minibuffer and then proceeds executing more elisp code. So I want to exit the minibuffer and then continue from the context before. The only solution I have found so far is to use run-with-timer like in this contrived example:

(defun example ()
  (interactive)
  ;; This is my current workaround
  ;; (run-with-timer 0.1 nil 'split-window-vertically)
  (abort-recursive-edit)
  ;; This code won't be executed
  (split-window-vertically))

Is there a cleaner/better way to do something like this? I could try to setup everything with with-current-window and stuff like that and exit the minibuffer in the last instruction but maybe there is a better alternative?


texts: emacs org capture mode not creating link with "%a"?

texts:
my org capture template is
(setq org-capture-templates
      '(
        ("i" "Idea" entry (file+datetree "~/Dropbox/org_mode/ideas.org")
         "* %?\n Idea: %U\n  %i\n  Link: %a")
      )

This template is creating:

Note: my emacs version is 26.1 on debian


texts: cycling between minibuffer and last window|buffer

texts:
I'd like to cycle between an active minibuffer window and the last recent buffer.

1  (defun cycle-to-minibuffer-window ()
2    (interactive)
3    (when (active-minibuffer-window)
4      (if (minibuffer-window-active-p (get-buffer-window))
5           (select-window (other-buffer (current-buffer)))
6        (select-window (active-minibuffer-window)))))
7
8  (global-set-key (kbd "C-<f9>") #'cycle-to-minibuffer-window)

To bad that line 5 (other-buffer (current-buffer)) returns, in this case, the wrong buffer. :(
Which elisp construct could I use instead to get the buffer|window I wanted?

Example (tested with emacs -Q):

There are 3 buffers: *scratch*, *Messages* and *Minibuffer-0*.
My active buffer is *scratch*. I do find-file aka C-x C-f.
Now pressing C-<F9> (calling my function), wants to switch to *Messages* buffer, but *scratch* buffer would be correct.


texts: How can I start swiper with an initial filter?

texts:
I'd like to start swiper with a filter pre-set on the search -- as if I'd entered a search expression and then used S-SPC (ivy-restrict-to-matches) to clear the query space to narrow the results down further.

I can use

(swiper "something to search on here")

but I still see something to search on here in the minibuffer.  How can I get that to go away programmatically?

My use-case is a simple way to navigate functions defined in a file. I defined a regexp that matches the beginning of functions up to the function name -- I'd like to match on this name.


texts: Disable tex-mode's auto tex-insert-quote functionaliy

texts:
So basically, for reasons unknown we don't use regular LaTeX style quotes at my company, instead just using regular double quotes. However, tex-mode in emacs automatically substitutes the " key for ``''. I can't find any way of disabling this.

I've tried setting tex-open-quote and tex-close-quote to ", which works to some degree, but when inserting quotes inside a \verb!!, it still substitutes the first ! with `'' for some unknown reason.

I'm using Doom-Emacs, but I doubt this has anything to do with the functionality.

Is there any way of completely disabling this functionality, or at least unmapping the " key from tex-insert-quote?


texts: Is there any downside to setting `gc-cons-threshold` very high and collecting garbage when idle?

texts:
I  added the following two lines to the top of my init.el:

(setq gc-cons-threshold (eval-when-compile (* 1024 1024 1024)))
(run-with-idle-timer 2 t (lambda () (garbage-collect)))

That means that instead of collecting garbage every 800kb of allocated memory, Emacs does so when idle, i.e. when the pausing does not bother me. (It also collects after allocating 1GB of memory, but I don't think that will happen).

This improved my startup time by about two thirds. In theory, it should also improve performance in general. Are there any downsides to this approach?


texts: why does magit say I haven't pushed the commit?

texts: I'm trying to figure out why magit is saying this. I created and checked out a branch array-of-tables from master, made a commit, then pushed it (using push current and choosing to push to origin/array-of-tables). I see on github that it was pushed, so why is magit saying it's unpushed? I tried pressing g to refresh it, even quitting and going back into magit-status. I imagine I'm just interpreting this incorrectly, or I did something wrong.


texts:
My embarrassingly easy question is the following:

Why does the following code works:

(require 'request)

(defun geocoder ()
  (request
   "http://rpc.geocoder.us/service/csv"
   ;;; **Hardcoded parameter!**
   :params '(("address" . "1600 Pennsylvania Ave, Washington DC"))
   :parser 'buffer-string
   :success (function*
             (lambda (&key data &allow-other-keys)
                (when data
                (with-current-buffer (get-buffer-create "*request demo*")
                  (erase-buffer)
                  (insert data)
                  (pop-to-buffer (current-buffer))))))
   :error
   (function* (lambda (&key error-thrown &allow-other-keys&rest _)
                (message "Got error: %S" error-thrown)))
   ))

(geocoder)

While this one doesn't?

(require 'request)

(defun geocoder (address) ;; adding a parameter!
  (request
   "http://rpc.geocoder.us/service/csv"
   :params '(("address" . address))
   :parser 'buffer-string
   :success (function*
             (lambda (&key data &allow-other-keys)
                (when data
                (with-current-buffer (get-buffer-create "*request demo*")
                  (erase-buffer)
                  (insert data)
                  (pop-to-buffer (current-buffer))))))
   :error
   (function* (lambda (&key error-thrown &allow-other-keys&rest _)
                (message "Got error: %S" error-thrown)))
   ))

;;; Now with parameter!
(geocoder "1600 Pennsylvania Ave, Washington DC")

How should I send a parameter to request?


texts: Orphaned source `org-edit-src-code` buffers

texts:
I regularly use org-tree-to-indirect-buffer to edit an org-mode entry in a separate buffer.
I also have org-indirect-buffer-display set to current-window so that org-tree-to-indirect-buffer automatically kills an old indirect buffer before creating a new one.

The problem is that sometimes I would be editing a source-code block using org-edit-src-code, but then forget to press C-c C-c to accept the changes. If I then call org-tree-to-indirect-buffer on another entry, the old indirect buffer is killed and the source buffer that org-edit-src-code created is orphaned. Pressing C-c C-c on that buffer returns "Source buffer disappeared. Aborting". Is there a way to make it so that source code buffers are automatically closed when the original buffer is killed?

TLDR, how can I automatically close Org Src created by org-edit-src-code when the original org buffer is killed?


texts: How do I ediff a buffer against a revision?

texts:
I want to run ediff to compare my current version of a file (in git) with a version of the file on a different branch.

I run M-x ediff-revision from within an open buffer for the file in question.  I answer the two questions:

Compare revisions for file: I blank this answer (the default is the current buffer which is correct).
Revision 1 to compare: I accept the default again ("default file's latest version").
Revision 2 to compare: I enter a git branch name

This works great for viewing the differences between the two files.  However, I want to be able to edit the current version (i.e., by hitting a or b in ediff to copy or remove blocks of diff) and the "current version" buffer is a read-only buffer with a manufactured name (file.~git-branch~).  I want the "current version" buffer to be the read-write buffer that I started with, not a read-only buffer on the current branch's version.


texts: Prioritize color of emphasis faces in Org headers

texts:
Observe the following Org buffer, tested on Emacs with no configuration (emacs -q):

Note that bold, italic, and underline are all distinctly fontified in the header. However verbatim and code are not.

This becomes more relevant when viewing Org-mode buffers with emphasis markers hidden, with (setq org-hide-emphasis-markers t):

Now code and verbatim emphasis is not visible. I would rather that the foreground color of org-code and org-verbatim be given priority over the foreground color of org-level-1. How may I achieve this?

  Version Information:
  Org: Org mode version 9.2.3 (9.2.3-20-g31873e-elpa)
  Emacs: GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10)


texts:
To jump around in my init.el I used to do

(setq imenu-generic-expression '((nil ";; \\[ \\(.*\\)" 1)))

and then put markers in the file like so

;; [ my marker here

To call imenu i have a handy shortcut

(local-set-key (kbd "C-*") 'imenu)

This worked nice but does not anymore... Now i only get

user-error: No items suitable for an index found in this buffer

toggle-debug-on-error and removing user-error from ignored-debug-errors and calling imenu again gives me

Debugger entered--Lisp error: (user-error "No items suitable for an index found in this buffer")
  signal(user-error ("No items suitable for an index found in this buffer"))
  user-error("No items suitable for an index found in this buffer")
  imenu--make-index-alist()
  imenu-choose-buffer-index()
  byte-code("\300 C\207" [imenu-choose-buffer-index] 1)
  call-interactively(imenu nil nil)

My emacs version is 24.3.1. What am i doing wrong? How can i get the intended imenu behavior working the way i have had it?


texts: My emacs installation does not initialise

texts:
I don't know what happened but now I cannot initialise my emacs installation. emacs --debug-init gives this answer:

Debugger entered--Lisp error: (error "Unable to activate package ‘org-ac’.
Required package ‘auto-complete-pcmp-0.0.1’ is unavailable")
  signal(error ("Unable to activate package ‘org-ac’.\nRequired package ‘auto-complete-pcmp-0.0.1’ is unavailable"))
  error("Unable to activate package `%s'.\nRequired package `%s-%s' is unavailable" org-ac auto-complete-pcmp "0.0.1")
  package-activate-1([cl-struct-package-desc org-ac (20140302 413) "Some auto-complete sources for org-mode" ((auto-complete-pcmp (0 0 1)) (log4e (0 2 0)) (yaxception (0 1))) nil nil "/Users/sergiobacelar/.emacs.d/elpa/org-ac-20140302.413" ((:keywords "org" "completion") (:url . "https://github.com/aki2o/org-ac")) nil] nil deps)
  package-activate(org-ac)
  package-initialize()
  eval-buffer(#<buffer  *load*> nil "/Users/sergiobacelar/.emacs.d/init.el" nil t)  ; Reading at buffer position 403
  load-with-code-conversion("/Users/sergiobacelar/.emacs.d/init.el" "/Users/sergiobacelar/.emacs.d/init.el" t t)
  load("/Users/sergiobacelar/.emacs.d/init" t t)
  #[0 "\205\266   \306=\203\307\310Q\202? \311=\204\307\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB\323\202?\316\324\325\324\211#\210\324=\203e\326\327\330\307\331Q!\"\325\324\211#\210\324=\203d\210\203\247\332!\333\232\203\247\334!\211\335P\336!\203\201\211\202\214\336!\203\213\202\214\314\262\203\245\337\"\203\243\340\341#\210\342\343!\210\266\f?\205\264\314\325\344\324\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file is deprecated, please use `.emacs'" "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7]()
  command-line()
  normal-top-level()


texts: How to keep org from defining lset before every lstlisting?

texts:
The following code block,
#+NAME: fib-recur
#+CAPTION: Recursive Python function to calculate $n^{th}$ Fibonacci number.
#+BEGIN_src python :results output
def fib(n):
  if n == 0: return 0
  if n == 1: return 1
  return fib(n - 1) + fib(n - 2)
print(fib(20))
#+END_src

Translates to the following LaTeX code,
\lstset{language=Python,label= ,caption= ,captionpos=b,numbers=none}
\begin{lstlisting}
def fib(n):
  if n == 0: return 0
  if n == 1: return 1
  return fib(n - 1) + fib(n - 2)
print(fib(20))
\end{lstlisting}

Notice how it has used \lstset{...} right before the lstlisting environment? Is there a way to not do that? And instead pass the optional arguments using \begin{lstlisting}[language=Python]? And only those that are provided? I am using a LaTeX class that has some lstlisting styling defined by using \lset in the class .cls file. However, org's behaviour of defining a new \lset before each lstlisting overrides the class's definition, e. g., the class says \lstset{...,numbers=left,...} but org undesirably overrides it each time with \lstset{...,numbers=none}. To remedy that I have to add #+ATTR_LATEX: :options numbers=left to each code block.
Therefore, can we adjust  or only set the optional arguments provided and leave others alone?


texts: How to know when dired is done if called async?

texts: If I am copying files using dired having previously called (dired-async-mode) to make it copy asynchronously, how do I know when it has successfully finished copying the files?


texts: Running elisp within an orgmode code block

texts:
Consider the following elisp source code within a .org file:

#+BEGIN_SRC elisp :results silent
(delete-other-windows)
(split-window-right)
(switch-to-buffer-other-window '"*Python*")
#+END_SRC

This code is meant to delete all other windows, create a new window to the right (I work with 2 windows side by side), and then switch to that window and open an already running Python interpreter there.

It works if I go line by line and C-x C-e to evaluate the elisp code.
However, running the code block via C-c C-c in org mode does not produce the desired effect.

Question: Is it possible to modify that code block so that running it with C-c C-c produces the desired effect?


texts: Why does ^#.*#$ not capture recursively inserted files?

texts:
While considering some refactoring, I made changes throughout a project.

Halfway through the changes, and before saving, I found it doesn't quite work. I exited emacs and restarted. (That's probably not the right approach. There must be some kind of "ignore-all-changes-done-so-far" command I'm missing.)

Regardless, I now have many filename.ext that are left with a trail of #filename.ext#.

I recursively insert directories in dired-mode starting from the project root, and flag (%-d) all files of the regexp ^#.*#$ for deletion.

This expression only captures the files at the root of the hierarchy. Why, and how can I modify it to also catch all files inside the hierarchy?

Comparison

By way of comparison, marking (or flagging) all files of the pattern ^.*\.js$ does indeed catch all files, in both the root and in recursive directories. So why is ^#.*#$ not good?


texts: emacs start with eshell focused using .emacs config file

texts:
It's possible to start emacs with an eshell buffer focused using the -f flag as described in this question.

> emacs -nw -f "eshell"

I'm wondering if there's a way of launching eshell and focusing its buffer using just the .emacs file.

Using the following files, I've been able to start eshell automatically, but not to shift focus to its corresponding buffer, named *eshell* by default.

; .emacs.d/init.el
(eshell)

and

; .emacs.d/init.el
(eshell)
(switch-to-buffer "*eshell*)

Is there a way to switch focus to the eshell buffer from the .emacs file without using a command line argument?


texts: Org latex export is inconsistent with escaping curly braces

texts:
My issue is somewhat related to this question. I am trying to use the listings package's \lstinputlisting{path/to/code.py} command in orgmode (after setting up everything that needs to be set-up in order to use listings package).
Now, this did not happen in past and I did not update either Emacs or orgmode but all of the sudden the command \lstinputlisting{path/to/code.py} gets exported like this \lstinputlisting\{path/to/code.py\}. Obviously I can fix that with proper wrappings but I am using a custom latex class which has another macro that inserts images like this \fig{img0.png, img1.png}{caption}{label}. Now this command is exported verbatim without the braces being escaped.
What is causing this inconsistent behaviour? I am at Emacs 26.3 and Org mode version 9.4 (9.4-41-g9bb930-elpaplus @ [snip]/elpa/org-plus-contrib-20201116/)


texts: How can I define a key to cancel selection only when I selecting something?

texts:
How can I define a key to cancel selection
only when I'm selecting something? Because I use this key to do other thing in global-mode-map..
Is there any specific mode for mark and selecting something?
I just tried something like this but it didn't help.

(add-hook 'transient-mark-mode-hook
      (lambda()
        (local-set-key "a" 'deactivate-mark);;keyboard-quit also cant work
        (message "hello")
        )
      )


texts: Org: how to insert a skeleton with hierarchial list at the right level?

texts:
I have made a hierarchial list of headlines in skeleton, like this:

(define-skeleton myskel-list
"Insert claim block"  nil
"* Heading a\n"
"** Heading aa\n"
"* Heading b\n"
"** Heading bb\n"
)

I want to insert this skeleton inside a an allready existing headline hierarchy in such av way that the skeleton headings becomes subheadings at the pont I insert it.

Hence if my existing headline hierarchy look like this

* My book
** Chapter 1

and I insert my skeleton under "Chapter 1" the result should look like this

* My book
** Chapter 1
*** headline a\n
**** headline aa\n
*** headline b\n
**** headline bb\n

Hence, the levels in the skeleton (level 1 and 2) must be added the level of the insert point, in this case level 2, so that "heading a" ends on level 1+2=3, "heading aa" ends up at level 2+2=4, and so on.

So, how can I make a skeleton that add its heading levels to the heading level at the point I insert it? What must be changed in my skeleton code to accomplish this?

Thanks for any suggestings and help.


texts: How to disable confirmation for large files

texts:
When you recursively copy a large remote directory through Tramp, it will ask for confirmation for large files. Because of that, you can't leave the copy in the background, since the confirmation pauses the copy. And the "large file" size is something ridiculous, like 10MB.
How do I disable this? It really slows down the copy process.


texts: `use-package` with :config to set variables

texts:
I'm trying to use use-package to set up my org-mode initialization.  I have the following in my ~/.emacs file:

(use-package org-mode
  :mode "\\.org$"
  :ensure org
  :config
  (progn
    (setq org-log-done 'time)
    (setq org-confirm-babel-evaluate nil)
    (setq org-export-babel-evaluate nil)
    (setq org-html-validation-link nil)
    ;; ... more stuff
  )
)

None of that :config initialization stuff is getting run, though.  Do I have the package names wrong or something?  I get a bit confused on package names vs. ELPA names vs. invocation commands....


texts: How to increment number in every matching line?

texts:
[
  {
    "id": 0,
    "finished": 1,
    "orgn": 17
  },
  {
    "id": 1,
    "finished": 2,
    "orgn": 17
  },
  {
    "id": 2,
    "finished": 3,
    "orgn": 17
  },
  {
    "id": 3,
    "finished": 4,
    "orgn": 17
  }
]

I need to increment every field finished by 1

The result must be:

[
  {
    "id": 0,
    "finished": 2,
    "orgn": 17
  },
  {
    "id": 1,
    "finished": 3,
    "orgn": 17
  },
  {
    "id": 2,
    "finished": 4,
    "orgn": 17
  },
  {
    "id": 3,
    "finished": 5,
    "orgn": 17
  }
]


texts:
I'm experiencing a weird problem with Emacs on Windows where sometimes, after a while, the current buffer I'm in throws an error when attempting to save the file. I can't seem to reliably reproduce the issue (since when I first open the file, it saves fine and even for a few times after that), but after working on it for a while, suddenly I'll get an error when attempting to save the file. The only resolution is to restart Emacs; simply killing and re-opening the buffer has no effect. Turning on toggle-debug-on-error gives me the following:

Debugger entered--Lisp error: (file-error "Opening output file" "invalid argument" "c:/Users/sonictk/Git/experiments/opengl_test/main.cpp")
  write-region(nil nil "c:/Users/sonictk/Git/experiments/opengl_test/main.cpp" nil t "~/Git/experiments/opengl_test/main.cpp")
  basic-save-buffer-2()
  basic-save-buffer-1()
  basic-save-buffer()
  save-buffer(1)
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)

I'm not sure how to go about debugging this further since these seem to be built-in functions; could anyone provide any advice on how best I should proceed?

I tried turning on debug-on-entry for write-region for a file that doesn't seem to have the issue compared with a file that does, and I couldn't see any difference passed to the function calls

```
This works:

write-region(nil nil "c:/Users/sonictk/Git/experiments/opengl_test/shaders/vert.glsl" nil t "~/Git/experiments/opengl_test/shaders/vert.glsl")

Somehow, this doesn't, after a while:

write-region(nil nil "c:/Users/sonictk/Git/experiments/opengl_test/main.cpp" nil t "~/Git/experiments/opengl_test/main.cpp")
```

I can't understand it; what could be the issue?

UPDATE: As usual, I find the answer only after giving up after a few hours and posting on the interwebs; turns out irony-mode was keeping an open file handle to the file in question for some reason which prevented anything (not just Emacs) from overwriting the file. Now I just have to figure out why irony is behaving the way it is only with this file in particular.


texts: Why are double quotes not escaped in the replace-regexp command?

texts:
I have text like this:

myvariable = ABCD,
EFGH,
IJKL,
~subsection1
MNOP,
QRST,
UVWX,
YZ

Which I want to transform to:

myvariable = "ABCD,"
"EFGH,\n" \
"IJKL,\n" \
"~subsection1\n" \
"MNOP,\n" \
"QRST,\n" \
"UVWX,\n" \
"YZ"

To insert a " character at the beginning of each line I do the following:

C-M-% ^.* RET "\& RET

But appending \n" \ at the end of each line is trickier. I tried:

M-x replace-regexp RET $ RET \\n\\" \\ RET

But that results in:

myvariable = ABCD,\n\" \
EFGH,\n" \
...

So you have to do it this way:

M-x replace-regexp RET $ RET \\n" \\ RET

Why?

My thinking was that the " character had to be escaped with \, but that's obviously not the case. Why do I have to escape \ but not "?


texts: browse-url-browser-function for Firefox Quantum

texts:
browse-url-firefox does not work with Firefox Quantum.

If Firefox Quantum is already running, then I am told:

  Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.

If Firefox Quantum is not running yet, then the url is opened in the old Firefox version, which I apparently still have installed.

Does anyone know of a new implementation that does? Or knows enough about the new interface to implement it?


texts:
Elpy has support for running test using your test runner.

Looking at anaconda it does not seem to do the same functionality is there a package that can detect all your tests and let you run them individually using anaconda mode ?

I am looking for a way I can also customise this on a per project bases using dir-locals as the tests will actually need to run inside a container.


texts:
When I increase the default font size (say, from Menlo 12 to 14), either by Options->Set Default Font or by (set-face-attribute 'default nil :height 140), the top of the buffer becomes hidden. The visible part of the buffer starts a few lines down (depending on font size) and the actual top is hidden above the top of the window. I can move the cursor up to the top of the buffer, but it disappears above the window. M-x beginning-of-buffer doesn't help. If I lower the font size, it becomes visible again.

Emacs 24.5 (9.0) on OS X Yosemite (10.10.5)


texts:
I'm new to emacs/LISP and would like guidance how to achieve the following output

I'd like to type
"color glass hat sport" in a single string ($1) that will be converted to the following:

Color = "C"
Glass = "G"
Hat   = "H"
Sport = "S"

_CATEGORIES = (
    (Color, 'Colors'), (Glass, 'Glasses'), (Hat, 'Hats'), (Sport, 'Sports'),
)

How to achieve that with YAS Snippets?


texts: How to automatically kill a shell buffer when the shell process exits

texts:
In shell-mode when you exit the shell process (e.g. by typing exit) the buffer still hangs around (with the message "Process shell<1> finished").

How can I automatically kill the shell buffer when the shell process exits?

(1) Is there a package available for this?

(2) How do I write the correct piece of function advice for it? Noticing that 'shell-write-history-on-exit is called on exit I tried:

(defun leo-kill-shell-buffer-on-exit ()
  (kill-buffer))

(advice-add 'shell-write-history-on-exit :after #'leo-kill-shell-buffer-on-exit)

but nothing happens. What's going wrong?


texts: How to validate nested xml namespaces with associated schemata in nxml?

texts:
I often use emacs to edit oozie workflow/coordinator definitions and nxml mode is pretty handy for that. I never bothered much to get more than basic xml validation since schema-based validation seemed too complex to set up for me. But it turns out once I figured how to convert the provided xsd schemas to rnc (with the help of http://debeissat.nicolas.free.fr/XSDtoRNG.php and trang and some hand editing) it's actually quite easy by adding the correct path to the schema.xml.

E.g. I can add this line

<namespace ns="uri:oozie:workflow:0.1" uri="workflow-0.1.rnc"/>

and so every xml which has the xmlns attribute uri:oozie:workflow:0.1 gets validated with the workflow-0.1.rnc schema. The sad thing is that this is only working for root elements, but oozie supports "Actions Extensions" with its one namespace and schema. E.g.

[...]
<action name="sendFailureEmail">
    <email xmlns="uri:oozie:email-action:0.1">
        <to>${toEmailAlias}</to>
        <subject>...</subject>
        <body>...</body>
    </email>
    <ok to="fail"/>
    <error to="fail"/>
</action>
[...]

All three subelements of email (to, subject and body) are marked as "invalid" in nxml because they are not specified in the workflow-0.1.rnc schema. I also generated the rnc version of the email-action schema and put in

<namespace ns="uri:oozie:email-action:0.1" uri="email-action-0.1.rnc"/>

into my schema.xml but that doesn't help since it only applies for root elements.

Is there an easy way to get nxml to recognize nested namespaces for validation or is this simply an unsupported feature?


texts: Syncing changes on a tangled file back to the original org file

texts:
I am using org-mode with fountain mode to write a screenplay.

Org for organization and fountain for screenplay formatting.

This is the code I use for this purpose :

Settings for working with (fountain) source blocks in org.

;; prevent org from messing with indentation of the source text.
(setq org-src-preserve-indentation t)
(setq org-edit-src-content-indentation 0)

;; open the buffer for editing fountain in another window.
(setq org-src-window-setup (quote reorganize-frame))

;; prevent a message in the edit buffer from being shown.
(setq org-edit-src-persistent-message nil)

;; save edits in the fountain buffer to the org buffer after x sec
(setq org-edit-src-auto-save-idle-delay 1)

For example :

Act 1

** SQ 1

*** Scene 1

Bunch of text related to the scene and what the characters are doing and everything that I need to know but will never end up in the screenplay.

BEGIN_SRC fountain

screenplay text

END_SRC

Now I C-c ' and it opens the above in a new buffer and I can take it up from there.

The problem with my current set up is that it doesn't let me see the screenplay text in its entirety.

I have around 50+ such blocks and I'd like to achieve the following :

I want org to export all fountain blocks to a specific file, say fountain-screenplay. That way I have a single file with the screenplay only.

Have all edits synced with the org file. If I edit anything in fountain-screenplay, the source block in org should update the change and vice-versa.

To do this, I inserted the following properties in my org file :

:PROPERTIES:
:file: "~/files/fountain-screenplay.fountain"
:cache: yes
:comments: yes
:tangle: yes
:results: silent
:END:

When I C-c C-c it returns with an error saying that No org-babel execute function found.

And when I C-c C-v t it says 0 blocks tangled.

Is my approach incorrect or am I missing something?

Edit : I changed the properties to :

#+properties :file .fountain :cache yes and so on

and when I C-c C-v t it tangles the source blocks to a filename.fountain. Now the sync part remains to be solved.


texts: How do I use an advice to change the definition of goto-char within a function?

texts:
Suppose a third-party plugin contains the following function:
(defun example-function ()
  (interactive)
  ;; ... do many things ...
  (goto-char (point-max))
  ;; ... do many things ...
  (goto-char (point-max))
  ;; ... do many things ...
  (goto-char (point-max)))

The function uses goto-char in various places in its body.
I want to change the behavior of the function such that every time it calls (goto-char (point-max)), it will also call (recenter -1). To that end, I added this advice to redefine the calls to goto-char:
(advice-add 'example-function
            :around
            (lambda (orig-fun &rest args)
              (cl-labels ((goto-char (pos)
                            (goto-char pos)
                            (recenter -1)))
                (apply orig-fun args))))

However, the cl-labels appears to have no effect; goto-char still retains its old behavior inside example-function. What is wrong with the advice?
(Emacs version: GNU Emacs 25.2)


texts:
With cursor in row 2, col 3

| a | b | c  |
| 1 | 2 | 3 _|

Pressing <TAB> creates a new row:

| a | b | c |
| 1 | 2 | 3 |
|   |   |   |

Type more than one character and press tab. Vertical bars have been removed from rows 1 and 2:

This isn't the expected behaviour, is it?

Oddly, when I copy and paste from the file into this editor, the bars appear as expected.
Spacemacs version:
0.200.10@25.1.1 (spacemacs)

Org mode version 9.1.5 (9.1.5-1-gb3ddb0-elpaplus @
/home/sweidman/.emacs.d/elpa/org-plus-contrib-20171225/)

I tried switching fonts from Source Code Pro to Ubuntu Mono but the
problem persisted.

When I start emacs with "emacs -Q", the problem disappears using org-mode:
Org-mode version 8.2.10 (release_8.2.10 @ /usr/local/share/emacs/25.1/lisp/org/)

If I close and re-open the file, the table appears correctly formatted.


texts: How do I exit an archive in no-window mode?

texts:
When navigating the directory structure in no window mode, there is always .. at the top of the current directory, so that one can leave it and go to the directory up ahead.

I am using emacs 26.3 and when I enter a zip archive, I see no way of leaving the archive other exiting emacs using C-x C-c.

How do I leave the archive properly, so that I end up back in the directory where the archive is stored?


texts:
There is an eval-when-compile macro but, AFAICT, no eval-when-not-compiling or load-time-only, that would be very convenient for me now. Do you know any generic workaround?

Why do I need this: I have a package with (eval-when-compile (load "other-package")) and, in this other package, some initialisation code that is for load time only. That the code is for load time only is understood implicitly when the other-package itself is compiled, but not when it is loaded as part of compiling something else.


texts: How do I end an org capture template with whitespace?

texts:
I want to make an org capture template that ends in whitespace. Specifically, I want to make TODOs that are scheduled. From emacs -Q, I'm starting with this template:

(cl-pushnew '("T" "TODO scheduled later" entry (file "~/org/todo.org")
              "* TODO %?\nSCHEDULED: ")
            org-capture-templates :test #'equal)

But this template ends up with this text (I'll add pipe characters at the end of the line to indicate my issue):

* TODO |
SCHEDULED:|

I want there to be a space as the last character of the template, so the TODOs can be formatted the same way the function #'org-todo formats lines. How can I make this happen?


texts: How can I quit ediff immediately without having to type 'y'

texts: When I quit ediff with q I get asked if I really want to quit. I'd rather it quit immediately. There is nothing obvious under customization. There is a solution here which seems to work by redefining the q key, but I'm not sure of the details of how the function works. What's the simplest way to get quit to really mean quit?


texts: elfeed and emacs 27: elfeed-db-load: Wrong type argument

texts:
After upgrading to emacs 27 with

brew install emacs --HEAD

When starting elfeed with

C-x w

I get

elfeed-db-load: Wrong type argument: avl-tree-, [cl-struct-avl-tree- [[[[[[[[[[[[[nil nil ... 0] [nil nil ... 0]\
 ... 0] [[nil nil ... 0] [nil nil ... 0] ... 0] ... 0] [[[nil nil ... 0] [nil nil ... 0] ... 0] [nil [nil nil ..\
. 0] ... 1] ... 0] ... 0] [[[[nil nil ... 0] nil ... -1] [[nil nil ... 0] [nil nil ... 0] ... 0] ... 0] [[[nil n\
il ... 0] [nil nil ... 0] ... 0] [[nil nil ... 0]
...   -1] nil nil 0] elfeed-db-compare]

Any ideas how to make elfeed work? This used to work in emacs 25


texts:
How can I make Emacs function 'browse-url-at-point work on a tablet running Android?

Following advice I found at "http://endlessparentheses.com/running-emacs-on-android.html" I installed 'Termux and 'Hacker's keyboard on my Android tablet, started 'Termux and ran:

apt update
apt install emacs

I then started emacs.  In the Emacs scratch buffer I wrote "http://www.google.com" and invoked 'browse-url-at-point.  It said "No usable browser found".

I did some investigating of this subject on the Internet, but so far have found nothing helpful.

The table is a HP Touchpad running Android 5.1.1 via CyanogenMod version "12.1-20160109-SNAPSOT-jcsullins-tenderloin.

Added after reading the comment by Jack, and further investigation:

For a while I thought that turning on root access on my HP Touchpad (running CyogenMod Android 12) and using command "su" was necessary, but someone referred me to "termux-open-url" and its source code suggested to me to add "--user 0" to what Jack suggested.  My first test was to run the command

am start --user 0 -a android.intent.action.VIEW -d http://www.google.com

in the Termux terminal window.  That worked.  I then started up Emacs inside Termux and issued the same command inside the shell buffer.  That also worked.


texts: Can I merge the buffers opened in one emacs process into the other emacs process?

texts:
In bash in a terminal emulator, I run two independent emacs processes.
I created them in bash by emacs -nw and in each, I opened several buffers.

I switch between them by making one process into background via Ctrl-Z and then making the other into forground via fg <jobid>.

Since switching between them is inconvenient, is it possible to merge the buffers opened in one emacs process into the other emacs process?

Thanks.


texts: The correct way to declare common vars in babel

texts:
I'm playing with the idea of "literate devops" with org-mode. To simplify scripts i've extracted common values into :PROPERTIES: drawer, which looks like this:

* Scripts
** Subscripts-A
*** Subscrtips-B
:PROPERTIES:
:header-args: :dir ./folder
:header-args: :results output
:header-args: :var NAME='Alex'
:END:

#+BEGIN_SRC zsh
pwd
echo "NAME:" $NAME
#+END_SRC

The snippet above produces the following output:

#+RESULTS:
: /Users/4lex1v/folder
: NAME:

So ':var' arguments are ignored, while :dir and :results are fine, am i doing something wrong?


texts:
In general I have keybindings as follows:

(define-key isearch-mode-map (kbd "C-h") 'isearch-del-char)

Now I want to generate a keybinding for C-= (Control plus equal sign, which is next to Backspace on my keyboard); where it does not work.

Is it possible to do it?


texts: Helm would not show line previews if used regexp

texts:
When I use regular expressions in helm occur for narrowing, it does not show line previews

Is this normal functioning? If so, are there any workarounds?

Update:

I found out that the error only occurs when I use white characters in a set.


texts:
I want to capture a journal entry several times a day.  Here was my initial solution:
(setq org-capture-templates '(("w" "Weekly" item
                               (file+olp+datetree "/home/joe/org-files/goodtime.org")
                               "%?" :tree-type week)))

(mapc
 (lambda (slot)
   (run-at-time slot
                (* 60 60 24) ; repeat each day at the same time if Emacs is still running
                (lambda ()
                  (interactive)
                  (org-capture nil "w")
                  (insert (format-time-string "%-H:%M " nil t)))))
 '("09:00am" "12:00pm" "3:00pm" "6:00pm" "9:00pm"))

This seems to work as expected if I start Emacs before 9AM.
However, if I start Emacs later than that, the Org Capture runs immediately, once for each time of day that has been missed. I see now that this is explained in the answer here: Is it possible to execute a function or command at a specific time?
The problem is that I want to run the task exactly at the times mentioned, not potentially at some other time.
Thinking out loud, one solution would be to write in an explicit conditional that takes note of the time when Emacs starts, checks whether that was within the last 24 hours, and runs the capture event or not as required.  This seems pretty heavy for a one-off solution, and I wonder if actually run-at-time should be patched?

Before trying to do this with run-at-time I tried to use emacsclient inside of a cron job, but that didn't work for me.  The script runs on its own, but I wasn't able to get it to work from within cron, which apparently doesn't play nicely with interactive "desktop" jobs.


texts: Archiving completed tasks to an archive file based on the current date in org-mode

texts:
Suppose I have an archive/ folder, which contains several .org_archive files, each for a specific month.

When I archive a task in org-mode, is there a way to make it so that the task is automatically archived to the appropriate archive file, based on the current month?

For example, if I complete a task on 07/31/2016, archiving the task should move it to archive/archive-201607.org_archive. The next day, on 08/01/2016, archiving another task should move it to archive/archive-201608.org_archive. If the appropriate file for the month doesn't exist, org-mode should create one.


texts: Ignoring specific files in recentf-mode by their exact filenames

texts:
I am having trouble to Ignoring specific files in recentf-mode.

  (add-to-list 'recentf-exclude "company-statistics-cache.el")

On my end, I want to ignore them by their exact file names instead of their file paths.

The filenames I want to ignore are:

__init__.py
*Find*
*.py (This this actually a filename that emergess)
All files staring with flycheck_: flycheck_*.py

and if possible any file that has size of 0, which has Fundamental mode.

I have come up with following, which does not work, I am not sure where I am doing wrong:

(recentf-mode 1)
(setq recentf-exclude '("\\__init__.py\\'"
                        "*Find*'"
                        "\\*.py\\'"
                        "flycheck_*.py\\'"
                        ))
(setq recentf-max-menu-items 25)
(setq recentf-max-saved-items 25)


texts:
I am trying to setup like the following in the top section of my .org file. But it does not work, all the parameters are not passed into the subsequent R code blocks.

 #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes

Doing like the following works. But it forces every code block to have :file parameter set. I don't want that because I have some code blocks which do not have graphic output.

#+PROPERTY: session *R*
#+PROPERTY: cache yes
#+PROPERTY: results graphics
#+PROPERTY: exports both
#+PROPERTY: tangle yes

How do I setup this? I prefer one-liner setup like "+BABEL:...." and customize the code blocks that I want differently.


texts: How go to Emacs lisp source function from my custom elisp file?

texts:
Windows 10, Emacs 25.1.
Path to Emacs: d:\Programs\emacs

I write on Elisp. And very ofter I want by any key press go to Emacs lisp function.
E.g.
Here snippet of my elisp file:

(setq line (buffer-substring (point) (point-at-eol)))

I want when cursor is over function "buffer-substring" and press some key combination go to source file of this function.
When I try M-.  It's not jump to source file, but prompt me.

Here screenshot:

How I can do this?


texts: Bind C-e C-j and C-a C-o TAB to single key, aka insert and jump to newline

texts:
C-e C-j will insert a newline below and jump to it indented.
C-a C-o TAB will insert a newline above and jump to it indented.

Is there a single bind to these or where/how should I bind these commands?


texts: When opening "/tmp/foo.html", don't prompt for Document Title

texts:
If I do "ctrl-x ctrl-f /tmp/foo.html" (where /tmp/foo.html doesn't exist), emacs prompts me for "Document Title:"

How do I turn off this behavior (which I'm guessing is an html-mode hook of some sort).

Apologies if this question is too simple for this site.


texts: pop-up a list of enabled minor modes in a readable format?

texts:
I like to keep my modeline pretty minimal, so I'm hiding most minor-mode lighters. Occasionally I want to check which minor-modes are enabled, and it would be nice if I could trigger a pop-up that listed them and that I could easily dismiss with q or ESC. I'm imagining an interface like which-key uses.

I know about C-h m, but I'm looking for a solution that looks less like,

Enabled minor modes: Async-Bytecomp-Package Auto-Composition
Auto-Compression Auto-Encryption Auto-Revert Buffer-Face Column-Number
Delete-Selection Diff-Auto-Refine Drag-Stuff-Global Electric-Indent
Electric-Pair Evil Evil-Commentary Evil-Local File-Name-Shadow
Font-Lock Global-Eldoc Global-Font-Lock Global-Git-Commit

and more like

Async-Bytecomp-Package    Delete-Selection     Evil-Local
Auto-Composition          Diff-Auto-Refine     File-Name-Shadow
Auto-Compression          Drag-Stuff-Global    Font-Lock
Auto-Encryption           Electric-Indent      Global-Eldoc
Auto-Revert               Electric-Pair        Global-Font-Lock
Buffer-Face               Evil                 Global-Git-Commit
Column-Number             Evil-Commentary

I also don't need all the extra info that C-h m presents (keybindings, descriptions, etc.). Plus C-h m forces me to switch to it's newly opened window before I can kill it.

Does anyone know of a package that does something like this?


texts: What's a good setup for integrating magit with evil mode?

texts:
I'm trying to set up magit to work nicely with evil mode. Ideally I'd be able to open the magit-status-mode buffer in normal mode and be able to stage/commit from that buffer with vim-like keybindings.

To open magit-status in normal mode, I have the following:

(evil-set-initial-state 'magit-status-mode 'normal)
(evil-define-key 'normal magit-status-mode-map
  "j" 'magit-goto-next-section
  "k" 'magit-goto-previous-section)

Is there a way to add keybindings to this map for staging/committing files?    Or a better way to accomplish my stated goal above than this approach altogether?


texts: Remove multiple blank lines in a buffer, leave one

texts:
I'd like to take a buffer which looks like this:
one

two
three

four

five

And turn it into this
one

two
three

four

five

I've tried using delete-blank-line, however, it will only effect the area around the cursor, and I'd like to do the whole buffer (or at least the whole region).  I've also tried various permutation of replace-regexp but I have not been able to find a regexp that works.


texts: When are org-mode attachments preferable to file hyperlinks?

texts: As far as I can tell, org-mode attachments solve the same problem as do file hyperlinks but in a clunkier way. In what situations would attachments be the superior solution?


texts: I want to expand abbrev when I type two spaces instead of one. Is there any way to do it? Simply adding a space to the abbrev pattern doesn't work -- the abbrev is still expanded on the first space.


texts: Converting a Scheme function to Emacs Lisp

texts:
I am taking efforts to rephrase an example from SICP

 #+BEGIN_SRC scheme
(define (average-damp f)
  (lambda (x) (average x (f x))))
(define (average x y)
  (/ (+ x y) 2))
(define (square x)
  (* x x))
((average-damp square) 10)
#+END_SRC

#+RESULTS:
: 55

After spent hours on it and got

(defun average-damp (f)
  (lambda (x) (average x (funcall f x))))

(defun average (x y)
  ;; Keep the float
  (/ (+ x y) 2.0))

(defun square (x)
  (* x x))

(funcall #'(average-damp 'square) 10)

Still report error invalid function, yet I am lost

Could you please provide any hints?


texts: AUCTeX's TeX-complete-symbol with flyspell

texts:
I'm trying to make use of the autocomplete facilities of AUCTeX using M-TAB (actually, through the equivalent binding C-M-i), but apparently, when using flyspell-mode alongside with LaTeX-mode the flyspell command flyspell-auto-correct-word overrides TeX-complete-symbol.

So, if I try the AUCTeX manual's example \renewc, with dictionary set to en_US, when pressing C-M-i, I get the following sequence:

  \renew -> \renews -> \renew c -> \Rene -> \Corene -> \newcomer -> \crewmen and so on

With plain ispell it works as expected, but I'd like to keep flyspell if possible.

Any suggestions to get around this?


texts: Gnus required an updated Google password and now will not send messages

texts:
emacs 25 on linux Debian;
On a running computer which had been largely ignored for a couple of years,
I loaded gnus and was prompted for my google password.  I updated my google
password, entered it, but gnus would not send mail. Same with the gnus on
my main desktop.
on main desktop
:~$ less .authinfo
machine smtp.gmail.com login imputerate@gmail.com
password "ictcysxurcxqzjol" port 587
no "authinfo" mentioned in .emacs
BUT in .gnus.el
(setq user-mail-address "imputerate@gmail.com")
(setq user-full-name "peter hodgson")
(load-library "smtpmail")
(load-library "starttls")
(setq gnutls-min-prime-bits 2048)  ;;recent glitch reduced them to 256)
(setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-default-smtp-server "smtp.gmail.com"
send-mail-function 'smtpmail-send-it
  smtpmail-stream-type  'starttls
  message-send-mail-function 'smtpmail-send-it
  smtpmail-smtp-service 587
  smtpmail-auth-credentials "~/.authinfo")

error messages when i try to send an email-
"250 SMTPUTF8
AUTH PLAIN
535-5.7.8 Username and Password not
accepted. Learn more at
535 5.7.8
https://support.google.com/mail/?p=BadCredentials e8sm365299oti.76 - gsmtp
QUIT
221 2.0.0 closing connection e8sm365299oti.76 - gsmtp
Process smtpmail connection broken by remote peer"


texts: git commit on the command line: how to use magit for editing the commit message?

texts: In most cases, if Emacs is used to edit a file in a git repository, it is advisable to commit within Emacs and use magit to write the commit message. However, if Emacs is not used to edit the files (such as only git mv on the command line is used to move files around, or maybe just adding some image files), what should the config of git and Emacs be such that the correct magit mode is turned on when Emacs was fired up to edit the commit message, instead of the default plain text mode?


texts: Color for important entry in global TODO list

texts:
In Org Agenda, I use Org priorities to know when I should get on something (A=now, B=soon or C=later).

I use :STYLE: property with a custom  important value for some entries (no matter when I need to do it).

I would like to color the line for such entries in the global TODO list in the agenda buffer.

I see no help in :STYLE: habit related customization.

How could I do that?


texts:
I was reading through:

Spacemacs Colors Layer

because I want to get nyan-mode working using the hot keys SPC t m n as shown on Github.

I was able to do this part:

To use this configuration layer, add it to your ~/.spacemacs. You
will need to add **colors** to the existing dotspacemacs-configuration-
layers list in this file.

However I do not understand how to enable it.

where does

(setq-default dotspacemacs-configuration-layers '(
  (colors :variables colors-enable-nyan-cat-progress-bar t)))

go? I see nothing in my .spacemacs for it or am I missing how to do this completely?


texts: How to loop over keymaps and assign keys?

texts:
If I have a key binding I want to apply to multiple keymaps, for example.
(evil-define-key 'visual c-mode-map (kbd "C-M-?") 'c-comment-from-c++)
(evil-define-key 'visual c++-mode-map (kbd "C-M-?") 'c-comment-from-c++)
(evil-define-key 'visual glsl-mode-map (kbd "C-M-?") 'c-comment-from-c++)

I tried putting the keymaps into a list and calling evil-define-key with each but it didn't work.
eg:
(dolist (this-map (list c-mode-map c++-mode-map glsl-mode-map))
  (evil-define-key 'visual this-map (kbd "C-M-?") 'c-comment-from-c++))

Is this possible?


texts: How to add a directory to :scope options in clock report?

texts: I have a common file to track the time logged in multiple files across various directories. Manually adding files to :scope becomes tedious very quickly. How can I automatically add all the files in a given directory?


texts: `Ido-completing-read` word by word in the minibuffer

texts:
I'd like to use something like ido-completing-read in the minibuffer, but on a per-word basis. Here is an example. If I provide a list ("tag:important " "tag:work" "subject" "from"), I'd like to be able to type any word, but each time a word match (fuzzyly) some elements of the list, I can select it using the TAB key, and continue typing until I'm happy and I type enter.

Demo: (the proposed words are in {}, the typed text is on the left part, each line is a key-strock after the last one):

Beginning, empty line

{tag:important |tag:work |subject|from}

Type "tag", the useless proposition are removed:

tag{tag:important |tag:work}

Type "liatelle", nothing match this word so nothing is proposed...

tagliatelle{}

... until I press space an start a new word:

tagliatelle {tag:important |tag:work |subject|from}

continue to type "AND tag":

tagliatelle AND tag{tag:important |tag:work}

now I press TAB to validate the first proposition (or cycle with C-s)

tagliatelle AND tag[TAB]{tag:important |tag:work}

the first proposition is took:

tagliatelle AND tag:important {tag:important |tag:work |subject|from}

Finally, type "ENTER" to validate: the output is tagliatelle AND tag:important

Thank you!


texts:
Is it possible to set up org-todo-list to group TODOs under headers as they are  in my org-mode file?

Example org file structure:

* Project Name A
 ** TODOs
  *** TODO item 1
  *** TODO item 2
  *** TODO item 3
* Project Name B
 ** TODOs
   *** TODO item 1
   *** TODO item 2
   *** TODO item 3

And then in my org-agenda-list view it would show the todo's listed under their respective project names.  Could even have the "TODO" headings on there too, if there's not an easy way around that.

Edit: Just discovered org-todo-tree, which gets me pretty close.


texts: lose reftex-isearch-minor-mode after refresh

texts:
I want to activate reftex-isearch-minor-mode and tried the solution in this post offered by giordano,
(add-hook 'TeX-mode-hook (lambda () (reftex-isearch-minor-mode))) ; for AUCTeX

it works when I first open .tex file on emacs, but the minor mode will be lost, and the multi-search mode becomes the usual search mode after either C-c C-n or revert buffer.
How can I keep the reftex-isearch-minor-mode when I do the refreshing? Many thanks!
My AUCTeX version is 11.90.2, emacs version is 24.5.2


texts: How to change the checkbox list appearance in Org mode

texts:
My checkbox list appears as shown below

I would like to have it like this.

As you can see the number of digits for the numbered list is two, starting at 01.

I do not see an opportunity where we might need 001, so 01 should be good.


texts: How can I prevent `C-s` from invoking I-search while using Smex?

texts:
While using M-x ; by default C-s was binding to next line so I used to keep pressing C-s to toggle around. When I start using smex, C-s is now it is bound to I-search in some cases as follows:
M-x than type package and press TAB two times and press C-s two times and I-search:  [No previous search string] message will show up.
Is it possible disable I-search and I-search backward: during usage of smex, where C-s and C-r would be bound to nil.
my setup:
(setq smex-save-file "~/.emacs.d/settings/smex-items")
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)

(eval-after-load 'smex
  `(defun smex-prepare-ido-bindings ()
     (define-key ido-completion-map (kbd "TAB") 'minibuffer-complete)
     (define-key ido-completion-map (kbd "C-,") 'smex-describe-function)
     (define-key ido-completion-map (kbd "C-w") 'smex-where-is)
     (define-key ido-completion-map (kbd "C-.") 'smex-find-function)
     (define-key ido-completion-map (kbd "C-a") 'move-beginning-of-line)
     (define-key ido-completion-map (kbd "C-p") 'previous-history-element)
     ;;
     (define-key ido-completion-map (kbd "C-e") 'end-of-visual-line)
     (define-key ido-completion-map (kbd "C-r") 'end-of-visual-line)
     (define-key ido-completion-map (kbd "C-s") 'end-of-visual-line)
     ))