emacs,autocomplete , How to enable electric-pair-mode in emacs 24

How to enable electric-pair-mode in emacs 24


Tag: emacs,autocomplete

I have enabled electric pair mode according to instructions on this page: http://ergoemacs.org/emacs/emacs_insert_brackets_by_pair.html , i.e. adding these lines to ~/.emacs:

;; autocomplete paired brackets
(electric-pair-mode 1)

But this doesn't take any effect, I still have to M-x electric-pair-mode to activate it. Why is this happening?

Emacs version is 24.3, on Mac OSX.

Here is my entire ~/.emacs

;; set up package-archives
(require 'package)
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-archives (quote (("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))))
 '(py-shell-name "python3")
 '(py-split-windows-on-execute-function (quote split-window-horizontally))
 '(scroll-bar-mode nil)
 '(send-mail-function (quote mailclient-send-it))
 '(tool-bar-mode nil)
 '(truncate-lines t))
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "DejaVu Sans Mono for Powerline" :foundry "unknown" :slant normal :weight normal :height 120 :width normal))))
 '(cursor ((t (:background "light gray" :foreground "pale green")))))

;;;;;;;;;;;; ESS settings ;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'ess-site)
(ess-toggle-underscore nil)
(setq ess-history-file nil)
(setq ess-help-kill-bogus-buffers t)
      ac-auto-show-menu 0
      ac-candidate-limit nil
      ac-delay 0.1
      ac-disable-faces (quote (font-lock-comment-face font-lock-doc-face))
      ac-ignore-case 'smart
      ac-menu-height 10
      ac-quick-help-delay 111.5
      ac-quick-help-prefer-pos-tip t
      ac-use-quick-help nil

(add-hook 'ess-mode-hook
          (lambda ()
            (ess-set-style 'C++ 'quiet)
            (add-hook 'local-write-file-hooks
                      (lambda ()
(setq ess-nuke-trailing-whitespace-p 'ask)
;; or even
;; (setq ess-nuke-trailing-whitespace-p t)
;; do not ask for working dir
(setq ess-ask-for-ess-directory nil)
;; always split side by side
(defun forbid-vertical-split ()
  "Only permit horizontal window splits."
  (setq-local split-height-threshold nil)
  (setq-local split-width-threshold 0))
(add-hook 'ess-mode-hook
;; Let the ESS R console automatically scroll!
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)
(define-key comint-mode-map [C-up] 'comint-previous-matching-input-from-input)
(define-key comint-mode-map [C-down] 'comint-next-matching-input-from-input)
; (define-key ess-mode-map (kbd "C-c d") 'comment-region)
; (define-key ess-mode-map (kbd "C-c u") 'uncomment-region)
;; (define-key ess-mode-map (kbd "C-S-e") 'comment-region)
;; (define-key ess-mode-map (kbd "C-S-d") 'uncomment-region)
;; ESS Mode (.R file)
  (define-key ess-mode-map "\C-l" 'ess-eval-line-and-step)
  (define-key ess-mode-map "\C-p" 'ess-eval-function-or-paragraph-and-step)
  (define-key ess-mode-map "\C-r" 'ess-eval-region)
;; use this one if each help window goes to a new frame
(setq ess-help-own-frame t)
;; use this one if you want all help windows into one frame!
(setq ess-help-own-frame 'one)
;;;;;;;;;;;; ESS settings ;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;; Perl settings ;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'perl-mode-hook
          (lambda () (setq perl-indent-level 4)))
;;;;;;;;;;;; Perl settings ;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;; evil copied to osx ;;;;;;;;;;;;;;;;;;;;;;;;;
;; evil and its plugins (ports from vim, or not?)
(require 'evil)
(evil-mode 1)
;; evil nerd commenter
;;;;;;;;;;;; evil copied to osx ;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;; settings copied to osx ;;;;;;;;;;;;;;;;;;;;;;;;;
;; shift width set to 4
(setq c-basic-offset 4)
(setq-default tab-width 4)

;; autocomplete globally
(require 'auto-complete)
(defun auto-complete-mode-maybe ()
  "I do not want MAYBE, I want real autocomplete!"
  (auto-complete-mode 1))
(global-auto-complete-mode t)

;; only show one window when start up
(add-hook 'emacs-startup-hook 'delete-other-windows)

;; no backup ~n~ nonsense please
(setq make-backup-files nil)
(setq auto-save-default nil)
;; no startup logo and message
(setq inhibit-startup-echo-area-message t)
(setq inhibit-startup-message t)
;; solarized theme
(load-theme 'solarized-dark t)
;;;;;;;;;;;; settings copied to osx ;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;; python stuff copied to osx ;;;;;;;;;;;;;;;;;;;;;;;;;
;; Standard Jedi.el setting
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:setup-keys t)
(setq jedi:complete-on-dot t)

(require 'python-mode)
(add-to-list 'auto-mode-alist '("\.py\'" . python-mode))

;; send line to python console
(require 'python-mode)
(defun py-execute-line-down ()
  "execute python line and move cursor down"
  (forward-line 1))
(define-key python-mode-map (kbd "C-c j") 'py-execute-line-down)
;;;;;;;;;;;; python stuff copied to osx ;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;; buffer/win management stuff ;;;;;;;;;;;;;;;;;;;;;;;;;
;; easy buffer switch
(require 'ido)
(ido-mode 'buffers) ;; only use this line to turn off ido for file names!
(setq ido-ignore-buffers '("^ " "*Completions*" "*Shell Command Output*"
               "*Messages*" "Async Shell Command"))

; use meta + arrow keys to switch between visible windows
;; handy in split views
(require 'windmove)
(windmove-default-keybindings 'meta)
;; automatically save buffers associated with files on buffer switch
;; and on windows switch
(defadvice switch-to-buffer (before save-buffer-now activate)
  (when buffer-file-name (save-buffer)))
(defadvice other-window (before other-window-now activate)
  (when buffer-file-name (save-buffer)))
(defadvice windmove-up (before other-window-now activate)
  (when buffer-file-name (save-buffer)))
(defadvice windmove-down (before other-window-now activate)
  (when buffer-file-name (save-buffer)))
(defadvice windmove-left (before other-window-now activate)
  (when buffer-file-name (save-buffer)))
(defadvice windmove-right (before other-window-now activate)
  (when buffer-file-name (save-buffer)))
;;;;;;;;;;;; buffer/win management stuff ;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;; misc ;;;;;;;;;;;;;;;;;;;;;;;
;; enable clipboard
(setq x-select-enable-clipboard t)
;; disable parentheses highlighting
(setq blink-matching-paren nil)
;; autocomplete paired brackets
(electric-pair-mode 1)
(global-set-key [C-tab] 'other-window)
;; tramp mode for editing through ssh
(setq tramp-default-method "ssh")
;;;;;;;;;;;; misc ;;;;;;;;;;;;;;;;;;;;;;;

;; probably a good idea to keep this at the very end!!
(setq server-socket-dir "~/.emacs.d/server")


My crystal ball tells me there's an error in your ~/.emacs file which prevents Emacs from reading/processing it to the end. Try

emacs --debug-init


Emacs code hints in minibuffer. How do I get them?

I've looked all over the internet for this, and since I'm new to Emacs, I don't know what to search for. I'm not looking for mini-buffer completion for commands and such. I'm looking for code hints in the mini-buffer, as shown in this gif. I couldn't care less about the...

Emacs hotkey for diffing buffer from file without reading (confirming) buffer name

I have made a hotkey that calls the diff-buffer-with-file command but then you have to hit enter to confirm that the file you are on is the one to correctly diff: (global-set-key (kbd "C-c e") 'diff-buffer-with-file). I looked up the documentation and saw that you also give &optional BUFFER, so...

How to get Emacs to sort lines by length?

I'd like to be able to highlight a region in Emacs and then sort the region by line length. The closest I've found is the following code which I think will sort by length: (sort-subr t #'forward-line #'end-of-line nil nil (lambda (l1 l2) (apply #'< (mapcar (lambda (range) (- (cdr...

Jquery Autocomplete remembers the previous selection

The requirement is to display autocomplete addresses based on the region selected. The Jquery autocomplete is called everytime the region changes. I am getting the correct autocomplete addresses based on the region. But along with the new address list, I also get the address list for previously selected regions. To...

custom-set-variables add blank space on subsequent uses

I followed the emacs haskell tutorial, and couldn't understand some of its language regarding the use of custom-set-variables in the text quoted below. It seems that custom-set-variables should be used in one way on first usage, and another way (with added blank space) on subsequent uses. My questions are: What...

How to filter values in Multiple selection using textbox value

I have a text box and multiple selection box. When ever I write something in text box it will filter that text in the multiple selection and show only matched value. <!DOCTYPE html> <html> <body> <select id="uniqueCarNames" name="cars" multiple> <option value="volvo">Long Distance Travel</option> <option value="saab">Amazing </option> <option value="opel">Excellent Travelling</option> <option...

Facing error on Maps API v3 Places Autocomplete Form

I am using Maps API v3 Places Autocomplete form last few month for my project but when I am adding to another page Places Autocomplete is not working. I am getting error on this line: for (var component in componentForm) { document.getElementById(component).value = ''; document.getElementById(component).disabled = false; } and getting...

EMACS-Live + Slime error at startup

Ok, I must be missing something obvious. I'm getting stuck since yesterday to launch Emacs-live + slime. I'm using EMACS 24.3.1, installed Emacs-live and it worked well (if I start emacs-live without Slime it works), downloaded Slime-Pack from git and added this line to .emacs-live.el (live-append-packs '(~/.live-packs/slime-pack/)) I'm on a...

Using jquery-ui autocomplete in combination with dynamic form generation

I have a form that can be dynamically updated by using a js script based on this script. A select-list is dynamically generated to allow selection of an attribute for the dynamically generated field. However, the list contains hundreds of unique attributes and I therefore want to add a "search"...

How to start Emacs For Mac OS X from the command line without blocking?

A tip from the website of Emacs For Mac OS X suggests executing the following script to start it from the command line: #!/bin/sh /Applications/Emacs.app/Contents/MacOS/Emacs "[email protected]" However, this will block the command line until Emacs.app exists. Is there a way to start it from the command line without blocking?...

how to put a location name programmatically in Google JS autocomplete API and get the results?

When searching for Edinburgh napier university using google autocomplete API, I don't get the state and city, which should be scotland and edinburgh. I want that if the result doesn't include city and state, it takes the postal town name (which in our case is edinbrugh) and search for the...

Autocomplete Search With Link

So I'm Creating A School Management System And On The View Students Page I'm Wanting A Autocomplete Search System That Returns A Link Which Will Link To Another Page But It Needs To Look Through The Students Table To Get The id For The Page As Its viewrecord.php?id= then the...

Calculate a total from autocomplete suggestion.data

I'm trying to write a small Jquery program with an autocomplete searchform. I would like the user to be able to add items from the autocomplete form to a sort of shopping list. I have difficulties finding a way to calculate and update the total price of all added products,...

Elisp: how to make this function short

I am implementing an plugin, which a lot of project types are remembered. For example: angular, meteor, ember, rails ... And keyed arguments are used. The function creates an hash table with provided keys and values, and assign the hash table to another hash table. Code below: (defun jst-remember-project-type (type...

MELPA pointing to non-existent version of multi-term?

I am trying to use MELPA to install the emacs package "multi-term". When I do package-install multi-term, I get "http://melpa.org/packages/multi-term-20141203.1658.el: Not found". However, a more recent version http://melpa.org/packages/multi-term-20150220.1320.el is on MELPA. Why is emacs not installing this version?

How to modify JQuery autocomplete for characters greater that specified length?

I wrote a jQuery autocomplete code in my application, it works properly but now I want it to autocomplete only after minimum length is reached e.g. minlength=2 and in if condition if((('#id').val())>minlength) I tried following code var minlength = 2; $(document).ready(function () { var text = $('#patient_id').val(); $('#patient_id').autocomplete({ //var text...

Configuring Flycheck to work with C++11

I am having significant trouble configuring flycheck for C++11. Right now, flycheck is flagging things like std::to_string(). The checker I am using is just g++. What can I add in the .emacs file such that flycheck will assume C++11 by default?

Shell (zsh) through Emacs?

I usually run emacs in a terminal to work. I would like to run a shell inside a emacs window. I've found the shell command, but I would like to run the zsh I usually use inside (with my own configuration). Is it possible? EDIT : I succeeded to run...

javascript html placeholder error

Hello I have the following code on jsfiddle <label for="email">Kerko:</label> <input class="form-control" type="text" name="kerkim" id="input_main"> <label for="name"> Vendi:</label> <input type="text" class="form-control"> var placeholders = ['Elektricist','Hidraulik','Avokat','Doktor','Luleshites']; (function cycle() { var placeholder = placeholders.shift(); $('input_main').attr('placeholder',placeholder); placeholders.push(placeholder); setTimeout(cycle,2500); })();...

Get data value from php array with autocomplete jquery/ajax

I try to use the plugin from "devbridge autocomplete" : https://www.devbridge.com/sourcery/components/jquery-autocomplete/ I would like to get 3 values from my search.php page (and not just 1). It works for "value" but not for "data1" and "data2" (result for each = null) My jQuery code : $('#search-adress').autocomplete({ serviceUrl: 'search.php', dataType: 'json',...

Javascript Google Place API library not getting loaded dynamically

My javascript code var script = document.createElement('script'); script.src = 'https://maps.googleapis.com/maps/api/js?libraries=places'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); script.onload = function(){ var autocomplete; autocomplete = new google.maps.places.Autocomplete( (document.getElementById('autocomplete')), { types: ['geocode'] }); I get this error Cannot read property 'Autocomplete' of undefined at HTMLScriptElement.script.onload (mabapamavo.js:18:40) The above same code...

Error in Dired sorting on Windows (with Cygwin Emacs)

In a Cygwin Emacs on Windows, in Dired, if I try to sort by time (for example), I get the error: insert-directory: Listing directory failed but `access-file' worked In a Windows Emacs binary on Windows, I do not have any problem, but Emacs uses its own implementation of ls IIUC....

JQuery And JavaScript Search AutoComplete

I have an HTML code with this line: <input id="search" type="text" placeholder="Search"> And a JS file with those: var arr = ["A", "B", "C", "D"]; $('#search').autocomplete({ source: arr }); I am trying to make a autocomplete for a search engine, But i cant display my results in my HTML Web...

emacs: Symbol's function definition is void: loop

I am testing on loading packages in emacs init.el (Emacs 24.3). I followed a blog by the author of emacs prelude to automatically load packages, and copied the code there into my init.el as in the bottom. However, I got an error message about the loop function/symbol, which says: Symbol's...

Getting `which-func-mode` output as a string in Emacs lisp

I am trying to retrieve the output which-function-mode as a string in Emacs. I am going to create a keyboard binding shortcut that copies it to my clipboard. It seems like this (which-func-mode ("" which-func-format " ")) is used to insert which-function into Emacs header line. However, I can't seem...

Emacs bindings documentation

I am writing some bindings to lambdas in my ~/.emacs and would like to have a description of what the function does appear when I do (for example) C-c ?. I tried to put a string immediately after lambda () but that still does nothing. How do I get something...

Task Dependency in org-mode

I am trying to setup org-capture or org file for following issue: Task A is the major task. It depend upon minor tasks B and Task C. Now in org-agenda view, I should be able to see Task B and Task C. When they are done, I should be able...

Jquery .click() not working with livesearch [duplicate]

This question already has an answer here: Event binding on dynamically created elements? 8 answers I've implemented a live search basing on the string written in an input form. Results are displayed correctly in this way: <input type="text" class="form-control" name="search_client" id="search_client" required autocomplete="off"> <ul id="results_client" class="liveresults"> <li class="liveresult"> <h5...

autocomplete jquery element.autocomplete is not a function

Js import the files to my project, also try to do it from the official site url but not working. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> It seems strange that this happens in all the examples I've seen of this function are identical to what I do, but the error persists for me. I...

Struts2 autocompleter of struts jquery tag not taking another value other then of list after setting forceValidOption to false [duplicate]

This question already has an answer here: Struts 2 jquery autocompleter with forceValidOption=“false” 1 answer I have a jsp file in which i have a struts autocompleter box of struts jquery plugin. This box is not taking any other value which is not in the autocomplete list after setting...

sublime 3 adds extra angular bracket on autocomplete

I find on sublime 3 that if I autocomplete code I sometimes get an extra angular bracket. for example, If I start writing "<ht", I get an option to autocomplete the html tag, but the code produced looks like this: <<!DOCTYPE html> <!-- Extra angle bracket here --> <html> <head>...

Exceed evaluation depth when forward function in Emacs Lisp

Here is just a simplified code snipped I have not managed to work. I do not understand what is wrong. (defun enumerate-indicies (func) (let ((index 0)) (while (< index 5) (funcall func index) (setq index (1+ index))))) (defun enumerate-multiplied-indicies (func) (enumerate-indicies #'(lambda (index) (funcall func (* 10 index))))) The following...

Emacs dired, what controls the color of the title line of a directory

As the picture shown in attachment, what is the variable, if any, that controls the color of the title line of the directory? I'm trying to change the darkgreen to grey.

autocomplete rails routes issues

I'm using the rails-jquery-autocomplete gem for an rfq model to search customers. The autocomplete search works fine when I'm creating a new rfq, but I get this error when I try to use the search while editing a record. ActionController::RoutingError (No route matches [GET] "/rfqs/1/autocomplete_customer_name"): I know what the error...

Confused when setting an Emacs face

(set-face-attribute 'diredp-dir-heading nil '(t (:foreground blue :background dark1))) What should be the right statements to set this face? Bow//...

looking for help in configuring .emacs file for python (python.el),

My emacs version is 24.5, using in built python. I have written these lines in my .emacs for it: (require 'python) (setq python-shell-interpreter "C:/Python34") The problem is none of the commands (when I am trying to run test.py) are working. I have tried several commands named like M-x python-shell-* and...

WPF AutocompeteBox in datagrid Cell does not work properly

I am testing the WPF AutoCompleteBox control in datagrid cell. I met two problems: 1) when i navigate to the autocomplete cell , it does not automatically switch to edit mode, 2) When I switch into edit mode and I type something, the list of suggesstions doesn’t appears and I...

Autocompletion doesn't autocomplete

Here is a page with: <form action="action.php" method="get" autocomplete="on"> First name:<input type="text" name="fname"><br> E-mail: <input type="email" name="email"><br> <input type="submit"> </form> Let's enter the 2 fields, and submit. Then when reloading the page, the fields are not autocompleted, why? Should I use local-storage? cookies? to be sure that a user that...

Using Devbridge Autocomplete, is there a way to detect no results?

I'm using Devbridge Autocomplete (https://www.devbridge.com/sourcery/components/jquery-autocomplete) on an input field type text and reading results from an array. Is there a way to: 1) Only allow to select from the list of results and not type anything else in the field 2) If no results are found, trigger a function Code:...

Emacs - selection not showing in windowed mode

I have Emacs on a Kubuntu 15.04 OS and I have a problem in showing the selected region; if I run emacs in the terminal windows with -nw option, I can set marks and I see the selected region highlighted; but if emacs starts in a window, the selected region...

Utilizing BinarySearch to do an Autocomplete exercise

Hi I'm making a program that takes an array of "Terms" each of which have their own weights (Long value) and queries (String value). It should take many terms from a .txt file and initialize them into a private "Terms" array, and then it uses arrays.sort to rearrange their queries...

dojo FilteringSelect takes time to autocomplete, any hack to autocomplete it faster?

Good Folks, I'm using dojo FilteringSelect to populate list of numbers on UI from database. I have observed that if I tab out immediately after keying in a valid value in the text box (valid = value is present in drop down list), text box turns red indicating that there's...

ESS produces “Variable binding depth exceeds max-specpdl-size”

I am trying ESS (Emacs Speaks Statistics). The problem is: Ctrl-P and the up-arrow are disabled on any buffer because of the following error: Variable binding depth exceeds max-specpdl-size The trigger is the following line in .emacs.el (require 'ess-site) This line is needed to load ESS. If I delete this...

org-mode agenda view matching tag and todo state

I would like to create an agenda view with org-agenda-custom-commands, which will connect capabilities todo-tree and tags-tree. That's what I want to achieve, this sparse tree suited to such a search C-c / m JOB+TODO="NEXT"...

How to implement the “auto pairing of quotes” feature in custom mode in ace-editor

I want to add "auto pairing of quotes" feature in my custom mode. I find the solution that add editor.setBehavioursEnabled(true), but it seems like only work for existing mode. I know I perhaps miss some code in my custom mode. Can anyone point out which code is response for this...

Open AutoCompleteField on click

I'm using the Eclipse AWT framework, and I've got a combobox. I've set the visible amount of items in the combobox to 0, so that clicking the dropdown doesn't show anything (even though the box is populated). I have an AutoCompleteField on the box, so that anyone typing into the...

Msysgit git Bash change of behavior on autocomplete

Up to 1.9.4 git Bash, on hitting tab, would auto-complete up to ambiguity and then let me complete the rest (for branches, tags etc). As of 1.9.5 (version 1.9.5-preview20141217) it will present me with a list of the possible branches/tags etc and let me choose. I much preferred the previous...

Rails-JQuery-Autocomplete search multiple attributes

I'm using the rails-jquery-autocomplete gem to find a customer in a form. Controller class RfqsController < ApplicationController autocomplete :customer, :name, full:true view file <div class="field"> <%= f.label :customer %> <%= f.autocomplete_field :customer, :autocomplete_customer_name %> <%= link_to "new customer", new_customer_path, class: "new_customer_link"%> </div> Currently, It only searches by the customer name....

Xcode, have delegate method auto-include classes

In Xcode I would like to add a delegate such as UITextFieldDelegate and have methods such as textFieldShouldReturn auto added to my document In Java when I include an interface, my IDE typically forces me to auto-add some particular classes, which I tend to add code into. Is there any...

How to simulate the float value that appears when you type on the input

It is very difficult to understand what I intend to do. I would like to simulate the float value that appears when you type on the input, but depending on what you want the person to load certain values in an array I define and enable the individual to select...